public function editProfile($users) { $fname = $users->getFullname(); $uname = $users->getUsername(); $email = $users->getEmail(); $phone = $users->getPhone(); $processaccount = new Processaccount(); $msg_register = $processaccount->checkUsername($users); if ($msg_register == 0) { if (mysql_query("UPDATE user SET fullname='" . $fname . "', username='******', email='" . $email . "', phone='" . $phone . "' WHERE id='" . $_SESSION['user'] . "'")) { header("Location: ../view/account.php"); } else { return $msg_register = 2; } } else { return $msg_register; } }
<?php include '../include/adminheader.php'; include_once '../model/dbconnect.php'; include '../model/processaccount.php'; include '../model/seller.php'; $msg_register = 0; if (isset($_POST['btn-edit'])) { $users = new User(); $seller = new Seller(); $processaccount = new Processaccount(); $users->setFullname(mysql_real_escape_string($_POST['fname'])); $users->setUsername(mysql_real_escape_string($_POST['uname'])); $users->setEmail(mysql_real_escape_string($_POST['email'])); $users->setPhone(mysql_real_escape_string($_POST['phone'])); $seller->setCompany(mysql_real_escape_string($_POST['company'])); $seller->setAddress(mysql_real_escape_string($_POST['address'])); $seller->setCity(mysql_real_escape_string($_POST['city'])); $seller->setPostalcode(mysql_real_escape_string($_POST['postalcode'])); $seller->setDescription(mysql_real_escape_string($_POST['description'])); $objs = array(); $objs[] = $users; $objs[] = $seller; $msg_register = $processaccount->editAdminProfile($objs); if ($msg_register == 0) { header("Location: adminaccount.php"); } } ?>
<?php } } } ?> <a href="account.php"><button type="submit" class="btn btn-default" name="btn-signup">Back</button></a> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-8"> <div class="signup-form"><!--sign up form--> <h2>Edit Your Account!</h2> <form action="editaccount.php" method="post" onsubmit="return isEditFormValid();"> <?php //$res=mysql_query("SELECT * FROM user WHERE id='".$user."'"); // $u2=new User(); $processaccount = new Processaccount(); $u2 = $processaccount->getUser(); if (isset($u2)) { ?> <table class="account"> <tr> <td>Name : </td><td><b><input type="text" placeholder="Full Name" value="<?php echo $u2->getFullname(); ?> " name="fname" id="fullname"/></b></td> </tr> <tr> <td>User Name : </td><td><b><input type="text" placeholder="User Name" value="<?php echo $u2->getUsername(); ?> " name="uname" id="username"/></b></td>
<?php include '../include/adminheader.php'; include_once '../model/dbconnect.php'; include '../model/processaccount.php'; $msg_register = 0; if (isset($_POST['btn-signup'])) { $processaccount = new Processaccount(); $users = new User(); $users->setPassword(md5(mysql_real_escape_string($_POST['oldpass']))); $users->setConfirm(md5(mysql_real_escape_string($_POST['pass']))); $users->setNewpass(md5(mysql_real_escape_string($_POST['confirm']))); $msg_register = $processaccount->changePassword($users); if ($msg_register == 0) { header("Location: adminaccount.php"); } } ?> <section id="form" style="margin-top: 0px"><!--form--> <div class="container"> <div class="breadcrumbs"> <ol class="breadcrumb"> <li><a href="#">Home</a></li> <li class="active">My Account</li> </ol> </div> <label class="error-label col-xs-12" id="error"></label> <?php if ($msg_register == 1) {
<strong>Oh Snap!</strong> User cannot be registered. </div> <?php } else { } } } ?> <div class="row"> <div class="col-sm-2"></div> <div class="col-sm-4"> <div class="signup-form"><!--sign up form--> <h2>My Profile</h2> <?php $processaccount = new Processaccount(); $user = $processaccount->getUser(); if (isset($user)) { ?> <table class="account"> <tr> <td>Name : </td><td><b><?php echo $user->getFullname(); ?> </b></td> </tr> <tr> <td>User Name : </td><td><b><?php echo $user->getUsername(); ?> </b></td>