-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateacct.php
53 lines (41 loc) · 1.29 KB
/
createacct.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
include_once("classes.php");
include_once("userauth.php"); //I wanted to redirect to userauth.php instead, still figuring this out...
session_start();
function addUser($user, $pxwd, $email){
$db = new Database();
if (!$db->queryTrueFalse("select userExists('$user')")){
// If username does not exist
if ($db->queryTrueFalse("select insertUser('$user', '$pxwd', '$email')")){
// Add user information to database
// Log the user in
login($user, $pxwd, $db);
$_SESSION["completedPref"] = FALSE;
header("Location: games.php");
//header("Location: question.php?game=General&console=General");
}
}
else{
//Complain
header("Location: index.php?err=2");
}
}
//=============================================================
if (isset($_SESSION["user"])){
header("Location: players.php");
}
else{
// $pxwd = crypt($_POST["pxwd"]);
if( isset($_POST['user']) && trim($_POST['user']) && isset($_POST['pxwd']) && trim($_POST['pxwd']) && isset($_POST['email']) && trim($_POST['email'])){
$user = pg_escape_string(trim($_POST['user']));
$pxwd = pg_escape_string(trim($_POST['pxwd']));
$email = pg_escape_string(trim($_POST['email']));
addUser($user, $pxwd, $email);
}
else{
// Complain
header("Location: index.php?err=3");
}
// addUser($argv[1], $argv[2]);
}
?>