@@ -11,43 +11,43 @@ discard block |
||
| 11 | 11 | var_dump($user); |
| 12 | 12 | if(isset($_SESSION['start']) and !$user) |
| 13 | 13 | { |
| 14 | - $login_id=$_SESSION['start']; |
|
| 15 | - $query="SELECT username from login where login_id='$login_id'"; |
|
| 16 | - if($result=$connect->query($query)) |
|
| 17 | - { |
|
| 18 | - if($result->num_rows >0) |
|
| 19 | - { |
|
| 20 | - $row=$result->fetch_assoc(); |
|
| 21 | - $location="http://localhost/openchat/account.php/".$row['username']; |
|
| 22 | - header("Location:".$location); |
|
| 23 | - } |
|
| 24 | - } |
|
| 14 | + $login_id=$_SESSION['start']; |
|
| 15 | + $query="SELECT username from login where login_id='$login_id'"; |
|
| 16 | + if($result=$connect->query($query)) |
|
| 17 | + { |
|
| 18 | + if($result->num_rows >0) |
|
| 19 | + { |
|
| 20 | + $row=$result->fetch_assoc(); |
|
| 21 | + $location="http://localhost/openchat/account.php/".$row['username']; |
|
| 22 | + header("Location:".$location); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | else if($user) |
| 29 | 29 | { |
| 30 | - $query="SELECT * from login where username='$user'"; |
|
| 31 | - if($result=$connect->query($query)) |
|
| 32 | - { |
|
| 33 | - if($result->num_rows >0) |
|
| 34 | - { |
|
| 35 | - $row=$result->fetch_assoc(); |
|
| 36 | - $id=$row['login_id']; |
|
| 37 | - $query="SELECT * from profile where login_id='$id'"; |
|
| 38 | - if($result=$connect->query($query)) |
|
| 39 | - { |
|
| 40 | - if($result->num_rows>0) |
|
| 41 | - { |
|
| 42 | - $r=$result->fetch_assoc(); |
|
| 43 | - $row=array_merge($row,$r); |
|
| 44 | - // var_dump($row); |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - else |
|
| 48 | - { |
|
| 49 | - die("error"); |
|
| 50 | - } |
|
| 30 | + $query="SELECT * from login where username='$user'"; |
|
| 31 | + if($result=$connect->query($query)) |
|
| 32 | + { |
|
| 33 | + if($result->num_rows >0) |
|
| 34 | + { |
|
| 35 | + $row=$result->fetch_assoc(); |
|
| 36 | + $id=$row['login_id']; |
|
| 37 | + $query="SELECT * from profile where login_id='$id'"; |
|
| 38 | + if($result=$connect->query($query)) |
|
| 39 | + { |
|
| 40 | + if($result->num_rows>0) |
|
| 41 | + { |
|
| 42 | + $r=$result->fetch_assoc(); |
|
| 43 | + $row=array_merge($row,$r); |
|
| 44 | + // var_dump($row); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + else |
|
| 48 | + { |
|
| 49 | + die("error"); |
|
| 50 | + } |
|
| 51 | 51 | ?> |
| 52 | 52 | <head> |
| 53 | 53 | <title>OpenChat || Profile</title> |
@@ -63,20 +63,20 @@ discard block |
||
| 63 | 63 | <ul class="nav-right"> |
| 64 | 64 | <li><a href="../index.php">About</a></li> |
| 65 | 65 | <?php if(isset($_SESSION['start'])) |
| 66 | - { |
|
| 67 | - ?> |
|
| 66 | + { |
|
| 67 | + ?> |
|
| 68 | 68 | <li><a href="../message.php">Message</a></li> |
| 69 | 69 | <li><a href="../registration-module/source/class.logout.php">Log out</a></li> |
| 70 | 70 | <?php |
| 71 | - } |
|
| 72 | - else |
|
| 73 | - { |
|
| 74 | - ?> |
|
| 71 | + } |
|
| 72 | + else |
|
| 73 | + { |
|
| 74 | + ?> |
|
| 75 | 75 | <li><a href="../login.php">Login</a></li> |
| 76 | 76 | <li><a href="../register.php">Register</a></li> |
| 77 | 77 | <?php |
| 78 | - } |
|
| 79 | - ?> |
|
| 78 | + } |
|
| 79 | + ?> |
|
| 80 | 80 | </ul> |
| 81 | 81 | </div> |
| 82 | 82 | |
@@ -93,32 +93,32 @@ discard block |
||
| 93 | 93 | <div class="brief"> |
| 94 | 94 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
| 95 | 95 | <?php foreach ($row as $key => $value) { |
| 96 | - if($key=='username' and $value!=null) |
|
| 97 | - echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 98 | - if($key=='email' and $value!=null) |
|
| 99 | - echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 100 | - if($key=='status' and $value!=null) |
|
| 101 | - echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 102 | - if($key=='education' and $value!=null) |
|
| 103 | - echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 104 | - if($key=='gender' and $value!=null) |
|
| 105 | - echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 106 | - } |
|
| 107 | - ?> |
|
| 96 | + if($key=='username' and $value!=null) |
|
| 97 | + echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 98 | + if($key=='email' and $value!=null) |
|
| 99 | + echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 100 | + if($key=='status' and $value!=null) |
|
| 101 | + echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 102 | + if($key=='education' and $value!=null) |
|
| 103 | + echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 104 | + if($key=='gender' and $value!=null) |
|
| 105 | + echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 106 | + } |
|
| 107 | + ?> |
|
| 108 | 108 | </div> |
| 109 | 109 | <?php if($_SESSION['start']==$row['login_id']) |
| 110 | - { |
|
| 111 | - ?> |
|
| 110 | + { |
|
| 111 | + ?> |
|
| 112 | 112 | <div class="edit"><a href="#">Edit Profile</a></div> |
| 113 | 113 | <?php |
| 114 | - } |
|
| 115 | - ?> |
|
| 114 | + } |
|
| 115 | + ?> |
|
| 116 | 116 | </div> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - if($_SESSION['start']==$row['login_id']) |
|
| 120 | - { |
|
| 121 | - ?> |
|
| 119 | + if($_SESSION['start']==$row['login_id']) |
|
| 120 | + { |
|
| 121 | + ?> |
|
| 122 | 122 | |
| 123 | 123 | <div class="boxx" id="profile"> |
| 124 | 124 | <form method="post" action="../profile_generate.php"> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | </form> |
| 134 | 134 | </div> |
| 135 | 135 | <?php |
| 136 | - } |
|
| 137 | - ?> |
|
| 136 | + } |
|
| 137 | + ?> |
|
| 138 | 138 | </div> |
| 139 | 139 | |
| 140 | 140 | |
@@ -153,20 +153,20 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | |
| 155 | 155 | <?php |
| 156 | - } |
|
| 157 | - else |
|
| 158 | - { |
|
| 159 | - die("Invalid User"); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - else |
|
| 163 | - { |
|
| 164 | - die("invalid"); |
|
| 165 | - } |
|
| 156 | + } |
|
| 157 | + else |
|
| 158 | + { |
|
| 159 | + die("Invalid User"); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + else |
|
| 163 | + { |
|
| 164 | + die("invalid"); |
|
| 165 | + } |
|
| 166 | 166 | } |
| 167 | 167 | else |
| 168 | 168 | { |
| 169 | - header("Location:http://localhost/openchat/index.php"); |
|
| 169 | + header("Location:http://localhost/openchat/index.php"); |
|
| 170 | 170 | } |
| 171 | 171 | ?> |
| 172 | 172 | |
@@ -6,41 +6,41 @@ discard block |
||
| 6 | 6 | session_start(); |
| 7 | 7 | include 'database.php'; |
| 8 | 8 | $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
| 9 | -$user=explode("/", $_SERVER['REQUEST_URI']); |
|
| 10 | -$user = $user[count($user)-1]; |
|
| 9 | +$user = explode("/", $_SERVER['REQUEST_URI']); |
|
| 10 | +$user = $user[count($user) - 1]; |
|
| 11 | 11 | var_dump($user); |
| 12 | -if(isset($_SESSION['start']) and !$user) |
|
| 12 | +if (isset($_SESSION['start']) and !$user) |
|
| 13 | 13 | { |
| 14 | - $login_id=$_SESSION['start']; |
|
| 15 | - $query="SELECT username from login where login_id='$login_id'"; |
|
| 16 | - if($result=$connect->query($query)) |
|
| 14 | + $login_id = $_SESSION['start']; |
|
| 15 | + $query = "SELECT username from login where login_id='$login_id'"; |
|
| 16 | + if ($result = $connect->query($query)) |
|
| 17 | 17 | { |
| 18 | - if($result->num_rows >0) |
|
| 18 | + if ($result->num_rows > 0) |
|
| 19 | 19 | { |
| 20 | - $row=$result->fetch_assoc(); |
|
| 21 | - $location="http://localhost/openchat/account.php/".$row['username']; |
|
| 20 | + $row = $result->fetch_assoc(); |
|
| 21 | + $location = "http://localhost/openchat/account.php/".$row['username']; |
|
| 22 | 22 | header("Location:".$location); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | -else if($user) |
|
| 28 | +else if ($user) |
|
| 29 | 29 | { |
| 30 | - $query="SELECT * from login where username='$user'"; |
|
| 31 | - if($result=$connect->query($query)) |
|
| 30 | + $query = "SELECT * from login where username='$user'"; |
|
| 31 | + if ($result = $connect->query($query)) |
|
| 32 | 32 | { |
| 33 | - if($result->num_rows >0) |
|
| 33 | + if ($result->num_rows > 0) |
|
| 34 | 34 | { |
| 35 | - $row=$result->fetch_assoc(); |
|
| 36 | - $id=$row['login_id']; |
|
| 37 | - $query="SELECT * from profile where login_id='$id'"; |
|
| 38 | - if($result=$connect->query($query)) |
|
| 35 | + $row = $result->fetch_assoc(); |
|
| 36 | + $id = $row['login_id']; |
|
| 37 | + $query = "SELECT * from profile where login_id='$id'"; |
|
| 38 | + if ($result = $connect->query($query)) |
|
| 39 | 39 | { |
| 40 | - if($result->num_rows>0) |
|
| 40 | + if ($result->num_rows > 0) |
|
| 41 | 41 | { |
| 42 | - $r=$result->fetch_assoc(); |
|
| 43 | - $row=array_merge($row,$r); |
|
| 42 | + $r = $result->fetch_assoc(); |
|
| 43 | + $row = array_merge($row, $r); |
|
| 44 | 44 | // var_dump($row); |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | <a id="brand" href="">OpenChat</a> |
| 63 | 63 | <ul class="nav-right"> |
| 64 | 64 | <li><a href="../index.php">About</a></li> |
| 65 | - <?php if(isset($_SESSION['start'])) |
|
| 65 | + <?php if (isset($_SESSION['start'])) |
|
| 66 | 66 | { |
| 67 | 67 | ?> |
| 68 | 68 | <li><a href="../message.php">Message</a></li> |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | <div class="brief"> |
| 94 | 94 | <h1 id="name">Name: <?php echo $row['name']; ?></h1><br> |
| 95 | 95 | <?php foreach ($row as $key => $value) { |
| 96 | - if($key=='username' and $value!=null) |
|
| 97 | - echo '<p>Username: '.$row["username"] .'</p><br>'; |
|
| 98 | - if($key=='email' and $value!=null) |
|
| 99 | - echo '<p>Email Id: '.$row["email"] .'</p><br>'; |
|
| 100 | - if($key=='status' and $value!=null) |
|
| 101 | - echo '<p>Status: '.$row["status"] .'</p><br>'; |
|
| 102 | - if($key=='education' and $value!=null) |
|
| 103 | - echo '<p>Education: '.$row["education"] .'</p><br>'; |
|
| 104 | - if($key=='gender' and $value!=null) |
|
| 105 | - echo '<p>Gender: '.$row["gender"] .'</p><br>'; |
|
| 96 | + if ($key == 'username' and $value != null) |
|
| 97 | + echo '<p>Username: '.$row["username"].'</p><br>'; |
|
| 98 | + if ($key == 'email' and $value != null) |
|
| 99 | + echo '<p>Email Id: '.$row["email"].'</p><br>'; |
|
| 100 | + if ($key == 'status' and $value != null) |
|
| 101 | + echo '<p>Status: '.$row["status"].'</p><br>'; |
|
| 102 | + if ($key == 'education' and $value != null) |
|
| 103 | + echo '<p>Education: '.$row["education"].'</p><br>'; |
|
| 104 | + if ($key == 'gender' and $value != null) |
|
| 105 | + echo '<p>Gender: '.$row["gender"].'</p><br>'; |
|
| 106 | 106 | } |
| 107 | 107 | ?> |
| 108 | 108 | </div> |
| 109 | - <?php if($_SESSION['start']==$row['login_id']) |
|
| 109 | + <?php if ($_SESSION['start'] == $row['login_id']) |
|
| 110 | 110 | { |
| 111 | 111 | ?> |
| 112 | 112 | <div class="edit"><a href="#">Edit Profile</a></div> |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | </div> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - if($_SESSION['start']==$row['login_id']) |
|
| 119 | + if ($_SESSION['start'] == $row['login_id']) |
|
| 120 | 120 | { |
| 121 | 121 | ?> |
| 122 | 122 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | <label>Education : </label> |
| 128 | 128 | <input type="text" name="education" id="education" value="<?php echo $row['education']; ?>"></input> |
| 129 | 129 | <label>Gender : </label><br> |
| 130 | - <input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender']=='Male')?'checked':'' ?>> Male<br> |
|
| 131 | - <input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender']=='Female')?'checked':'' ?>> Female<br> |
|
| 130 | + <input type="radio" name="gender" id="gender" value="Male" <?php echo ($row['gender'] == 'Male') ? 'checked' : '' ?>> Male<br> |
|
| 131 | + <input type="radio" name="gender" id="gender" value="Female" <?php echo ($row['gender'] == 'Female') ? 'checked' : '' ?>> Female<br> |
|
| 132 | 132 | <input type="submit" name="submit" value="Done" id="submit"> |
| 133 | 133 | </form> |
| 134 | 134 | </div> |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - // Define database connection constants |
|
| 3 | - define('DB_HOST', 'localhost'); |
|
| 4 | - define('DB_USER', 'root'); |
|
| 5 | - define('DB_PASSWORD',''); |
|
| 6 | - define('DB_NAME', 'openchat'); |
|
| 7 | - define('URL', URL()); |
|
| 2 | + // Define database connection constants |
|
| 3 | + define('DB_HOST', 'localhost'); |
|
| 4 | + define('DB_USER', 'root'); |
|
| 5 | + define('DB_PASSWORD',''); |
|
| 6 | + define('DB_NAME', 'openchat'); |
|
| 7 | + define('URL', URL()); |
|
| 8 | 8 | |
| 9 | - function URL() |
|
| 10 | - { |
|
| 9 | + function URL() |
|
| 10 | + { |
|
| 11 | 11 | $http = "http://"; |
| 12 | 12 | $host = $_SERVER['SERVER_NAME']; |
| 13 | 13 | $port = $_SERVER['SERVER_PORT']; |
@@ -18,5 +18,5 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | $url = $http.$host.":".$port."/".$fol; |
| 20 | 20 | return $url; |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | ?> |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | // Define database connection constants |
| 3 | 3 | define('DB_HOST', 'localhost'); |
| 4 | 4 | define('DB_USER', 'root'); |
| 5 | - define('DB_PASSWORD',''); |
|
| 5 | + define('DB_PASSWORD', ''); |
|
| 6 | 6 | define('DB_NAME', 'openchat'); |
| 7 | 7 | define('URL', URL()); |
| 8 | 8 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $host = $_SERVER['SERVER_NAME']; |
| 13 | 13 | $port = $_SERVER['SERVER_PORT']; |
| 14 | 14 | $fol = ""; |
| 15 | - if(@$_SERVER['SERVER_ADDR']!=NULL) |
|
| 15 | + if (@$_SERVER['SERVER_ADDR'] != NULL) |
|
| 16 | 16 | { |
| 17 | 17 | $fol = explode('/', $_SERVER['PHP_SELF'])[1]; |
| 18 | 18 | } |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - // Define database connection constants |
|
| 3 | - define('DB_HOST', 'localhost'); |
|
| 4 | - define('DB_USER', 'root'); |
|
| 5 | - define('DB_PASSWORD',''); |
|
| 6 | - define('DB_NAME', 'openchat'); |
|
| 7 | - define('URL', URL()); |
|
| 2 | + // Define database connection constants |
|
| 3 | + define('DB_HOST', 'localhost'); |
|
| 4 | + define('DB_USER', 'root'); |
|
| 5 | + define('DB_PASSWORD',''); |
|
| 6 | + define('DB_NAME', 'openchat'); |
|
| 7 | + define('URL', URL()); |
|
| 8 | 8 | |
| 9 | - function URL() |
|
| 10 | - { |
|
| 9 | + function URL() |
|
| 10 | + { |
|
| 11 | 11 | $http = "http://"; |
| 12 | 12 | $host = $_SERVER['SERVER_NAME']; |
| 13 | 13 | $port = $_SERVER['SERVER_PORT']; |
@@ -18,5 +18,5 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | $url = $http.$host.":".$port.$fol; |
| 20 | 20 | return $url; |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | ?> |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | // Define database connection constants |
| 3 | 3 | define('DB_HOST', 'localhost'); |
| 4 | 4 | define('DB_USER', 'root'); |
| 5 | - define('DB_PASSWORD',''); |
|
| 5 | + define('DB_PASSWORD', ''); |
|
| 6 | 6 | define('DB_NAME', 'openchat'); |
| 7 | 7 | define('URL', URL()); |
| 8 | 8 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | $host = $_SERVER['SERVER_NAME']; |
| 13 | 13 | $port = $_SERVER['SERVER_PORT']; |
| 14 | 14 | $fol = ""; |
| 15 | - if(@$_SERVER['SERVER_ADDR']!=NULL) |
|
| 15 | + if (@$_SERVER['SERVER_ADDR'] != NULL) |
|
| 16 | 16 | { |
| 17 | 17 | $fol = "/".explode('/', $_SERVER['PHP_SELF'])[1]; |
| 18 | 18 | } |
@@ -4,93 +4,93 @@ |
||
| 4 | 4 | class login |
| 5 | 5 | { |
| 6 | 6 | |
| 7 | - private $login; |
|
| 8 | - private $password; |
|
| 9 | - private $key; |
|
| 10 | - private $array_error; |
|
| 7 | + private $login; |
|
| 8 | + private $password; |
|
| 9 | + private $key; |
|
| 10 | + private $array_error; |
|
| 11 | 11 | |
| 12 | - function __construct() |
|
| 13 | - { |
|
| 14 | - $_SESSION['password']=''; |
|
| 15 | - $_SESSION['login']=''; |
|
| 16 | - $this->key=0; |
|
| 17 | - $this->array_error=array(); |
|
| 18 | - } |
|
| 12 | + function __construct() |
|
| 13 | + { |
|
| 14 | + $_SESSION['password']=''; |
|
| 15 | + $_SESSION['login']=''; |
|
| 16 | + $this->key=0; |
|
| 17 | + $this->array_error=array(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - function _login($login,$password) |
|
| 21 | - { |
|
| 22 | - $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
|
| 20 | + function _login($login,$password) |
|
| 21 | + { |
|
| 22 | + $connect = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); |
|
| 23 | 23 | |
| 24 | - $this->login=trim($login); |
|
| 25 | - $this->password=trim($password); |
|
| 24 | + $this->login=trim($login); |
|
| 25 | + $this->password=trim($password); |
|
| 26 | 26 | |
| 27 | - if(empty($this->login)) |
|
| 28 | - { |
|
| 29 | - $this->key=1; |
|
| 30 | - $this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]); |
|
| 31 | - } |
|
| 32 | - elseif (preg_match("/^[@]{1}$/",$this->login)) |
|
| 33 | - { |
|
| 34 | - if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false) |
|
| 35 | - { |
|
| 36 | - $this->key=1; |
|
| 37 | - $this->array_error=array_merge($this->array_error,["login"=>"Enter correct Email address"]); |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - if(empty($this->password)) { |
|
| 41 | - $this->key=1; |
|
| 42 | - $this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]); |
|
| 43 | - } |
|
| 44 | - else |
|
| 45 | - { |
|
| 46 | - $pass=md5($this->password); |
|
| 47 | - } |
|
| 27 | + if(empty($this->login)) |
|
| 28 | + { |
|
| 29 | + $this->key=1; |
|
| 30 | + $this->array_error=array_merge($this->array_error,["login"=>"Enter the login field"]); |
|
| 31 | + } |
|
| 32 | + elseif (preg_match("/^[@]{1}$/",$this->login)) |
|
| 33 | + { |
|
| 34 | + if(filter_var($this->email,FILTER_VALIDATE_EMAIL)== false) |
|
| 35 | + { |
|
| 36 | + $this->key=1; |
|
| 37 | + $this->array_error=array_merge($this->array_error,["login"=>"Enter correct Email address"]); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + if(empty($this->password)) { |
|
| 41 | + $this->key=1; |
|
| 42 | + $this->array_error=array_merge($this->array_error,["password"=>"Enter the password"]); |
|
| 43 | + } |
|
| 44 | + else |
|
| 45 | + { |
|
| 46 | + $pass=md5($this->password); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - if($this->key==0) |
|
| 50 | - { |
|
| 51 | - $query="SELECT * FROM login WHERE email='$this->login' or username='$this->login'"; |
|
| 52 | - if ($result=$connect->query($query)) |
|
| 53 | - { |
|
| 54 | - if ($result->num_rows>0) |
|
| 55 | - { |
|
| 56 | - $row=$result->fetch_assoc(); |
|
| 57 | - $login_id=$row['login_id']; |
|
| 58 | - $query="SELECT id FROM register WHERE id='$login_id' and password='$pass'"; |
|
| 59 | - if($result=$connect->query($query)) |
|
| 60 | - { |
|
| 61 | - if ($result->num_rows>0) |
|
| 62 | - { |
|
| 63 | - $query = "Update login set login_status = '1' where login_id = '$login_id'"; |
|
| 64 | - if($result = $connect->query($query)) |
|
| 65 | - { |
|
| 66 | - $time=date("D d M Y H:i:s", time()+12600); // current time |
|
| 67 | - $time_id=date("YmdHis",time()+12600); |
|
| 68 | - // $query = "Update " |
|
| 69 | - $_SESSION['start']=$login_id; |
|
| 70 | - return json_encode(["location"=> URL."/account.php"]); |
|
| 71 | - } |
|
| 49 | + if($this->key==0) |
|
| 50 | + { |
|
| 51 | + $query="SELECT * FROM login WHERE email='$this->login' or username='$this->login'"; |
|
| 52 | + if ($result=$connect->query($query)) |
|
| 53 | + { |
|
| 54 | + if ($result->num_rows>0) |
|
| 55 | + { |
|
| 56 | + $row=$result->fetch_assoc(); |
|
| 57 | + $login_id=$row['login_id']; |
|
| 58 | + $query="SELECT id FROM register WHERE id='$login_id' and password='$pass'"; |
|
| 59 | + if($result=$connect->query($query)) |
|
| 60 | + { |
|
| 61 | + if ($result->num_rows>0) |
|
| 62 | + { |
|
| 63 | + $query = "Update login set login_status = '1' where login_id = '$login_id'"; |
|
| 64 | + if($result = $connect->query($query)) |
|
| 65 | + { |
|
| 66 | + $time=date("D d M Y H:i:s", time()+12600); // current time |
|
| 67 | + $time_id=date("YmdHis",time()+12600); |
|
| 68 | + // $query = "Update " |
|
| 69 | + $_SESSION['start']=$login_id; |
|
| 70 | + return json_encode(["location"=> URL."/account.php"]); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - } |
|
| 74 | - else |
|
| 75 | - { |
|
| 76 | - $this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]); |
|
| 77 | - return json_encode($this->array_error); |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - else |
|
| 82 | - { |
|
| 83 | - $this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]); |
|
| 84 | - return json_encode($this->array_error); |
|
| 85 | - } |
|
| 86 | - } |
|
| 73 | + } |
|
| 74 | + else |
|
| 75 | + { |
|
| 76 | + $this->array_error=array_merge($this->array_error,["password"=>"Invalid password"]); |
|
| 77 | + return json_encode($this->array_error); |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + else |
|
| 82 | + { |
|
| 83 | + $this->array_error=array_merge($this->array_error,["login"=>"Invalid username or email"]); |
|
| 84 | + return json_encode($this->array_error); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - } |
|
| 89 | - else |
|
| 90 | - { |
|
| 91 | - return json_encode($this->array_error); |
|
| 92 | - } |
|
| 93 | - } |
|
| 88 | + } |
|
| 89 | + else |
|
| 90 | + { |
|
| 91 | + return json_encode($this->array_error); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |