-
Notifications
You must be signed in to change notification settings - Fork 11
/
orglogin.php
88 lines (63 loc) · 2.6 KB
/
orglogin.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
<html>
<head>
<title>Login PopUp</title>
<link rel="stylesheet" type="text/css" href="css2/login.css">
</head>
<body>
<div class="wrapper">
<div class="container">
<br><br>
<div class="signup"><hr>Organizations Sign Up<hr></div>
<form action="orglogin.php" method="post">
<div class="signup-form" >
<input type="text" placeholder="Your Username" name="name" class="input" required><br />
<input type="text" placeholder="Phone Number" name="number" class="input" required><br />
<input type="text" placeholder="Organization Address" name="address" class="input" required><br />
<input type="text" placeholder="City" name="city" class="input" required><br />
<input type="text" placeholder="Your Email Address" name="email" class="input" required><br />
<input type="password" placeholder="Create Password" name="password" class="input" required><br />
<input type="submit" class="btn" name="submit" value="Create account"/><br>
<h2><a href="login.php" class="alreadyid">Already Have Id? Login Here</a></h2><br>
</div>
</form>
</div>
</div>
</body>
</html>
<?php
include('dbcon.php');
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$pass = $_POST['password'];
$address = $_POST['address'];
$number = $_POST['number'];
$city = $_POST['city'];
$qrysearch = "SELECT * FROM `organization` WHERE `email` = '$email' ";
$run = mysqli_query($con,$qrysearch);
if(mysqli_num_rows($run)>0){
?>
<script>
alert('Id already exist! Try Logging In:)');
window.location.href = "orglogin.php";
</script>
<?php
}
else{
$qry = "INSERT INTO `organization`(`name`, `email`, `password`,`city`,`address`,`number`) VALUES ('$name','$email','$pass','$city','$address','$number')";
$runqry = mysqli_query($con,$qry);
if($runqry == true){
?>
<script>
alert('Your Id has been successfully created. Login to continue');
windows.location.href = "http://localhost/osp/orglogin.php";
</script>
<?php
}
else{
echo(mysqli_error($con));
}
}
// header('location:login.php');
}
?>