} } return true; } //Form data validation if (isset($_POST['register'])) { $strEmail = ""; $strProfile = ""; $strPassqord = ""; $strConPassword = ""; $strEmail = $_POST["email"]; $strProfile = $_POST["name"]; $strPassword = $_POST["password"]; $strConPassword = $_POST["confirmPassword"]; //$_SESSION["email"] = $strEmail; if (validateProfile($strProfile, "Profile Name") && validatePassword($strPassword, "Password")) { if ($strPassword != $strConPassword) { echo "The password can not match."; } else { //Connect to database server and table include "connection.php"; @mysqli_select_db($conn, "cl56-henningdb") or die("Database not available"); /* $strSql = "INSERT INTO friends (friend_email, password, profile_name, date_started, num_of_friends) values ('$strEmail', '$strPassword', '$strProfile', CURDATE(), 0)"; $Result = mysqli_query($conn, $strSql) or die("Problem reading table"); if($Result){ echo "Register successfully!"; header("location:friendadd.php"); }
header('Location: index.php'); exit; } // Load up the profile in question $stmt = $pdo->prepare('SELECT * FROM Profile WHERE profile_id = :prof AND user_id = :uid'); $stmt->execute(array(':prof' => $_REQUEST['profile_id'], ':uid' => $_SESSION['user_id'])); $profile = $stmt->fetch(PDO::FETCH_ASSOC); if ($profile === false) { $_SESSION['error'] = "Could not load profile"; header('Location: index.php'); exit; } // Handle the incoming data if (isset($_POST['first_name']) && isset($_POST['last_name']) && isset($_POST['email']) && isset($_POST['headline']) && isset($_POST['summary'])) { $msg = validateProfile(); if (is_string($msg)) { $_SESSION['error'] = $msg; header("Location: edit.php?profile_id=" . $_REQUEST["profile_id"]); exit; } // Validate position entries if present $msg = validatePos(); if (is_string($msg)) { $_SESSION['error'] = $msg; header("Location: edit.php?profile_id=" . $_REQUEST["profile_id"]); exit; } $stmt = $pdo->prepare('UPDATE Profile SET first_name=:fn, last_name=:ln, email=:em, headline=:he, summary=:su