-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersonclass.php
116 lines (67 loc) · 1.79 KB
/
personclass.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
class person
{
protected $username ;
protected $password ;
protected $email ;
protected $name ;
private $cxn ;
public function __construct($username1,$password1,$email)
{
$this->setData($username1 , $password1, $email) ;
$this->connecttodb();
//$this->getDate();
}
private function setData($username , $password , $email)
{
$this->username=$username ;
$this->password=$password ;
$this->email=$email ;
}
private function connecttodb()
{
require_once 'database.php';
$vars = "admin/db.php" ;
$this->cxn = new Database($vars);
}
public function login()
{
$query = " SELECT * from login where usname = '$this->username' and pass = '$this->password' and type =2";
$result = mysql_query($query) ;
if(mysql_num_rows($result) > 0 )
{
return true ;
}
else
echo "<script type='text/javascript'>
alert('username or password invalid ');
</script> ";
}
public function signup()
{
$select_user_SQL="SELECT * FROM `login` where usname ='$this->username' or email='$this->email' and type=2 ";
$select_user_Result= mysql_query($select_user_SQL);
if(mysql_num_rows($select_user_Result)==1){
echo "<script type='text/javascript'>
alert('username is Exist in system');
</script> ";
return false ;
}
else {
$insert_user_sql="INSERT INTO login (usname,pass,type,email)
VALUES ('$this->username','$this->password',2,'$this->email')";
$inser_user_result= mysql_query($insert_user_sql);
if($inser_user_result){
return true ;
}else
{
return false ;
}
}
function close()
{
$this->cxn->close();
}
}
}
?>