Originally posted by TheDefender
OK, so do you already have your own code to show us so we can help, or are you looking for someone to write the code for you? What exactly do you need help with here?
lol i have my own code
<?php
include("./admin/config.php");
include("$include_path/common.php");
global $HTTP_POST_VARS,$HTTP_GET_VARS,$HTTP_SESSION_VARS;
global $_SESSION;
if ($HTTP_POST_VARS!="")
$_POST=$HTTP_POST_VARS;
if ($HTTP_GET_VARS!="")
$_GET=$HTTP_GET_VARS;
if ($HTTP_SESSION_VARS!="")
$_SESSION=$HTTP_SESSION_VARS;
check_user_login();
if(isset($_POST['update_profile'])){
if(isset($_POST['keep_me_logged_in'])){
if($_POST['keep_me_logged_in'] == "Y"){
$md5 = md5(time());
$sql = "
replace into $tb_cookies (
userid,
cookie
) values (
'$_SESSION[userid]',
'$md5'
)
";
$query = mysql_query($sql) or die(mysql_error());
setcookie("keep_me_logged_in", $md5, time() + 31536000);
$keep_me_logged_in_yes = " checked";
$keep_me_logged_in_no = "";
$_SESSION['sl'] = false;
} else {
unset($_SESSION['rc']);
$_SESSION['sl'] = true;
setcookie("keep_me_logged_in");
$keep_me_logged_in_yes = "";
$keep_me_logged_in_no = " checked";
}
}
if(strlen($_POST['PW1']) > 1){
if(strlen($_POST['PW1']) < 4){
$update_error=1;
$PW1_html = "<br>Your Password must be at least 4 chars";
}
if(strlen($_POST['PW1']) > 16){
$update_error=1;
$PW1_html = "<br>Your Password must be less than 16 chars";
}
if($_POST['PW1'] != $_POST['PW2']){
$update_error=1;
$PW2_html = "<br>Your Passwords must match";
} else $PW = $_POST['PW1'];
$PW_update = 1;
}
if(!isset($update_error)){
$ud_sql = "update $tb_users set ";
if(isset($PW_update)) $ud_sql .= "password = password('$PW'),";
//$quote = addslashes($_POST['update_quote']);
//$description = addslashes($_POST['update_description']);
//$hint = addslashes($_POST['update_hint']);
$quote = $_POST['update_quote'];
$description = $_POST['update_description'];
$hint = $_POST['update_hint'];
$signature = $_POST['update_signature'];
$ud_sql .= "
email = '$_POST[update_email]',
quote = '$quote',
url = '$_POST[update_url]',
country = '$_POST[update_country]',
state = '$_POST[update_state]',
realname = '$_POST[update_realname]',
description = '$description',
signature = '$signature',
hint = '$hint',
subscribed = '$_POST[subscribed]'
where
id = '$_SESSION[userid]'
";
$ud_query = mysql_query($ud_sql) or die(mysql_error());
$mid=$_SESSION[userid];
signup_fields_updation($mid,'e',$_POST);
$message = "<font color=red>Profile update complete.</font>";
}
}
include("$include_path/$table_file");
include("$include_path/doc_head.php");
include("$include_path/styles.php");
if(!isset($_POST['update_profile'])){
if(isset($_COOKIE['keep_me_logged_in']) && $_COOKIE['keep_me_logged_in']){
$keep_me_logged_in_yes = " checked";
$keep_me_logged_in_no = "";
} else {
$keep_me_logged_in_yes = "";
$keep_me_logged_in_no = " checked";
}
}
include("$include_path/left.php");
include("$include_path/right.php");
include ("Ads_new.php");
$content = "";
$gp_sql = "
select
*
from
$tb_users
where
id = '$_SESSION[userid]'
";
$gp_query = mysql_query($gp_sql) or die(mysql_error());
$gp_array = mysql_fetch_array($gp_query);
//$gp_array[description]=stripslashes($gp_array[description]);
//$gp_array[quote]=stripslashes($gp_array[quote]);
//$gp_array[hint]=stripslashes($gp_array[hint]);
//$gp_array_url = stripslashes($gp_array["url"]);
$gp_array[description]=$gp_array[description];
$gp_array[signature]=$gp_array[signature];
$gp_array[quote]=$gp_array[quote];
$gp_array[hint]= $gp_array[hint];
$gp_array_url = $gp_array["url"];
if(!isset($age_html)) $age_html = "";
if(!isset($email_html)) $email_html = "";
if(!isset($PW1)) $PW1 = "";
if(!isset($PW1_html)) $PW1_html = "";
if(!isset($PW2)) $PW2 = "";
if(!isset($PW2_html)) $PW2_html = "";
if($gp_array["subscribed"] == "yes"){
$subscribed_yes = " checked";
$subscribed_no = "";
} else {
$subscribed_yes = "";
$subscribed_no = " checked";
}
$flags_list = getFlagList($base_path . "/images/flags", $gp_array["country"]);
$user_types = get_user_types($gp_array["user_type"]);
$states_list = get_states_list($gp_array["state"]);
if(isset($_POST['update_profile'])){
$tpl->assign(array('MESSAGE' => $message));
$tpl->parse('MESSAGE_BLOCK', 'profile_message');
} else {
$tpl->clear_dynamic('profile_message');
}
$age_options = get_age_options($gp_array["age"]);
$uid=$_SESSION[userid];
$sql="select username from $tb_users where id=$uid";
$res=mysql_query($sql);
$users=mysql_fetch_array($res);
$username=$users[0];
//$tpl->assign(array('USERNAME' => $_SESSION[username],
$tpl->assign(array('USERNAME' => $username,
'KEEP_ME_LOGGED_IN_YES' => $keep_me_logged_in_yes,
'KEEP_ME_LOGGED_IN_NO' => $keep_me_logged_in_no,
'AGE_HTML' => $age_html,
'UID' => $uid,
'EMAIL' => $gp_array[email],
'EMAIL_HTML' => $email_html,
'REALNAME' => $gp_array[realname],
'DESCRIPTION' => $gp_array[description],
'SIGNATURE' => $gp_array[signature],
'STATES_LIST' => $states_list,
'FLAGS_LIST' => $flags_list,
'URL' => $gp_array_url,
'QUOTE' => $gp_array[quote],
'HINT' => $gp_array[hint],
'SUBSCRIBED_YES' => $subscribed_yes,
'SUBSCRIBED_NO' => $subscribed_no,
'ADDITIONAL_FIELDS' => additional_signup_fields($uid),
'PW1' => $PW1,
'PW1_HTML' => $PW1_html,
'PW2' => $PW2,
'PW2_HTML' => $PW2_html,
));
$tpl->parse('CONTENT', 'profile_content');
$content = $tpl->fetch('CONTENT');
$final_output = table("Edit Profile", $content);
$tpl->assign(array('CONTENT_TEXT' => $final_output));
$tpl->parse('PAGE', 'main');
$final_output = $tpl->fetch('PAGE');
$final_output = final_output($final_output);
//echo $final_output;
include ("copy.php");
?>