-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakepage.php
More file actions
72 lines (72 loc) · 2.11 KB
/
makepage.php
File metadata and controls
72 lines (72 loc) · 2.11 KB
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
<?php
$connect = mysql_connect('localhost', 'root', 'bitnami');
if (!$connect){
echo('cannot connect<br />');
}
else if ($connect){
echo('connected<br />');
}
else{
echo ('error');
}
mysql_select_db("socialnetwork");
if(!empty($_POST["pagename"])){
echo('form filled<br />');
$name = mysql_real_escape_string($_POST["pagename"]);
$church = mysql_real_escape_string($_POST["church"]);
if(1>0||!empty($_POST["streetaddress"])&&!empty($_POST["state"])&&!empty($_POST["zipcode"])){
$streetaddress = $_POST["streetaddress"];
$city = mysql_real_escape_string($_POST["city"]);
$state = mysql_real_escape_string($_POST["state"]);
$zipcode = mysql_real_escape_string($_POST["zipcode"]);
echo('post data collected<br />');
}
else{
$city="";
$streetaddress="";
$state="";
$zipcode="";
}
echo('sql precheck good<br />');
$sqlcheck = "SELECT * FROM pages WHERE name = '$name'";
$result = mysql_query($sqlcheck);
echo('sql postcheck good<br />');
if (mysql_num_rows($result) == 0) {
$sql = "INSERT INTO `pages`(`id`, `name`, `church`, `address`, `city`, `state`, `zipcode`)
VALUES ('','$name','$church','$streetaddress','$city','$state','$zipcode')";
mysql_query($sql);
$idsql="SELECT * FROM pages WHERE name = '$name'";
$idresult=mysql_query($idsql);
$idarray=mysql_fetch_array($idresult);
$id=$idarray["id"];
echo('success');
$redirect = 'page.php?id=' . $id;
header('Location: ' . $redirect);
}
else if (mysql_num_rows($result) > 0) {
echo ('<script type="text/javascript">alert("A page has already been registered under this name");</script>');
// header("Location: login.html"); mk password reset
}
else {
echo ('<script type="text/javascript">alert("<p style=\"font-size:50px;color:white;\"><b>Uh-oh! Something is wrong!</b></p>");</script>');
}
}
else{
//form unfilled (javascript disabled)
echo('form has blank fields');
}
?>
<html>
<head>
<script type="text/javascript">
function f1() {
window.location.assign('newusergreet.php');
};
function f2(){
window.setTimeout(f1, 2700)
};
</script>
</head>
<body onload="" style="font-family:arial;background-color:black;">
</body>
</html>