Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2011, 12:28 PM
Registered User
 
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP code for login with different subpages

Hello,
I would like to ask for help with PHP code for login. I need that user who is already loged in was redirected with his parameter TOWN, which has this user in mysql dtb to the subpage town.php. I am sorry I am beginner with PHP :-).
After log in Mrkva will go to A.php and Slana to B.php. Thank you very much.

-table in Mysql dtb

surname pass town
Mrkva 123 A
Slana 456 B

-php

<?php
ob_start();

$dbhost= 'localhost';
$dbuser= 'root';
$dbpassword= '';
$db='doc';
$tbl='tbl';

mysql_connect($dbhost,$dbuser,$dbpassword) or die("cannot connect");
mysql_select_db($db) or die("cannot select DB");

$surname = $_POST['surname'];
$pass = $_POST['pass'];

$sql="SELECT * FROM $tbl WHERE surname='$surname' and pass='$pass' ";
$result=mysql_query($sql);
$count=mysql_num_rows($result) ;

if($count==1){
session_register("surname");
session_register("pass");

header("location:A.php");}

else {
header("location:index.php");
}

ob_end_flush();

?>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php login code problem ravi951 PHP How-To 0 August 12th, 2011 02:06 AM
Creating a login page in PHP bhavna General .NET 0 February 16th, 2007 07:32 AM
PHP Login script problem columbo1977 Beginning PHP 1 May 21st, 2006 10:47 PM
No login with auth_user.php stefanocinfo BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 September 10th, 2005 03:34 AM
Php login session problem programmer Beginning PHP 1 August 3rd, 2004 03:57 AM



All times are GMT -4. The time now is 01:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.