So its a script to update your profile
(Based off Vauth)
So heres the main page PHP
[php]
Update info
| Old Password: | |
| New Password: | |
| Confirm: | |
| Age: | "> |
| Gender: | About You: | <? echo $check["about"] ?> |
| Your Site Tasks: | <? echo $check["tasks"] ?> |
|
|
|
"; print " "; print " Old password is wrong!"; print " "; print "
"; exit; } // Check if New password if blank if (trim($newpasswd) == "") { print ""; print " "; print " Password Blank!"; print " "; print "
"; exit; } if (trim($age) == "") { print ""; print " "; print " Age Blank!"; print " "; print "
"; exit; } if (trim($gender) == "") { print ""; print " "; print " Gender Blank!"; print " "; print "
"; exit; } if (trim($location) == "") { print ""; print " "; print " Location Blank!"; print " "; print "
"; exit; } if (trim($about) == "") { print ""; print " "; print " About Blank!"; print " "; print "
"; exit; } if (trim($tasks) == "") { print ""; print " "; print " Tasks Blank!"; print " "; print "
"; exit; } if (trim($avatar) == "") { print ""; print " "; print " Avatar Blank!"; print " "; print "
"; exit; } if ($newpasswd != $confirmpasswd) { print ""; print " "; print " New password was not confirmed!"; print " "; print "
"; exit; } // If everything is ok, use auth class to modify the record $update = $user->modify_user( $username, $password, $check["team"], $check["level"], $check["status"], $check["name"], $age, $gender, $location, $check["profile"], $about, $tasks, $avatar); if ($update) { print "";
print " ";
print " Profile Updated!
";
print " ";
print "
This comes back as profile updated 
But then I look at the database and It hasnt updated
This is the addon page auth.php code snippet to do with this script
[php]// MODIFY USERS
function modify_user($username, $password, $team, $level, $status, $name, $age, $gender, $location, $profile, $about, $tasks, $avatar) {
// If $password is blank, make no changes to the current password
if (trim($password == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($age == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($gender == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($location == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($about == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($tasks == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($avatar == ''))
{
$qUpdate = "UPDATE staff SET team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar' WHERE username='$username'";
}
else
{
$qUpdate = "UPDATE staff SET passwd=MD5('$password'), team='$team', level='$level', status='$status', name='$name', age='$age', gender='$gender', location='$location', profile='$profile', about='$about', tasks='$tasks', avatar='$avatar'
WHERE username='$username'";
}
if (trim($level)=="") {
return "blank level";
}
else if (($username=="sa" AND $status=="inactive")) {
return "sa cannot be inactivated";
}
else if (($username=="admin" AND $status=="inactive")) {
return "admin cannot be inactivated";
}
else {
$connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);
$SelectedDB = mysql_select_db($this->DBNAME);
$result = mysql_query($qUpdate);
return 1;
}
} // End: function modify_user
[/php]
I am still learning php.
Please be clear on where Im going wrong so I can learn further.
Because my script is based from another Ive added the change password part as a base to go off. I Dont actually want member to have to change their password each time they update, So Can I remove that bit? If so what do I need to change for it still to work?
