Advertisement
Guest User

Untitled

a guest
Jun 10th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. <?php
  2. // Create a connection to the logindb database and to MySQL.
  3. // Set the encoding and the access details as constants:
  4. DEFINE ('DB_USER', 'johny');
  5. DEFINE ('DB_PASSWORD', 'some_pass');
  6. DEFINE ('DB_HOST', 'localhost');
  7. DEFINE ('DB_NAME', 'biblioteczka');
  8. // Make the connection:
  9. $dbcon = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
  10. OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );
  11.  
  12. $ID = $_POST['user'];
  13. $PASSWORD = $_POST['pass'];
  14. // Set the encoding...
  15. mysqli_set_charset($dbcon, 'utf8');
  16. function SignIn(){
  17. session_start();
  18. if(!empty($_POST['user'])){
  19. $query = mysql_query("SELECT * FROM userName where user ='$_POST[user]' and pass = '$_POST[pass]'"
  20. or die(mysql_error));
  21. $row = mysql_fetch_array($query) or die(mysql_error());
  22. if(!empty($row['userName']) AND !empty($row['pass'])){
  23. $_SESSION['userName'] = $row['pass'];
  24. echo "SUCCESSFULLY LOGIN TO USER PROFILE PAGE...";
  25. } else {
  26. echo "SORRY... YOU ENTERD WRONG ID AND PASSWORD... PLEASE RETRY...";
  27. }
  28.  
  29. }
  30. }
  31. if(isset($_POST['submit']))
  32. {
  33. SignIn();
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement