-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertuser.php
68 lines (55 loc) · 1.56 KB
/
insertuser.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
<?php
require_once("dummy.php");
$conn = mysqli_connect('localhost','root','','admindb');
if (isset($_POST['signup'])) {
$email = $_POST['email'];
$password = $_POST['password'];
}
$query="SELECT * FROM USERSRC WHERE EMAIL='$email'";
$data=mysqli_query($conn,$query);
$num=mysqli_num_rows($data);
$uppercase = preg_match('@[A-Z]@', $password);
$lowercase = preg_match('@[a-z]@', $password);
$number = preg_match('@[0-9]@', $password);
// $exp = preg_match("/^[A-Z][a-zA-z0-9]*[0-9]+/", $password);
if($num == 1){
echo "<script>
swal({
title: 'Email already exist!',
text: 'Do register using other email ID',
type: 'error'
},
function(){
window.location.href = 'userlogin.php';
});
</script>";
}else{
if(!$uppercase || !$lowercase || !$number || strlen($password) < 8) {
echo "<script>
swal({
title: 'Weak Password!',
text: 'The password must contain at least 1 number, at least one uppercase character, at least one lowercase character and length must be minimum of 8 characters',
type: 'error'
},
function(){
window.location.href = 'userlogin.php';
});
</script>";
}
else{
$hashpassword = md5($password);
$query1="insert into usersrc(email,password) values('$email','$hashpassword')";
$data1=mysqli_query($conn,$query1);
echo "<script>
swal({
title: 'successful!',
text: 'Welcome User',
type: 'success'
},
function(){
window.location.href = 'plans.php?email=".$email."';
});
</script>";
}
}
?>