/
newsignup.php
32 lines (29 loc) · 1.11 KB
/
newsignup.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
<?php
//checks if username exists, else creates account
include("config.php");
$myusername=$_POST['username'];
$mypassword=$_POST['password'];
$zip=$_POST['zipcode'];
$email=$_POST['email'];
$birthday=$_POST['birthday'];
$city=$_POST['city'];
$country=$_POST['country'];
$registrationdate=date("Y-m-d");
$sql="SELECT id_customer FROM customer WHERE username='$myusername' ";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row['active'];
$count=mysql_num_rows($result);
if($count==0)
{
$sql="SELECT max(id_customer) FROM customer";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$idfetch=$row[0]+1;
$sql="INSERT INTO customer values($idfetch, '$myusername','$zip','$birthday','$city', '$mypassword','$country','$registrationdate','$email')";
$result=mysql_query($sql);
echo "<script type='text/javascript'>window.location = 'signup.php?flag=1'</script>";
}
else
echo "<script type='text/javascript'>window.location = 'signup.php?flag=2'</script>";
?>