Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Create a connection to the logindb database and to MySQL.
- // Set the encoding and the access details as constants:
- DEFINE ('DB_USER', 'johny');
- DEFINE ('DB_PASSWORD', 'some_pass');
- DEFINE ('DB_HOST', 'localhost');
- DEFINE ('DB_NAME', 'biblioteczka');
- // Make the connection:
- $dbcon = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
- OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );
- $ID = $_POST['user'];
- $PASSWORD = $_POST['pass'];
- // Set the encoding...
- mysqli_set_charset($dbcon, 'utf8');
- function SignIn(){
- session_start();
- if(!empty($_POST['user'])){
- $query = mysql_query("SELECT * FROM userName where user ='$_POST[user]' and pass = '$_POST[pass]'"
- or die(mysql_error));
- $row = mysql_fetch_array($query) or die(mysql_error());
- if(!empty($row['userName']) AND !empty($row['pass'])){
- $_SESSION['userName'] = $row['pass'];
- echo "SUCCESSFULLY LOGIN TO USER PROFILE PAGE...";
- } else {
- echo "SORRY... YOU ENTERD WRONG ID AND PASSWORD... PLEASE RETRY...";
- }
- }
- }
- if(isset($_POST['submit']))
- {
- SignIn();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement