Location: PHPKode > scripts > Ramui web hosting directory script > Ramui web hosting directory script/gb/user/include/clsuser.php
<?php
/*
Copyright (c) 2011 http://ramui.com. All right reserved.
This product is protected by copyright and distributed under licenses restricting copying, distribution. Permission is granted to the public to download and use this script provided that this Notice and any statement of authorship are reproduced in every page on all copies of the script.
*/
class user extends clslogin
{
private function usercp($message='')
{
		$query=sprintf("SELECT* FROM ".$this->prefix."user WHERE id = %d",$this->uid);
		$result=@mysql_query($query);
		$row = @mysql_fetch_array($result, MYSQL_ASSOC);
		$disabled_email=(!$this->site['allowemail']);
		$verify_user=$this->site['verifyuser'];
		$title='UserCP :: '.$row['user'];
		$menu=$this->get_menu();
		$scriptfile='<script type="text/javascript" src="../script/user.js"></script>';
		include "include/head.php";
		include "include/usercp.php";
		include "include/footer.html";
}
private function save_user()
{
		$website=trim(fw_strip_slashes($_POST["website"]));
		$email=trim(fw_strip_slashes($_POST["email"]));
		$password=trim(fw_strip_slashes($_POST["cpw"]));
		$newpassword=trim(fw_strip_slashes($_POST["npw"]));
		$allowemail=(isset($_POST["allowemail"])&&($_POST["allowemail"]=='Y'))? 'Y' : '';
		$query=sprintf("SELECT* FROM ".$this->prefix."user WHERE id = %d",$this->uid);
		$result=@mysql_query($query);
		$row = @mysql_fetch_array($result, MYSQL_ASSOC);
		$query=sprintf("UPDATE ".$this->prefix."user set website = '%s', allowemail = '$allowemail'",mysql_real_escape_string($website));
		if((!empty($password))&&(fw_validate_password($newpassword))&&($row['password']===md5($password))){$query.=sprintf(", password = '%s'",mysql_real_escape_string(md5($newpassword)));}
		if($email!==$row['email']){
			if(!fw_validate_email($email)){$message='<span style="color:red; background-color:white;">Error! Invalid email address.</span>';$this->usercp($message);exit;}
			else{
				if($this->site['verifyuser']){
					if(!($this->mail_email_change($email,$row['name'],$this->uid))){$message='<span style="color:red;">System error! Please  contact site administrator.</span>';$this->usercp($message);exit;}
					$message='<br />A verification has been sent to your new email address.';}
				else{$query.=sprintf(", email = '%s'",mysql_real_escape_string($email));}
			}
		}
		$query.=sprintf(" WHERE id = %d",$this->uid);
		@mysql_query($query);
		$message='<span style="color:green; background-color:white;">Data has been updated.'.$message.'</span>';$this->usercp($message);exit;
}
public function get_query($qur)
{
		$message='';
		if($this->verify_user($message)){
			switch ($qur[1]){
				case "1":
					$this->usercp($qur[2]);
				break;
				case "2":
					$this->save_user();
				break;
				case "5":
					$this->log_out();
				break;
				default:
					$this->usercp();
			}
		}
		else{
			if($qur[1]!="2"){$this->log_in($message);}
			else{@header("Location: index.php");}
		}
}
}
?>
Return current item: Ramui web hosting directory script