Guest User

Untitled

a guest
May 10th, 2015
423
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $Host= '192.168.1.8';
  3. $Dbname= 'app';
  4. $User= 'yyy';
  5. $Password= 'xxx';
  6. $Schema = 'test';
  7.  
  8. $Conection_string="host=$Host dbname=$Dbname user=$User password=$Password";
  9.  
  10. /* Connect with database asking for a new connection*/
  11. $Connect=pg_connect($Conection_string,$PGSQL_CONNECT_FORCE_NEW);
  12.  
  13. /* Error checking the connection string */
  14. if (!$Connect) {
  15. echo "Database Connection Failure";
  16. exit;
  17. }
  18.  
  19. $query="SELECT user_name,password from $Schema.members where user_name='".$_POST['user_name']."';";
  20.  
  21. $result=pg_query($Connect,$query);
  22. $row=pg_fetch_array($result,NULL,PGSQL_ASSOC);
  23.  
  24. $user_pass = md5($_POST['pass_word']);
  25. $user_name = $row['user_name'];
  26.  
  27. if(strcmp($user_pass,$row['password'])!=0) {
  28. echo "Login failed";
  29. }
  30. else {
  31. # Start the session
  32. session_start();
  33. $_SESSION['USER_NAME'] = $user_name;
  34. echo "<head> <meta http-equiv=\"Refresh\" content=\"0;url=home.php\" > </head>";
  35. }
  36. ?>
RAW Paste Data