...

View Full Version : Help geting my login work



due
06-21-2006, 12:31 AM
This is my index.
<html>
<head>
<title>Drug Money</title>
</head>


<body bgcolor="#000" text="#ffffff">
<form action="login.php" method="POST">
Username:<br><input name="username" type="text" maxlength="30" />
<br>Password:<br><input name="password" type="password" />
<br><input type="submit" value="Log in" />
</form></center>
<div align="center"><table border="1" bgcolor="green" bordercolor="yellow" width="50%">
<tr>
<th><div align="center">NEWS</div></th></tr><tr><th>Updates:<hr>We Have Just started.</th></tr></table></div>
</body>
</html>
</div>
And my login.php
<? ob_start(); ?>
<html>
<head>
<title>Drug Money:: login</title>
</head>
<body>
<body bgcolor="#000" text="#ffffff">
<tr><td align="center">
<table style="border: 3px solid" align="center" width="50%" cellspacing="0" cellpadding="5">
<tr><th class="new" style="border-bottom: 3px solid"><b>
<?

if( empty($_POST['username']) || empty($_POST['password']) )
{
echo 'Please specify a username and a password';
exit();
}

if( !preg_match('/^[a-z][a-z0-9_-]{3,31}$/i', $_POST['username']) || (strlen($_POST['password']) < 6) )

{
echo 'Invalid username/password combination';
exit();
}

$_POST['password'] = md5( $_POST['password'] );

mysql_connect( 'localhost', 'wwwsolar_pg', 'king' );
mysql_select_db( 'wwwsolar_pg' );

$result = mysql_query( "SELECT id FROM users WHERE username='{$_POST['username']}' AND password='{$_POST['password']}'" );
$user = mysql_fetch_assoc( $result );
mysql_free_result( $result );

mysql_close();

if( empty($user) )
{
echo 'Invalid username/password try again!';
exit();
}

$_SESSION['user_id'] = $user['id'];

header( 'Location: http://drugmoney.solarcombat.co.uk/base.php' );

?></b></th></tr>

and when i insert the right pass and user it say Invalid username/password combination anyone know why

RawliJr
06-21-2006, 12:35 AM
mysql_connect( 'localhost', 'xxx', 'xxx' );
mysql_select_db( 'xxx' );

fisrt of all change that to like xxx or something?

and anothe rthing you can change is


<body bgcolor="#000" text="#ffffff">

to


<body bgcolor="#000" text="#fff">


im not to sure, but i think it is

$_POST['password'] = md5( $_POST['password'] );

i think u have to delete that

and move this


header( 'Location: http://drugmoney.solarcombat.co.uk/base.php' );

move it up infront of


$_SESSION['user_id'] = $user['id'];

might be wrong though :cool:

but try it! lol...

due
06-21-2006, 12:42 AM
oh i see so people dont see that right but can u tell me whats wrong on it

due
06-21-2006, 05:09 PM
that didnt work anyone know how to fix it



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum