Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Old 04-01-2003, 08:58 PM Login Script HELP!!!
Mankiy's Avatar
Skilled Talker

Posts: 73
Location: The Light and The Dark, a Renegade at Heart
Trades: 0
PHP Code:
<html>
<head>
<title>Login</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif" size="5"><b>Login</b></font></p>

<form name="login" method="post" action="login.php"> 
Username: &nbsp; <input type="text" name="username" size="15" maxlength="15">
<br>
Password: &nbsp; <input type="password" name="password" size="15" maxlength="15">
<br><br>
          <input type="submit" name="Login" value="Login">
          <input type="reset" name="Clear" value="Clear">
</form>


<?php 
 
// Connect to the database server 
include("config.php");

// Request the info of all the info
 
$result = @mysql_query("SELECT username,password FROM members"); 
 if (!
$result) { 
   echo(
"<p>Error getting information: " mysql_error() . "</p>"); 
   exit(); 
 } 
?>



<?php
while ( $row mysql_fetch_array($result)) {
  
$dbusername 'row["username"]';  
  
$dbpassword 'row["password"]';

  if ((
$username == $dbusername) && ($password == $dbpassword)){
//This is where it goes if the login is successful  
?>

  <script>
    window.location=http://members.lycos.co.uk/clanx/ex.php    
  </script>

<?php
} else {
//This is where it goes if the login fails
?>

  <script>
    window.location=http://members.lycos.co.uk/clanx/login.php    
  </script>

<?php
}
}
mysql_close(); 
?>
</body>
</html>

This doesnt seem to work for some reason

Will someone help me plz?
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....

Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
Mankiy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-02-2003, 08:58 AM
shneak's Avatar
Average Talker

Posts: 24
Location: South UK
Trades: 0
Here's the corrected code:

<?php
// Connect to the database server
include("config.php");

// Request the info of all the info
$result = @mysql_query("SELECT username,password FROM members");
if (!$result) {
echo("<p>Error getting information: " . mysql_error() . "</p>");
exit();
} else {

while ( $row = mysql_fetch_array($result)) {
$dbusername = $row[username];
$dbpassword = $row[password];

if (($HTTP_POST_VARS[username] == $dbusername) && ($HTTP_POST_VARS[password] == $dbpassword)){
header("Location: http://members.lycos.co.uk/clanx/ex.php");
} else {
header("Location: http://members.lycos.co.uk/clanx/login.php");
}

}
mysql_close();

?>

<html>
<head>
<title>Login</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif" size="5"><b>Login</b></font></p>

<form name="login" method="post" action="login.php">
Username: &nbsp; <input type="text" name="username" size="15" maxlength="15">
<br>
Password: &nbsp; <input type="password" name="password" size="15" maxlength="15">
<br><br>
<input type="submit" name="Login" value="Login">
<input type="reset" name="Clear" value="Clear">
</form>
</body>
</html>
__________________
------------------------------------------
Dan - www.shneak.com
shneak is offline
Reply With Quote
View Public Profile Visit shneak's homepage!
 
Old 04-02-2003, 09:03 AM
shneak's Avatar
Average Talker

Posts: 24
Location: South UK
Trades: 0
Ooops... I mean HERE'S the corrected code


<?php
// Connect to the database server
include("config.php");

// Request the info of all the info
$result = @mysql_query("SELECT username,password FROM members");

if (!$result) {

echo("<p>Error getting information: " . mysql_error() . "</p>");

} else {

while ( $row = mysql_fetch_array($result)) {

$dbusername = $row[username];
$dbpassword = $row[password];

if (($HTTP_POST_VARS[username] == $dbusername) && ($HTTP_POST_VARS[password] == $dbpassword)){

header("Location: http://members.lycos.co.uk/clanx/ex.php");

} // endif

} // endwhile

} // endif

mysql_close();

?>

<html>
<head>
<title>Login</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif" size="5"><b>Login</b></font></p>

<form name="login" method="post" action="login.php">
Username: <input type="text" name="username" size="15" maxlength="15">
<br>
Password: <input type="password" name="password" size="15" maxlength="15">
<br><br>
<input type="submit" name="Login" value="Login">
<input type="reset" name="Clear" value="Clear">
</form>
</body>
</html>
__________________
------------------------------------------
Dan - www.shneak.com
shneak is offline
Reply With Quote
View Public Profile Visit shneak's homepage!
 
Old 04-02-2003, 03:50 PM
Mankiy's Avatar
Skilled Talker

Posts: 73
Location: The Light and The Dark, a Renegade at Heart
Trades: 0
but im not using HTTP access.......

Im using database authentication.......
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....

Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
Mankiy is offline
Reply With Quote
View Public Profile
 
Old 04-02-2003, 04:00 PM
Mankiy's Avatar
Skilled Talker

Posts: 73
Location: The Light and The Dark, a Renegade at Heart
Trades: 0
wait, if its not HTTP access, whats the $HTTP_POST_VARS????

I havent gotten that far in PHP yet....
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....

Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
Mankiy is offline
Reply With Quote
View Public Profile
 
Old 04-02-2003, 05:44 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
$HTTP_POST_VARS allows you to access the variables passed to the PHP script through the POST method of a form. You may have come across:
$variablename=$_POST['variable'];
or have just accessed variables using:
$variablename;
All of them work but the $HTTP_POST_VARS and $_POST are better programming style (and in later versions of PHP they are the only ones that work).

http://www.freewebmasterhelp.com/tutorials/php/6
has more info.
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Old 04-02-2003, 06:56 PM
Mankiy's Avatar
Skilled Talker

Posts: 73
Location: The Light and The Dark, a Renegade at Heart
Trades: 0
hmmm.......

still didnt work for me


Ah, Login scripts HATE me
__________________
New Gaming Site Coming Soon!
Regular accounts are Free, Premium accounts are $5 to start, $2 every month after.....

Will be a Gaming Clan add-on (yeh, i have a gaming clan :) )
Mankiy is offline
Reply With Quote
View Public Profile
 
Old 08-30-2003, 05:45 AM hey
Novice Talker

Posts: 7
Trades: 0
I am using login scripts! you probly need a new Database with this script! i can hook you up free!


E-mail me at brent@geeks2go.ca

and ill hook ya up in no time! and send me the Full script in a Zip file and ill fix it!
npr1211 is offline
Reply With Quote
View Public Profile
 
Old 08-30-2003, 06:44 AM
Skilled Talker

Posts: 52
Location: Leamington, UK
Trades: 0
hi what kind of error you getting?

and change this line

PHP Code:
@mysql_query("SELECT username,password FROM members"); 
to

PHP Code:
mysql_query("SELECT username,password FROM members") or die (mysql_error()); 
tell me what error you get and maybe i can help more

btw i cant test your script atthe moment as i have just formated and i havnt installed my dev server yet, but i will when i get time later
__________________
Stewart McIntosh -
stewis is offline
Reply With Quote
View Public Profile
 
Old 08-31-2003, 07:54 PM
Novice Talker

Posts: 7
Trades: 0
hey stewis u got any good login scripts? well loads of $#!T that i can use. i am pi$$ed about the one i am using.
npr1211 is offline
Reply With Quote
View Public Profile
 
Old 08-31-2003, 07:55 PM
Novice Talker

Posts: 7
Trades: 0
i am needing help installing Mysql if you know how i can use the help!
npr1211 is offline
Reply With Quote
View Public Profile
 
Old 08-31-2003, 08:00 PM
Novice Talker

Posts: 7
Trades: 0
i am going to download mysql soon so i need help when ever i can get it!
npr1211 is offline
Reply With Quote
View Public Profile
 
Old 08-31-2003, 08:01 PM
Novice Talker

Posts: 7
Trades: 0
anyone know where i can download the Full Mysql manual??? free!
npr1211 is offline
Reply With Quote
View Public Profile
 
Old 09-01-2003, 06:57 AM
Skilled Talker

Posts: 52
Location: Leamington, UK
Trades: 0
umm http://www.mysql.com/downloads/downl...ip&pick=mirror - CHM manual

you may want to look at www.firepages.au.com for a full php/mysql/apache setup (only probs is its a little out of date php + apache)

Note: its not for production use just development
__________________
Stewart McIntosh -
stewis is offline
Reply With Quote
View Public Profile
 
Old 09-01-2003, 07:06 AM
Skilled Talker

Posts: 52
Location: Leamington, UK
Trades: 0
oh and as a reply Mankiys question try this code i havnt tested it but it should work:

PHP Code:
<?php
// Connect to the database server
include("config.php");

// Request the info of all the info
  
$login mysql_fetch_array(mysql_query("SELECT username,password FROM members LIMIT 1") or die(mysql_error()));
  
$dbusername $login["username"];
  
$dbpassword $login["password"];

if ((
$_POST["username"] == $dbusername) && ($_POST["password"] == $dbpassword))
{
    
//This is where it goes if the login is successful
    
header("location: http://members.lycos.co.uk/clanx/ex.php");
}
else
{
    
//This is where it goes if the login fails
    
?>

    <html>
        <head>
            <title>
                Login
            </title>
        </head>

        <body bgcolor="#FFFFFF" text="#000000">
            <p>
                <font face="Arial, Helvetica, sans-serif" size="5">
                    <b>Login</b>
                </font>
            </p>
            <form name="login" method="post" action="login.php">
                Username: &nbsp; <input type="text" name="username" size="15" maxlength="15">
                <br>
                Password: &nbsp; <input type="password" name="password" size="15" maxlength="15">
                <br><br>
                <input type="submit" name="Login" value="Login">
                <input type="reset" name="Clear" value="Clear">
            </form>
        </body>
    </html>
    <?php
}
mysql_close();
?>
__________________
Stewart McIntosh -

Last edited by stewis; 09-01-2003 at 07:16 AM..
stewis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Login Script HELP!!!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.70796 seconds with 12 queries