-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuser_registation.php
More file actions
123 lines (111 loc) · 3.96 KB
/
Copy pathuser_registation.php
File metadata and controls
123 lines (111 loc) · 3.96 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<header>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.js"></script>
<script>
function MySucessFn(){
swal({
title: "Dear User...Your Registration Sucessfully Complete!",
text: "",
type: "success",
showConfirmButton: true,
},
window.load = function(){
window.location='http://localhost/lawyermanagementsystem/login.php';
});
}
function MyCheckFn(){
swal({
title: "Sorry User!! This Email already exists..Please Fill up the form again",
text: "",
type: "warning",
showConfirmButton: true,
},
window.load = function(){
window.location='http://localhost/lawyermanagementsystem/login.php';
});
}
</script>
</header>
<?php
include_once 'db_con/dbCon.php';
$okFlag = TRUE;
if($okFlag){
if(isset($_FILES["fileToUpload"]["name"]) && $_FILES["fileToUpload"]["name"] != ''){
//echo 123;exit;
$target_dir = "images/upload/";
$newName = date('YmdHis_');
$newName .= basename($_FILES["fileToUpload"]["name"]);
$target_file = $target_dir . $newName;
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
$uploadOk = 1;
} else {
$uploadOk = 0;
}
// Check if file already exists
if (file_exists($target_file)) {
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 5000000) {
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "JPG" &&$imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$checkFlag = FALSE;
// if everything is ok, try to upload file
} else {
if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
} else {
$checkFlag = FALSE;
}
}
//echo $newName;exit;
}else{
$newName = $_POST['image'];
//echo $newName;exit;
}
$u_id = uniqid('Client');
$first_Name = $_REQUEST['first_Name'];
$last_Name = $_REQUEST['last_Name'];
$email = $_REQUEST['email'];
$contact_number = $_REQUEST['contact_number'];
$full_address = $_REQUEST['full_address'];
$city = $_REQUEST['city'];
$zip_code = $_REQUEST['zip_code'];
$password = $_REQUEST['password'];
$conn = connect();
//Check duplicate value
$duplicate=mysqli_query($conn,"select * from user where email='$email'");
if (mysqli_num_rows($duplicate)>0)
{
echo "<script type= 'text/javascript'>MyCheckFn();</script>";
//echo "Duplicate";
}
else
{
// sql query for inserting data into database
$sql = "INSERT INTO `user` (`u_id`,`first_Name`, `last_Name`, `email`, `password`, `status`, `role`) VALUES ('$u_id','$first_Name', '$last_Name', '$email ', '$password ', 'Active', 'User');";
//echo $sql;exit;
$result=mysqli_query($conn, $sql) or die(mysqli_error ($conn));
if($result==1)
{
$sql2= "INSERT INTO `client` (`client_id`, `contact_number`, `full_address`, `city`, `zip_code`, `image`) VALUES ('$u_id', '$contact_number', '$full_address', '$city', '$zip_code ', '$newName ');";
$result2=mysqli_query($conn, $sql2) or die(mysqli_error ($conn));
if ($result2==1)
{
echo "<script type= 'text/javascript'>MySucessFn();</script>";
}
}
}
}
?>