I wrote this script to updat or alter profile information.
But when i use this script it fills nothing for password and sometimes even nothing for everything else.
I will show the two main pages.
profiel.php
<?php
session_start();
include 'header.php';
?>
<form name="form1" method="post" action="<?php echo "change.php?".SID; ?>">
<input type="hidden" name="userid" id="userid" value="<?php echo $_SESSION['userid']; ?>">
<tr>
<td width="90%" colspan="3"><center><font color="#FFFF00" face="Fixedsys">Je Profiel veranderen.</font><br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Nicknaam</font></td>
<td><input name="user_name" id="user_name" type="text" value="<?php echo $_SESSION['user_name']; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Paswoord</font></td>
<td><input name="password" type="password" id="password" value=""></td>
</tr>
<tr>
<td width="24%" align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Voornaam</font></td>
<td width="76%"><input name="first_name" type="text" id="first_name" value="<?php echo $_SESSION['first_name']; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Achternaam</font></td>
<td><input name="last_name" type="text" id="last_name" value="<?php echo $_SESSION['last_name']; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Email Adres</font></td>
<td><input name="email_address" type="text" id="email_address" value="<?php echo $_SESSION['email_address']; ?>"></td>
</tr>
<tr>
<td align="left" valign="top"><font color="#FFFF00" face="Fixedsys">Info over je auto</font></td>
<td><textarea name="info" id="info"><?php echo $_SESSION['info']; ?></textarea></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td><input type="submit" name="Submit" value="Verander"></td>
</tr>
</table>
<form>
</td>
</tr>
<?php
include 'footer.php';
?>
and change.php:
<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$user_name = $_POST['user_name'];
$info = $_POST['info'];
$password = $_POST['password'];
$userid = $_POST['userid'];
$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);
$info = stripslashes($info);
$user_name = stripslashes($user_name);
$password = stripslashes($password);
if((!$first_name) || (!$last_name) || (!$email_address) || (!$info) || (!$password) || (!$user_name)){
echo 'Je hebt de volgende informatie niet ingevult.<br />';
if(!$first_name){
echo "Voornaam, deze is benodigt.<br />";
}
if(!$last_name){
echo "Achternaam, deze is benodigt.<br />";
}
if(!$email_address){
echo "Email adres, deze is benodigt.<br />";
}
if(!$info){
echo "Info auto, deze is benodigt.<br />";
}
if(!$user_name){
echo "Nicknaam, deze is benodigt.<br />";
}
if(!$password){
echo "Paswoord, deze is benodigt.<br />";
}
include 'profiel.php'; // Show the form again!
exit();
}
$password = md5($password);
include 'db.php';
$info2 = htmlspecialchars($info);
$sql="UPDATE users SET first_name='$first_name', last_name='$last_name', username='$user_name', password='$password', email_address='$email_address', info='$info2' WHERE userid='$userid'" ;
$isert=mysql_query($sql, $connection) or die (mysql_error());
if(!$isert)
{
echo "foutje";
}
else {
echo "Je profiel is geupdate.<br>Je moet jezelf opnieuw aanmelden om de verandering te activeren.<a href=\"logout.php\">Logout</a>";
}
?>
When i execute it it just says this line:echo "Je profiel is geupdate.<br>Je moet jezelf opnieuw aanmelden om de verandering te activeren.<a href=\"logout.php\">Logout</a>";
So it has to be well done.
But not. it won't update...
Any body any idea how to work this out ??