forked from Bhanu-183/AdviceByte
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclientreg.php
More file actions
49 lines (49 loc) · 1.46 KB
/
clientreg.php
File metadata and controls
49 lines (49 loc) · 1.46 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
<?php
$servername = "sql109.epizy.com";
$username = "epiz_28239248";
$password = "42cBG9MYx3";
$conn = new mysqli($servername, $username, $password, "epiz_28239248_AdviceByte");
if ($conn->connect_error) {
echo '<script>alert("Connection failed")</script>';
die("Connection failed: " . $conn->connect_error);
}
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$u=$fname.' '.$lname;
$f=$_POST['fld'];
$mail = htmlspecialchars(stripslashes(trim($_POST['mailid'])));
$p=htmlspecialchars(stripslashes(trim($_POST['password'])));
$rp=htmlspecialchars(stripslashes(trim($_POST['repassword'])));
if($p!=$rp)
{
echo '<script>alert("confirm password and password should be same")</script>';
header("Refresh:0; url=clientlogin.php");
}
else
{
$q = "SELECT * FROM client WHERE mail='" . $mail . "' ";
$res = $conn->query($q);
if ($res->num_rows > 0)
{
echo '<script>alert("MAIL ID ALREADY EXIST TRY ANOTHER")</script>';
header("Refresh:0; url=clientlogin.php");
}
else
{
if(!empty($u) || !empty($p) || !empty($mail) || !empty($f))
{
$insert="insert into client(Name,password,mail,field) values('$u','$p','$mail','$f')";
if($conn->query($insert)==TRUE)
{
session_start();
$_SESSION['mail'] = $mail;
header('Location:./clientmain.php');
}
else
{
echo '<script>alert(Error: " . $sql . "<br>" . $con->error)</script>';
}
}
}
}
?>