include "validation.php"; if (isset($_POST['submit'])) { //Timming //$username = trim($_POST['user']); //$img = trim($_POST['img']); $fname = trim($_POST['fname']); $sname = trim($_POST['sname']); $email = trim($_POST['email']); $phone = trim($_POST['phone']); $uni = trim($_POST['uni']); $camp = trim($_POST['camp']); $opass = trim($_POST['opass']); $npass = trim($_POST['npass']); $cpass = trim($_POST['cpass']); $userid = activeUser(); $errors = validateUserDetails($fname, $sname, $email, $phone, $uni, $camp, $userid); echo "33"; if ($errors == false) { echo "t"; $query = $dbconn->prepare("UPDATE `user-details` SET `Firstname`=:fname, `Surname`=:sname,\r\n\t\t\t`Email`=:email, `PhoneNumber`=:phone, `UniId`=:uni, `CampusId`=:camp WHERE \r\n\t\t\t`UserId`=:userid"); $query->bindParam(":fname", $fname); $query->bindParam(":sname", $sname); $query->bindParam(":email", $email); $query->bindParam(":phone", $phone); $query->bindParam(":uni", $uni); $query->bindParam(":camp", $camp); $query->bindParam(":uni", $uni); $query->bindParam(":userid", $userid); $result = $query->execute(); if ($result) { setNotice("Your account has been succesfully updated!", "alert alert-success");
include 'database/connect.php'; include_once "functions/validation.php"; //trimming if (isset($_POST['submit'])) { $uname = trim($_POST['user']); $email = trim($_POST['email']); $upass = trim($_POST['pass']); $ucpass = trim($_POST['cpass']); $uni = trim($_POST['uni']); $camp = trim($_POST['campus']); print_r($_POST); //check Data for entry $UserErrors = validateUser($uname, $upass, $ucpass); print_r($UserErrors); echo "string"; $DetailErrors = validateUserDetails('', '', $email); //echo($DetailErrors); if ($UserErrors == false && $DetailErrors == false) { try { //encrypt password $upass = password_hash($upass, PASSWORD_DEFAULT); //Sql Query $dbconn->beginTransaction(); $sql = "INSERT INTO `users` (`Username`, `Password`, `Active`) VALUES (:uname, :upass, 0)"; $query = $dbconn->prepare($sql); $query->bindParam(':uname', $uname); $query->bindParam(':upass', $upass); $result = $query->execute(); if ($result) { $userid = $dbconn->LastInsertId(); echo $userid;