Advertisement
Guest User

Untitled

a guest
Apr 13th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.97 KB | None | 0 0
  1. <?php
  2. require_once '../lib/php/password.php';
  3. $dbconn = pg_connect(
  4.         "host=host dbname=name user=admin password=pass"
  5.     ) or die('Could not connect: ' . pg_last_error());
  6.  
  7. if (isset($_SERVER['HTTP_ORIGIN'])) {
  8.     header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
  9.     header('Access-Control-Allow-Credentials: true');
  10.     header('Access-Control-Max-Age: 86400');
  11.     header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");    
  12. }
  13.  
  14. if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
  15.     if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
  16.         header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");        
  17.  
  18.     if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
  19.         header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
  20. }
  21.     $login = $_POST['loginValue'];
  22.     $query = "SELECT * FROM info_users WHERE login = '" . pg_escape_string($login) . "'";
  23.     var_dump($_POST);
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement