-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-signup.php
77 lines (58 loc) · 1.99 KB
/
page-signup.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
<?php
/*
Template Name: Signup.
*/
?>
<!DOCTYPE html>
<html>
<head>
<title>Add Users</title>
</head>
<body>
</body>
</html>
<?php get_header(); ?>
<?php
if (isset($_POST['login']) && !empty($_POST['username'])
&& !empty($_POST['password'])) {
$servername = "127.0.0.1";
$username_db = "root";
$password_db = "root";
$dbname = "demo_wordpress";
$username = $_POST['username'];
$password = $_POST['password'];
// Create connection
$conn = new mysqli($servername, $username_db, $password_db, $dbname , 8889);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql_create = "CREATE TABLE $username (name varchar(255),email varchar(255));";
$sql = "INSERT INTO meta_users (username,password) VALUES ('$username','$password');";
$conn->query($sql);
$conn->query($sql_create);
echo '<script language="javascript">';
echo 'alert("Signup Complete, Please Login!!")';
echo '</script>';
header("Location: http://localhost:8888/login/");
}
?>
<form id="contactForm" method="post">
<ol class="forms">
<li><label for="username">Username</label>
<input type="text" name="username" id="username" value="" required />
<?php if($nameError != '') { ?>
<span class="error"><?=$nameError;?></span>
<?php } ?>
</li>
<li><label for="password">Password</label>
<input type="password" name="password" id="email" value="" required />
<?php if($emailError != '') { ?>
<span class="error"><?=$emailError;?></span>
<?php } ?>
</li>
<li class="buttons"><input type="hidden" name="login" id="submitted" value="true" /><button type="submit">Sign Up »</button></li>
<!--<li class="buttons"><input type="button" name="submitted" id="submitted" value="Check list of users" onClick=" location='http://localhost:8888/82-2/ '" /></li> -->
</ol>`
</form>
<?php get_footer(); ?>