GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Sep-2006, 18:34
questions questions is offline
New Member
 
Join Date: Sep 2006
Posts: 2
questions is on a distinguished road

php mysql login


how do i check the username and password that on the database? Currently, i only have one static username and password. How can do if aaa username password is matach on database it will bring the user to "ab.php" page, if ccc usernane and password is ddd is match from database go to "cd.php page" i know i can use switch case but i have hundred of different used base on their accesslevel.


PHP Code:

$_SESSION['logged'] = '';
    $_SESSION['user'] = '';

    $user = isset($_POST['user'])? $_POST['user'] : '';
    $pass = isset($_POST['pass'])? $_POST['pass'] : '';
    
    
    $sql = "select * from tableuser where username='$user' AND passowrd ='$pass'";
    
    
    /* authenticating user - one account system*/
    if (($user == 'test') and ($pass == 'password')) {
        $_SESSION['logged'] = 1;
        $_SESSION['user'] = 1; //put user-id, if you have any
        header('location:welcome.php');
    } else {
        if (!empty($user) and !empty($pass)) {
            $errorMsg= 'Invalid username/password';
        }
    }
?> 


<form name="form1" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

USERNAME: <input type="text" name="user" value="" />
PASSWORD: <input type="password" name="pass" value="" />

input type="button" value="Login" onclick="return frmLogin();"/>
<div id="erro_msg">
<?php echo isset($login_msg)? $login_msg : ''; ?></div>

</form>[/php]
Last edited by LuciWiz : 26-Sep-2006 at 05:53. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 22-Oct-2006, 19:00
HelloMoto HelloMoto is offline
New Member
 
Join Date: Oct 2006
Posts: 25
HelloMoto is on a distinguished road

Re: php mysql login


The password and username are usually in the site itself. Just go look for a file named sql.php or mysql.php and the information is in the file.
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cpanel downgrade MYSQL 4.1.X to MySQL 4.0.xx Webhosting-live Web Hosting Forum 1 01-Sep-2006 03:54
php and mysql vladimy MySQL / PHP Forum 2 28-May-2005 06:17
PHP, MySQL, WML skyloon MySQL / PHP Forum 0 05-Mar-2004 08:53
[script] Password Protect web pages/site using PHP and MySQL JdS PHP Code Library 0 23-Jul-2003 11:02
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 14:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:16.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.