-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.php
31 lines (30 loc) · 1.32 KB
/
signup.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
<?php
require_once 'filehead.php'; //include filehead file
session_destroy();
include 'helper/Validation.php'; // include helper
$smarty->assign('CSS_URL', CSS_URL);
$smarty->display('header.tpl'); //including header
if (isset($_POST['submit']))
{
if(($valid1->IsValidateemail($_POST['email'])) && ($_POST['username']!=NULL) && ($_POST['password']!=NULL) && ($_POST['contact']!=NULL) && ($_POST['req']!=NULL))
{
//if valid and complete
$login=new login() ;
$login-> add($_POST['username'] , $_POST['password'],2); //adding data to login table
$users=new users();
$users->add($_POST['username'],$_POST['name'],$_POST['contact'],$_POST['req']); //addding data to users table
session_start(); //starting and setting session
$_SESSION['userid']=$login->getId($_POST['username']);
$_SESSION['username']=$_POST['username'];
$_SESSION['type']=2;
$date=date("d-m-y h:i:sa");
$_SESSION['last_login']=strtotime($date);
$login->update('last_login',$_SESSION['last_login'],$_SESSION['userid']);
header('Location:'.URL.'userhp.php'); //relocating to users homepage
} else {
echo "FILL COMPLETE INFO PLEASE";
}
}
$smarty->display('signup.tpl'); //including signup page
$smarty->display('footer.tpl'); //including footers
?>