-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·95 lines (93 loc) · 3.52 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<html><head>
<link rel="stylesheet" style="text/css" href="style.css">
<script src="events.js"></script>
<script src="dynamics.js"></script>
<title>welcome to password game</title></head>
<body onload="centerform()" onresize="centerform()">
<?php
$INC_DIR = $_SERVER["DOCUMENT_ROOT"]. "/passwordgame/";
// REDO ALL OF THIS WITH SESSION DATA
if (isset($_POST['profilepic'])) {$profilepic = $_POST['profilepic'];}
if (isset($_POST['displayname'])) {$displayname = $_POST['displayname'];}
if (isset($_POST['userid'])) {
$userid = $_POST['userid'];
echo '<div id="useridhidden" style="display:none;">'.$userid.'</div>';
}
if (isset($_POST['whatever'])) {$pw = $_POST['whatever'];}
include($INC_DIR. "connect.php");
$db = connectdb('passgame');
?>
<div id="mainform">
<form action="index.php" id="formitself" method="post">
<?php
if (!(isset($_POST['profilepic']))) {
include($INC_DIR. "updatepic.php");
include($INC_DIR. "displayname.php");
if (!(isset($_POST['displayname']))) {
if (!(isset($_POST['whatever']))) {
echo '<div id="message">enter the password:</div>
<br>
<input type="text" id="inputfield" name="whatever" onkeypress="return numbersonly(event,\'formitself\')" onkeyup="return limitlength(this, 15)">'; }
else {
include($INC_DIR. "getid.php");
$userid = getid($db,$pw);
if (!($userid)) { // IF NO ROWS EXIST CREATE NEW ACCOUNT
include($INC_DIR. "newaccount.php"); }
else {
$displayname = getdisplayname($db, $userid);
if (!($displayname)) {
echo '<br><div id="message">You\'re in!<br>please chose permanent display name:</div><input type="text" id="inputfield" name="displayname" onkeypress="return numbersonly(event,\'formitself\')" onkeyup="return limitlength(this, 139)">'; }
else {
if ($profilepic = updatepic("get", $db, $userid)) {
echo '<br><img src="' . $profilepic . '" id="profilepicture">';
echo '<input type="hidden" name="profilepic" value="' . $profilepic . '">';
$_POST['profilepic'] = $profilepic;
}
echo '<br><h1>' . $displayname . '</h1>';
displayupdatepic($displayname);
}
mysqli_close($db); }
echo '<input type="hidden" name="whatever" value="' . $pw . '">';
echo '<input type="hidden" name="userid" value="' . $userid . '">';
}
}
else {
createdisplayname($db, $userid, $displayname);
displayupdatepic($displayname);
echo '<input type="hidden" name="whatever" value="' . $pw . '">';
echo '<input type="hidden" name="userid" value="' . $userid . '">';
}
}
else {
include($INC_DIR. "updatepic.php");
$result = updatepic($profilepic, $db, $userid);
echo '<br><img src="' . $profilepic . '" id="profilepicture"><h1>' . $displayname . '</h1>';
displayupdatepic($displayname);
echo '<input type="hidden" name="profilepic" value="' . $profilepic . '">';
echo '<input type="hidden" name="whatever" value="' . $pw . '">';
echo '<input type="hidden" name="userid" value="' . $userid . '">';
}
?>
<input class="button" type="submit" id="formsubmit">
</form>
<?php
if (isset($_POST['profilepic'])) {
echo '<a href="javascript:hidebox();" class="button" id="closebox" onclick="hidebox()">X</a>'; }
if (isset($_POST['whatever'])) {
echo '[<a href="index.php">logout</a>]';}
?>
</div>
<?php
if (isset($_POST['profilepic'])) {
include($INC_DIR. "buildprofile.php");
buildprofile($profilepic, $displayname, $userid);
echo "
<script type='text/javascript'>
document.getElementById('mainform').style.display = 'none';
</script>
";
}
?>
<span id="fiftyfiftyfeed"></span>
</body>
</html>