-
Notifications
You must be signed in to change notification settings - Fork 53
/
regprocess.php
38 lines (37 loc) · 948 Bytes
/
regprocess.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
<?php
include($_SERVER['DOCUMENT_ROOT'].'/btslab/mysqlconnection.php');
$username=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];
$About=$_POST['About'];
$em="";
$e=0;
if($username=='' || $password == '' || $email=='')
{
$em="Please Fill all fields";
$e=1;
}
if(strlen($username) < 3)
{
$em=$em."<br/>"."Your Name must be more than 4 characters";
$e=1;
header('Location: register.php?em='.$em);
}
$result=mysql_query("select * from users where username='$username'") or die(mysql_error());
if(mysql_num_rows($result)>0)
{
$e=1;
$em=$em."<br/>"."Username is already taken";
}
if($e==1)
{
header('Location: register.php?em='.$em);
}
else
{
$query="INSERT into users(username, password, email, About,avatar,privilege) values ('$username','$password','$email','$About','default.jpg','user')";
mysql_query($query) or die(mysql_error());
mysql_close();
header('Location: login.php');
}
?>