Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $host="xx.xx.x.xxx"; // Host name
- $user="xxxx"; // username
- $pass="xxx"; // password
- $dbname="xxx"; // Database name
- // Connect to server and select databse.
- pg_connect("host=$host user=$user dbname=$dbname password=$pass")or die("cannot connect");
- // username and password sent from form
- $myusername=$_POST['myusername'];
- $mypassword=$_POST['mypassword'];
- $vegpont_id=$_POST['vegpont_id'];
- $sql="SELECT * FROM vegpont v, ugyfel u WHERE v.azonosito='$myusername' and u.pwd='$mypassword' and u.ugyfel_id=v.ugyfel_id";
- $result=pg_query($sql);
- // pg_num_row is counting table row
- $count=pg_num_rows($result);
- // If result matched $myusername and $mypassword, table row must be 1 row
- $row = pg_fetch_array($result, PGSQL_ASSOC);
- if($count==1){
- // Register $myusername, $mypassword, $vegpont_id and redirect to file "login_success.php"
- session_register("myusername");
- session_register("mypassword");
- session_register("vegpont_id");
- header("location:login_success.php");
- }
- else {
- echo "Wrong Username or Password";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement