PHP User::does_user_exist Examples

PHP User::does_user_exist - 11 examples found. These are the top rated real world PHP examples of User::does_user_exist extracted from open source projects. You can rate examples to help us improve the quality of examples.
class User
{
    private $db;
    private $connection;
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($email, $job_id)
    {
        $query1 = "Select user_id from users where email = '{$email}'";
        $result1 = mysqli_query($this->connection, $query1);
        $row = mysqli_fetch_assoc($result1);
        $userid = $row['user_id'];
        $query = "Insert into savedjobs (user_id,job_id) values ('{$userid}','{$job_id}')";
        $result = mysqli_query($this->connection, $query);
        if ($result == 1) {
            $json['success'] = 'Saved job Successfully';
        } else {
            $json['error'] = 'Failed to Save job';
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
$job_id = $_GET['job_id'];
$email = $_GET['email'];
$user->does_user_exist($email, $job_id);
<?php

include_once 'connection.php';
class User
{
    private $db;
    private $connection;
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($email)
    {
        $query = "select * from jobs where user_id = (SELECT user_id from users where email='{$email}')";
        $result = mysqli_query($this->connection, $query);
        $json = array();
        if (mysqli_num_rows($result)) {
            while ($row = mysqli_fetch_assoc($result)) {
                $json['postedjobs'][] = $row;
            }
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
$email = $_GET['email'];
$user->does_user_exist($email);
    private $db;
    private $connection;
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($email, $jobname, $jobpay, $jobdesc)
    {
        $query1 = "Select user_id from users where email = '{$email}'";
        $result1 = mysqli_query($this->connection, $query1);
        $row = mysqli_fetch_assoc($result1);
        $userid = $row['user_id'];
        $query = "Insert into jobs (job_id,job_name,job_description,job_type,pay,user_id,job_posted_date) values ('','{$jobname}','{$jobdesc}','Studentopportunity','{$jobpay}','{$userid}',CURRENT_TIMESTAMP)";
        $result = mysqli_query($this->connection, $query);
        if ($result == 1) {
            $json['success'] = 'Job Posted Successfully';
        } else {
            $json['error'] = 'Failed to post job';
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
$email = $_POST['email'];
$jobname = $_POST['jobname'];
$jobpay = $_POST['jobpay'];
$jobdesc = $_POST['jobdesc'];
$user->does_user_exist($email, $jobname, $jobpay, $jobdesc);
<?php

include_once 'connection.php';
class User
{
    private $db;
    private $connection;
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($jobname)
    {
        $query = "select * from jobs where job_name like '%" . $jobname . "%'";
        $result = mysqli_query($this->connection, $query);
        $json = array();
        if (mysqli_num_rows($result)) {
            while ($row = mysqli_fetch_assoc($result)) {
                $json['job_search'][] = $row;
            }
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
if (isset($_GET['keyword'])) {
    $jobname = $_GET['keyword'];
    $user->does_user_exist($jobname);
}
    {
        $query = "Select * from users where email='{$email}' and password = '{$password}' ";
        $result = mysqli_query($this->connection, $query);
        if (mysqli_num_rows($result) > 0) {
            $json['success'] = ' Welcome ' . $email;
            echo json_encode($json);
            mysqli_close($this->connection);
        } else {
            $query = "insert into USERS (email, password) values ( '{$email}','{$password}')";
            $inserted = mysqli_query($this->connection, $query);
            if ($inserted == 1) {
                $json['success'] = 'Acount created';
            } else {
                $json['error'] = ' wrong password';
            }
            echo json_encode($json);
            mysqli_close($this->connection);
        }
    }
}
$user = new User();
if (isset($_POST['email'], $_POST['password'])) {
    $email = $_POST['email'];
    $password = $_POST['password'];
    if (!empty($email) && !empty($password)) {
        $encrypted_password = md5($password);
        $user->does_user_exist($email, $password);
    } else {
        echo json_encode("you must type both inputs");
    }
}
        $query = "Select * from login where username='{$username}' and password = '{$password}' ";
        $result = mysqli_query($this->connection, $query);
        if (mysqli_num_rows($result) > 0) {
            $json['success'] = ' Bienvenido ' . $username;
            echo json_encode($json);
            mysqli_close($this->connection);
        } else {
            /*$query = "insert into tbemployee (userEmployee, passwordEmployee) values ( '$userEmployee','$passwordEmployee')";
            		$inserted = mysqli_query($this -> connection, $query);
            		if($inserted == 1 ){
            			$json['success'] = 'Acount created';
            		}else{
            			$json['error'] = ' wrong password';
            		}*/
            $json['error'] = ' Usuario o ContraseƱa Incorrectos';
            echo json_encode($json);
            mysqli_close($this->connection);
        }
    }
}
$user = new User();
if (isset($_POST['username'], $_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    if (!empty($username) && !empty($password)) {
        $encrypted_password = md5($password);
        $user->does_user_exist($username, $password);
    } else {
        echo json_encode("Debes completar ambos datos");
    }
}
                    mysqli_close($this->connection);
                } else {
                    $query = "select * from jobs where job_name like '%" . $jobname . "%'and pay>={$minpay} and pay<={$maxpay}";
                    $result = mysqli_query($this->connection, $query);
                    $json = array();
                    if (mysqli_num_rows($result)) {
                        while ($row = mysqli_fetch_assoc($result)) {
                            $json['job_search'][] = $row;
                        }
                    }
                    echo json_encode($json);
                    mysqli_close($this->connection);
                }
            }
        }
    }
}
$user = new User();
$jobname = $_GET['keyword'];
$minpay = $_GET['minpay'];
$maxpay = $_GET['maxpay'];
$checkboxoncampusjobs = $_GET['checkboxoncampusjobs'];
$checkboxstudentopportunities = $_GET['checkboxstudentopportunities'];
if ($minpay == "") {
    $minpay = 0;
}
if ($maxpay == "") {
    $maxpay = 10000;
}
$user->does_user_exist($jobname, $minpay, $maxpay, $checkboxoncampusjobs, $checkboxstudentopportunities);
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($firstname, $lastname, $email, $password)
    {
        $query = "insert into USERS (user_id,firstname,lastname,email,password) values ('', '{$firstname}','{$lastname}','{$email}','{$password}')";
        $inserted = mysqli_query($this->connection, $query);
        if ($inserted == 1) {
            $json['success'] = 'Account created';
        } else {
            $json['error'] = ' Failed to Register';
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
if (isset($_POST['firstname'], $_POST['lastname'], $_POST['email'], $_POST['password'])) {
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    if (!empty($email) && !empty($password) && !empty($firstname) && !empty($lastname)) {
        $encrypted_password = md5($password);
        $user->does_user_exist($firstname, $lastname, $email, $password);
    } else {
        echo json_encode("you must provide all the inputs");
    }
}
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($id, $password)
    {
        $query = "Select *from login where id='{$id}' and password = '{$password}' ";
        $result = mysql_query($this->connection, $query);
        if (mysql_num_rows($result) > 0) {
            $json['success'] = ' Bienvenido ' . $id;
            echo json_encode($json);
            mysql_close($this->connection);
        } else {
            $json['error'] = 'Usuario o Contrasena Incorrectos';
            echo json_encode($json);
            mysql_close($this->connection);
        }
    }
}
$user = new User();
if (isset($_POST['id'], $_POST['password'])) {
    $id = $_POST['id'];
    $password = $_POST['password'];
    if (!empty($id) && !empty($password)) {
        $encrypted_password = md5($password);
        $user->does_user_exist($id, $password);
    } else {
        echo json_encode("Debes completar ambos datos");
    }
}
<?php

include_once 'connection.php';
class User
{
    private $db;
    private $connection;
    function __construct()
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($job_id)
    {
        $query = "select * from jobs where job_id={$job_id}";
        $result = mysqli_query($this->connection, $query);
        $json = array();
        if (mysqli_num_rows($result)) {
            while ($row = mysqli_fetch_assoc($result)) {
                $json['job_detail'][] = $row;
            }
        }
        echo json_encode($json);
        mysqli_close($this->connection);
    }
}
$user = new User();
$job_id = $_GET['job_id'];
$user->does_user_exist($job_id);
Example #11
0
    {
        $this->db = new DB_Connection();
        $this->connection = $this->db->getConnection();
    }
    public function does_user_exist($userid, $password)
    {
        $query = "Select * from optimus_users where userid='{$userid}' and password = '{$password}' ";
        $result = mysqli_query($this->connection, $query);
        if (mysqli_num_rows($result) > 0) {
            $json['success'] = ' Welcome ' . $userid;
            echo json_encode($json);
            mysqli_close($this->connection);
        } else {
            $json['error'] = ' wrong username or password';
            echo json_encode($json);
            mysqli_close($this->connection);
        }
    }
}
$user = new User();
if (isset($_POST['userid'], $_POST['password'])) {
    $userid = $_POST['userid'];
    $password = $_POST['password'];
    if (!empty($userid) && !empty($password)) {
        $encrypted_password = md5($password);
        $user->does_user_exist($userid, $encrypted_password);
    } else {
        $json['error'] = ' You must type both inputs';
        echo json_encode($json);
    }
}