Location: PHPKode > projects > Gsys > php/do_edit_account2.php
<?PHP
//Filename : do_edit_account.php
//Description : Script to enter new/updated data in the database assuming it authenticates correctly
//Author :  darc
//Last modified :  2006.12.20

//Correct authentication == username matching id#

    include '../includes/db.php';

function sql_quote( $value )
{
    if( get_magic_quotes_gpc() )
    {$value = stripslashes( $value );}
    if( function_exists( "mysql_real_escape_string" ) )
    {$value = mysql_real_escape_string( $value );}
    else{$value = addslashes( $value ); }
    return $value;
}

$f_name = $_POST[f_name];
$m_name = $_POST[m_name];
$l_name = $_POST[l_name];
$email = $_POST[email];
$nick = $_POST[nickname];
$phone = $_POST[phone];
$address = $_POST[address];
$town = $_POST[town];
$state = $_POST[state];
$zip = $_POST[zip];
$initation_date = $_POST[initiation_date];
$dob = $_POST[dob];
$pos = $_POST[pos];
$username = $_POST[username];

$f_name = sql_quote($f_name);
$m_name = sql_quote($m_name);
$l_name = sql_quote($l_name);
$email = sql_quote($email);
$nick = sql_quote($nick);
$phone = sql_quote($phone);
$address = sql_quote($address);
$town = sql_quote($town);
$state = sql_quote($state);
$zip = sql_quote($zip);
$initiation_date = sql_quote($initation_date);
$dob = sql_quote($dob);
$pos = sql_quote($pos);
$username = sql_quote($username);

    $sql ="UPDATE `brothers` SET f_name = '$f_name', m_name = '$m_name', l_name = '$l_name', email = '$email', nickname = '$nick', phone = '$phone', address = '$address', town = '$town', state = '$state', zip = '$zip', initiation_date = '$initiation_date', dob = '$dob', pos = '$pos' WHERE `username`= '$username';";
	
    mysql_query($sql,$connection) or die(mysql_error());
	
$body = "$username edited account";
$sender_pin = "0";
$to_pin = "1";
$title = "Account Edit";

$sql2 = "INSERT INTO `messages` (`msg_id` , `to_pin` , `from_pin` , `date_sent` , `title` , `body` , `read`) VALUES ('', '$to_pin', '$sender_pin', NOW(), '$title', '$body', '0')";
mysql_query($sql2,$connection) or die(mysql_error());

    echo "Information Successfully Updated! You will now be returned to the Local Brotherhood Services.
	<META HTTP-EQUIV=\"Refresh\"
     CONTENT=\"2; URL=brother_home.php\">";

?>
Return current item: Gsys