PHP beginner |
|
Heey,
Ik heb zo'n script, en ik wil hem dus bekijken op een browser, maar dat gaat niet... Ik zie geen error ofzo, het is gewoon een LEEG scherm ... ik include hem in index.php, maar daar is niets mis mee... hier is mijn script:
<table width="100%" class="font" cellpadding="0" cellspacing="0" align="center" style="border: none; border-collapse: collapse;">
<tr>
<td valign="middle" align="right"><img src="images/headers/tls.gif" border="0"></td>
</tr>
<tr>
<td style="height: 10px;"></td>
</tr>
</table>
<?PHP
if (isset($_POST['edit'])) {
if (empty(($_POST['surname'] || $_POST['town'] || $_POST['bday'] || $_POST['bmonth'] || $_POST['byear'] || $_POST['zodiac_sign'] || $_POST['nickname'] || $_POST['artists'] || $_POST['movie'] || $_POST['favgroup'] || $_POST['dream'] || $_POST['freetime'] || $_POST['saying']))) {
?>
alle velden moeten ingevuld worden!
<?PHP
} else {
mysql_query("UPDATE admins SET surname='".addslashes($_POST['surname'])."', town='".addslashes($_POST['hometown'])."', bday='".addslashes($_POST['bday'])."', bmonth='".addslashes($_POST['bmonth'])."', byear='".addslashes($_POST['byear'])."', sign='".addslashes($_POST['zodiacsign'])."', nick='".addslashes($_POST['nickname'])."', artists='".addslashes($_POST['artists'])."', movie='".addslashes($_POST['movie'])."', favgroup='".addslashes($_POST['favgroup'])."', dream='".addslashes($_POST['dream'])."', freetime='".addslashes($_POST['freetime'])."', saying='".addslashes($_POST['saying'])."'") or die(mysql_error());
?>
gelukt..
<?PHP
}
} elseif (isset($_POST['password'])) {
$select = mysql_query("SELECT * FROM admins WHERE pass='".md5($_POST['pass1'])."'") or die(mysql_error());
if (mysql_num_rows($select) <> 0) {
if ($_POST['pass1'] == $_POST['pass2']) {
mysql_query("UPDATE admins SET pass='".md5($_POST['newpass'])."'");
?>
gelukt...
<?PHP
} else {
?>
beide wachtwoorden zijn niet gelijk!
<?PHP
}
} else {
?>
wachtwoord is niet correct!
<?PHP
}
} else {
$select = mysql_query("SELECT * FROM admins WHERE name='".$_SESSION['suser']."'");
$data = mysql_fetch_array($select);
$name = $data['name'];
$surname = stripslashes($data['surname']);
$nickname = stripslashes($data['nick']);
$zodiacsign = stripslashes($data['sign']);
$hometown = stripslashes($data['town']);
$artists = stripslashes($data['artists']);
$movie = stripslashes($data['movie']);
$favgroup = stripslashes($data['favgroup']);
$freetime = stripslashes($data['freetime']);
$dream = stripslashes($data['dream']);
$saying = stripslashes($data['saying']);
?>
<table width="98%" class="font" cellpadding="0" cellspacing="0" align="center" style="border: none; border-collapse: collapse;">
<tr>
<td valign="middle" style="background-color: #FFFFFF; border: 1px solid #666666; padding: 2pt 3.5pt 2pt 3.5pt;">
<table width="100%" class="font" cellpadding="0" cellspacing="2" align="center" style="border: none; border-collapse: collapse;">
<form name="form" method="post" action="<?PHP $_SERVER['PHP_SELF']; ?>">
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Name:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="name" class="input" maxlength="50" value="<?= $name; ?>" disabled></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Surname:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="surname" class="input" maxlength="50" value="<?= $surname; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Nickname:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="nickname" class="input" maxlength="50" value="<?= $nickname; ?>"></td>
</tr>
<tr>
<td colspan="2" style="height: 10px;"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Birth Date:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt">
<select name="bday" class="font">
<option value="">Day</option>
<option value="">- - - - - - -</option>
<?PHP
$your = $data['bday'];
$choice = array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
foreach ($choice as $value) {
if ($value == $your) {
$selected = " SELECTED";
} else {
$selected = "";
}
echo "<option value=".$value.$selected.">".$value."</option>";
}
?>
</select>
<select name="bmonth" class="font">
<option value="">Month</option>
<option value="">- - - - - - -</option>
<?PHP
$your = $data['bmonth'];
$choice = array('January','February','March','April','May','June','July','August','September','October','November','December');
foreach ($choice as $value) {
if ($value == $jouw) {
$selected = " SELECTED";
} else {
$selected = "";
}
echo "<option value=".$value.$selected.">".$value."</option>";
}
?>
</select>
<select name="byear" class="font">
<option value="">Year</option>
<option value="">- - - - - - -</option>
<?PHP
for($y = date('Y'); $y >= 1900; $y--)
{
?>
<option value="<?= $y; ?>"<?= ($data['byear'] == $y ? " selected=\"selected\"" : "") ?>><?= $y; ?></option>
<?PHP
}
?>
</select>
</td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Zodiac Sign:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="zodiacsign" class="input" maxlength="50" value="<?= $zodiacsign; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Hometown:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="hometown" class="input" maxlength="50" value="<?= $hometown; ?>"></td>
</tr>
<tr>
<td colspan="2" style="height: 10px;"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">These artists inspired me:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="artists" class="input" maxlength="200" value="<?= $artists; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Movie:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="movie" class="input" maxlength="200" value="<?= $movie; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Group(s)/Artist(s):</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="favgroup" class="input" maxlength="200" value="<?= $favgroup; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite thing to do in free time:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="freetime" class="input" maxlength="200" value="<?= $freetime; ?>"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Dream:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="dream" class="input" maxlength="200" value="<?= $dream; ?>"></td>
</tr>
<tr>
<td colspan="2" style="height: 10px;"></td>
</tr>
<tr>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Saying:</td>
<td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="saying" class="input" maxlength="50" value="<?= $saying; ?>"></td>
</tr>
<tr>
<td colspan="2" style="height: 10px;"></td>
</tr>
<tr>
<td width="50%" valign="middle" style="padding: 2pt 3.5pt 2pt 3.5pt;"><input type="submit" name="edit" value="Edit" class="submit"></td>
<td width="50%" valign="middle" style="padding: 2pt 3.5pt 2pt 3.5pt;"><input type="reset" value="Reset" class="submit"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
<?PHP
}
?>
<table width="100%" class="font" cellpadding="0" cellspacing="0" align="center" style="border: none; border-collapse: collapse;"> <tr> <td valign="middle" align="right"><img src="images/headers/tls.gif" border="0"></td> </tr> <tr> <td style="height: 10px;"></td> </tr> </table> <?PHP if (isset($_POST['edit'])) { if (empty(($_POST['surname'] || $_POST['town'] || $_POST['bday'] || $_POST['bmonth'] || $_POST['byear'] || $_POST['zodiac_sign'] || $_POST['nickname'] || $_POST['artists'] || $_POST['movie'] || $_POST['favgroup'] || $_POST['dream'] || $_POST['freetime'] || $_POST['saying']))) { ?> alle velden moeten ingevuld worden! <?PHP } else { mysql_query("UPDATE admins SET surname='".addslashes($_POST['surname'])."', town='".addslashes($_POST['hometown'])."', bday='".addslashes($_POST['bday'])."', bmonth='".addslashes($_POST['bmonth'])."', byear='".addslashes($_POST['byear'])."', sign='".addslashes($_POST['zodiacsign'])."', nick='".addslashes($_POST['nickname'])."', artists='".addslashes($_POST['artists'])."', movie='".addslashes($_POST['movie'])."', favgroup='".addslashes($_POST['favgroup'])."', dream='".addslashes($_POST['dream'])."', freetime='".addslashes($_POST['freetime'])."', saying='".addslashes($_POST['saying'])."'") or die(mysql_error()); ?> gelukt.. <?PHP } } elseif (isset($_POST['password'])) { if ($_POST['pass1'] == $_POST['pass2']) { ?> gelukt... <?PHP } else { ?> beide wachtwoorden zijn niet gelijk! <?PHP } } else { ?> wachtwoord is niet correct! <?PHP } } else { $select = mysql_query("SELECT * FROM admins WHERE name='".$_SESSION['suser']."'"); $name = $data['name']; ?> <table width="98%" class="font" cellpadding="0" cellspacing="0" align="center" style="border: none; border-collapse: collapse;"> <tr> <td valign="middle" style="background-color: #FFFFFF; border: 1px solid #666666; padding: 2pt 3.5pt 2pt 3.5pt;"> <table width="100%" class="font" cellpadding="0" cellspacing="2" align="center" style="border: none; border-collapse: collapse;"> <form name="form" method="post" action="<?PHP $_SERVER['PHP_SELF']; ?>"> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Name:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="name" class="input" maxlength="50" value="<?= $name; ?>" disabled></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Surname:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="surname" class="input" maxlength="50" value="<?= $surname; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Nickname:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="nickname" class="input" maxlength="50" value="<?= $nickname; ?>"></td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Birth Date:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"> <select name="bday" class="font"> <option value="">Day</option> <option value="">- - - - - - -</option> <?PHP $your = $data['bday']; $choice = array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'); foreach ($choice as $value) { if ($value == $your) { $selected = " SELECTED"; } else { $selected = ""; } echo "<option value=".$value.$selected.">".$value."</option>"; } ?> </select> <select name="bmonth" class="font"> <option value="">Month</option> <option value="">- - - - - - -</option> <?PHP $your = $data['bmonth']; $choice = array('January','February','March','April','May','June','July','August','September','October','November','December'); foreach ($choice as $value) { if ($value == $jouw) { $selected = " SELECTED"; } else { $selected = ""; } echo "<option value=".$value.$selected.">".$value."</option>"; } ?> </select> <select name="byear" class="font"> <option value="">Year</option> <option value="">- - - - - - -</option> <?PHP for($y = date('Y'); $y >= 1900; $y--) { ?> <option value="<?= $y; ?>"<?= ($data['byear'] == $y ? " selected=\"selected\"" : "") ?>><?= $y; ?></option> <?PHP } ?> </select> </td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Zodiac Sign:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="zodiacsign" class="input" maxlength="50" value="<?= $zodiacsign; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Hometown:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="hometown" class="input" maxlength="50" value="<?= $hometown; ?>"></td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">These artists inspired me:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="artists" class="input" maxlength="200" value="<?= $artists; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Movie:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="movie" class="input" maxlength="200" value="<?= $movie; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Group(s)/Artist(s):</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="favgroup" class="input" maxlength="200" value="<?= $favgroup; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite thing to do in free time:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="freetime" class="input" maxlength="200" value="<?= $freetime; ?>"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Dream:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="dream" class="input" maxlength="200" value="<?= $dream; ?>"></td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt;">Favorite Saying:</td> <td valign="middle" style="height: 15px; padding: 2pt 3.5pt 2pt 3.5pt"><input type="text" name="saying" class="input" maxlength="50" value="<?= $saying; ?>"></td> </tr> <tr> <td colspan="2" style="height: 10px;"></td> </tr> <tr> <td width="50%" valign="middle" style="padding: 2pt 3.5pt 2pt 3.5pt;"><input type="submit" name="edit" value="Edit" class="submit"></td> <td width="50%" valign="middle" style="padding: 2pt 3.5pt 2pt 3.5pt;"><input type="reset" value="Reset" class="submit"></td> </tr> </form> </table> </td> </tr> </table> <?PHP } ?>
Iemand een opslossing?
die form van wachtwoord moet ik nog maken, maar zonder dat moet hij de rest toch wel laten zien?
|