Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static function exists($username, $password)
- {
- $connection = new mysqli('localhost','root','','tema3');
- $query = 'SELECT * from users';
- $result = $connection->query($query);
- $ok = 0;
- if ($result)
- {
- while ($row = $result->fetch_assoc() )
- {
- //echo "gigi";
- //sprint_r($row);
- if ($row['password'] == md5($password) && $row['username'] == $username)
- {
- $ok = 1;
- break;
- }
- }
- }
- //echo $ok;
- if ($ok == 1)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public function actionIsset ()
- {
- if (!isset($_POST))
- {
- return false;
- }
- $user = $_POST["username"];
- $pass = $_POST["password"];
- if (empty($user) || empty($pass))
- {
- return false;
- }
- return ($this->exists($user, $pass));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement