Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start()?>
- <?php
- header("content-type: Access-Control-Allow-Origin: *");
- header("content-type: Access-Control-Allow-Methods: GET");
- header("content-type: text/javascript");
- if(isset($_GET['login']) && isset($_GET['callback']) && isset($_GET['password']))
- {
- $obj->password=$_GET['password'];
- $user=$_GET['login'];
- $pass=$_GET['password'];
- $bd_lacz = new mysqli('localhost', 'pbl', 'pbl', 'pbl');
- $quest = 'select * from accounts ' /* sending login and pass to the database */
- . "where login='$user' "
- . " and password='$pass'";
- $result = $bd_lacz->query($quest);
- if ($result->num_rows > 0) {
- $_SESSION['prawid_uzyt'] = $user;
- $obj->message = "Logged " ;
- }
- else {
- $obj->message="Error";
- }
- if(isset($_SESSION['prawid_uzyt'])){
- echo $_GET['callback']. '(' . json_encode($obj) . ');';}
- }
- else {
- echo("nothing is set");
- }
- ?>
Add Comment
Please, Sign In to add comment