forked from T4SG/Bangalore-Team-8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
registrationhandler.php
95 lines (77 loc) · 2.43 KB
/
registrationhandler.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
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
<?php
echo"Hi";
session_start(); // Starting Session
$error=''; // Variable To Store Error Message
if (isset($_POST['submit'])) {
if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['password1']) || empty($_POST['password2'])) {
$error = "Some fields are empty";
//if(empty($_FILES["uploadedimage"]["name"]))
//{
// $error = "hello image is empty";
//}
}
else
{
// Define $username and $password
$name=$_POST['name'];
$email=$_POST['email'];
$password1=$_POST['password1'];
$password2=$_POST['password2'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$connection = mysql_connect("http://ec2-52-69-232-19.ap-northeast-1.compute.amazonaws.com/", "root", "code4good");
// To protect MySQL injection for Security purpose
$name = stripslashes($name);
$email= stripslashes($email);
$password1 = stripslashes($password1);
$password2 = stripslashes($password2); // don't actually need this
$name = mysql_real_escape_string($name);
$email= mysql_real_escape_string($email);
$password1 =mysql_real_escape_string($password1);
$password2 =mysql_real_escape_string($password2);// don't actually need this
$db = mysql_select_db("mysql", $connection);
/* $sql=mysql_query("SELECT from registration where email='$email'",$connection);
if($row!=1)
{
echo $row;
function GetImageExtension($imagetype)
{
if(empty($imagetype)) return false;
switch($imagetype)
{
case 'image/bmp': return '.bmp';
case 'image/gif': return '.gif';
case 'image/jpeg': return '.jpg';
case 'image/png': return '.png';
default: return false;
}
}
if (!empty($_FILES["uploadedimage"]["name"])) {
$file_name=$_FILES["uploadedimage"]["name"];
$temp_name=$_FILES["uploadedimage"]["tmp_name"];
$imgtype=$_FILES["uploadedimage"]["type"];
$ext= GetImageExtension($imgtype);
$imagename=date("d-m-Y")."-".time().$ext;
$target_path = "images/".$imagename;
if(move_uploaded_file($temp_name, $target_path)) {
*/
mysql_query("INSERT into registration(name,email,password) VALUES ('$name','$email','$password1')",$connection);
echo "Hi";
ob_start();
//echo '<META HTTP-EQUIV="Refresh" Content="0; URL=login.php">';
ob_end_flush();
echo "hello";
}/*else{
exit("Error While uploading image on the server");
}
}
*/
// Selecting Database
mysql_close($connection); // Closing Connection
}
else
{
echo "email id already exists.Please provide another emailid";
}
}
}
?>