// remove blank spaces $email = $_POST['email']; $email = strip_tags($email); // plain text only $email = str_replace(' ', '', $email); // remove blank spaces $password = $_POST['password']; $password = strip_tags($password); $password2 = $_POST['password2']; $password2 = strip_tags($password2); if ($password != $password2) { echo "<script type='text/javascript'>\n\t\tjError('You did not re-enter the same password.<br />Please try registering again!',\n\t\t\t{\n\t\t\t\tonClosed:function()\n\t\t\t\t{\n\t\t\t\t\twindow.location.href='" . $root . "/index.php'\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t</script>"; exit; } //$key = null; prep_qrys($conn); // Check if username exists in database $result = pg_execute($conn, "check_username", array($username)) or die("Can't execute check_username: "******"check_email", array($email)) or die("Can't execute check_email: " . pg_last_error()); $email_exists = pg_num_rows($result); pg_freeresult($result); if ($username_exists) { echo "<script type='text/javascript'>\n\t\tjError('This username is already taken...<br />Please choose another one!',\n\t\t\t{\n\t\t\t\tonClosed:function()\n\t\t\t\t{\n\t\t\t\t\twindow.location.href='" . $root . "/index.php'\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t</script>"; exit; } else { if ($email_exists) { echo "<script type='text/javascript'>\n\t\tjError('This mail has already been registered...<br />Please subscribe using another mail,<br />or log in using your existing username!',\n\t\t\t{\n\t\t\t\tonClosed:function()\n\t\t\t\t{\n\t\t\t\t\twindow.location.href='" . $root . "/index.php'\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\t</script>"; exit;
function user_session($time, $cookie) { require_once realpath($_SERVER["DOCUMENT_ROOT"]) . "/venues/session.php"; // prepare statements prep_qrys($conn); $uid = check_login($conn, 600, $cookie); return $uid; }