session_start();
include('userloginchecker.php');
include_once("../classes/user.class.php");
include_once("../classes/validation.class.php");
include_once("../classes/image_resize.php");
include_once("../classes/commonDB.class.php");
include_once("../connect.php");
$userObj = new user(); // instance of connection class | geting functions
$comobj = new commonDB(); // instance of connection class | geting functions
$valobj = new validation();
$btnTxt = (empty($id))? "Add" : "Edit";
$userid =$_SESSION['useradmin']['userid'];
$userid_class =$_SESSION['useradmin']['class'];
$pop = safe($_GET['id']); // get id from url
//---------------------------
if ( $userid_class == 1){$admin_link ="../compadminPR.php";}
if ( $userid_class == 2){$admin_link ="../compadmin.php";}
//---------------------------
$filePath = PROFILE_IMG_PATH_LOGO;
$result_s = mysql_query("SELECT * FROM user WHERE userid ='$userid'"); // get all images based on id
while ($row = mysql_fetch_assoc($result_s))
{
$img_logo = $row['complogo'];
$user_cur_email = $row['email'];
}
if($_POST['USER_user_edit'])
{
$rs = $_POST;
$f_name = safe(trim($_POST['f_name']));
$l_name = safe(trim($_POST['l_name']));
$company_name = safe(trim($_POST['user_company'])); //prep add company name
$user_email = safe(trim($_POST['user_email']));//prep add email
$user_phone = safe(trim($_POST['user_phone']));//prep add phone number to database
$user_indus = $_POST['industy_id'];//prep add phone number to database
$user_address_user = safe(trim($_POST['user_address_user']));
$error = "";
if(empty($f_name))
{
$error .= "A First Name is Neeed
";
unset($_POST['USER_user_edit']);
}
if ($valobj->email_validation($user_email) == "0" )
{
$error .= "Incorrect Email format";
unset($_POST['USER_user_edit']);
}
if (empty($user_indus))
{
$error .= "Neeed To Select an Industry ";
unset($_POST['USER_user_edit']);
}
$sql = mysql_query(" SELECT * FROM user WHERE email ='$user_email' ");
while($email_check = mysql_fetch_assoc($sql ))
{
if ($email_check['email'] == $user_cur_email || $email_check['email'] != $user_email ){$email_present = 0; }
else { $email_present = 1;}
}
if ( $email_present == 1 ){
$error .= "