Repository navigation
Expand file tree
/
Copy pathreg_user.php
More file actions
75 lines (72 loc) · 2.17 KB
/
Copy pathreg_user.php
File metadata and controls
75 lines (72 loc) · 2.17 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
<?php
$username=$_POST['username'];
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$email=$_POST['email'];
$sex="M";
$mobile=$_POST['mobile'];
$year=$_POST['year'];
$college=$_POST['college'];
$dept=$_POST['dept'];
$pass=$_POST['pass'];
$repass=$_POST['repass'];
$roll=$_POST['roll'];
$con=mysqli_connect("localhost","root","amol","project");
if(!$con)
{die("Connection failed");}
else {
//echo "Connected";
$query="select * from userentry where username='$username'";
$result=mysqli_query($con,$query);
$row=mysqli_fetch_array($result);
$num_rows=mysqli_num_rows($result);
if($num_rows>0) {echo "UserName already Taken. Please choose a new one";exit();}
if($pass!=$repass)
echo "Passwords do not match, Fill Again";
else
if($username=='')
echo "Username is blank, Fill Again";
else
if($pass=='' || $repass=='')
echo "Password missing. Enter again";
else
if($email=='')
echo "E-mail id missing. Enter again";
else
if($first_name=='' || $last_name=='')
echo "Name missing. Enter again";
else
if($college=='')
echo "college missing. Fill again";
else
if($roll=='')
echo "roll missing. Fill again";
else
if($mobile=='')
echo "Mobile missing. Fill again";
else {
$query1="insert into userentry (username,password,first_name,last_name,sex,college,roll,dept,year,mobile) values ('$username',sha1('$pass'),'$first_name','$last_name','$sex','$college','$roll','$dept','$year','$mobile');";
$result=mysqli_query($con,$query1);
if ($result)
echo "Registered Sucessfully.. Please Login to Continue";
else
echo "Fill again";
$re1=mysqli_query($con,"select * from userentry where username='$username'");
$row=mysqli_fetch_array($re1);
$id=$row['id'];
$query2="insert into login(id,username,password,type) values ('$id','$username',sha1('$pass'),'norm');";
$result=mysqli_query($con,$query2);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<a href="index.php">Click Here to Login</a>
</body>
</html>
<?
}
}
?>