-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration.php
48 lines (43 loc) · 1.01 KB
/
registration.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
<?php
// change the name below for the folder you want
$dir = filter_input(INPUT_GET, 'studentid');
//echo $dir;
$name=filter_input(INPUT_GET, 'txtusername');
//echo $name;
$pass=filter_input(INPUT_GET, 'txtpassword');
//echo $pass;
$username = "root";
$password = "";
$hostname = "localhost";
$db="proj";
//connection to the database
$dbhandle = mysqli_connect($hostname, $username, $password,$db)
or die("Unable to connect to MySQL");
//echo "Connected to MySQL<br>";
if($dir<=4515)
{
$bid='A';
}
elseif ($dir<=4530) {
$bid='B';
}elseif ($dir<=4545) {
$bid='C';
}elseif ($dir<=4560) {
$bid='D';
} else {
$bid='E';
}
$path='project_folders/'.$dir;
if( is_dir($path) === false )
{
mkdir($path);
mysqli_query($dbhandle, "insert into student values('$dir','$name','$pass','$bid')");
//echo("Here");
mysqli_close($dbhandle);
header('Location:index.php');
}
else {
$Message="Registration ID already exists!";
header("Location: Register.php?Message=" . urlencode($Message));
}
?>