Jump to content

Can't get login system to work


russ939

Recommended Posts

here is my part of the code which i am stuck on

<?php

$form = "<form action='login.php' method='post'>
<center>
<table>
<tr>
<td><input type='text' id='usernamebox' name='Username' value='Username' tabindex='1' class='textbox' onFocus='usernamebox_focus();' onBlur='usernamebox_blur();'></td>
    <td><a href='register.php'>Register</span></a></td>
</tr>
<tr>
<td><input type='password' id='passwordbox' name='Password' value='Password' tabindex='2' class='textbox' onFocus='passwordbox_focus();' onBlur='passwordbox_blur();'></td>
    <td><input type='submit' name='loginbutton' value='Login'></td>
</tr>
</table>
</center>
</form>";  ******(on the website the rest under thiss is missing)********

if ($_POST['loginbutton']){
$user = $_POST['username'];
$password = $_POST['password'];

if ($user && $password && $user != 'Username'){
	require("Scripts/connect.php");
	$password = md5($password);
	$query = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$password'");

	$numrows = mysql_num_rows($query);

	if ($numrows = 1){
		$rows = mysql_fetch_assoc($query);
		$dbuser = $rows['username'];

		$_SESSION['user'] = $dbuser;
		$_SESSION['id'] = $dbid;
			echo "<a href='index.php'> You are now loged in Click here to go to our Homepage</a>";
	}
	else
		echo '<center>You did not submit a correct username and/or password!</center>';
		echo '$form';

}
else
	echo '<center>You did not submit a correct username and/or password!</center>';
	echo '$form';
}
else{
echo '$form';
}

?>

Link to comment
Share on other sites

well i'm simply trying to get the code to work lol

 

All this code is missing when i look at the source code on my website but when i look at the code in the login.php file on my ftp it's all thier

if ($_POST['loginbutton']){
$user = $_POST['username'];
$password = $_POST['password'];

if ($user && $password && $user != 'Username'){

require("Scripts/connect.php");

$password = md5($password);

$query = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$password'");

$numrows = mysql_num_rows($query);

if ($numrows = 1){

$rows = mysql_fetch_assoc($query);

$dbuser = $rows['username'];

$_SESSION['user'] = $dbuser;
$_SESSION['id'] = $dbid;

echo "<a href='index.php'> You are now loged in Click here to go to our Homepage</a>";
}	
else

echo '<center>You did not submit a correct username and/or password!</center>';
echo '$form';	
}

else

echo '<center>You did not submit a correct username and/or password!</center>';	
echo '$form';
}

else{

echo '$form';
}

 

website is www.hostgamer.co.uk/login.php

 

also onn dreamweaver with live view select the missing code shows under the login box (pic attached) :confused::wtf:  :'(

 

[attachment deleted by admin]

Link to comment
Share on other sites

PHP does not show up as a source code in a browser. All you will see is your HTML language. If you can see your PHP code within an editor (dreamweaver) then trust me ... its there. But like I said, PHP is not displayed in the source code from a browser, even if you 'save as' the web page, you will still not see any of the PHP code.

 

On to the problem, let me get my understanding correct. Am I right in thinking that your login script is missing a load of code, causing it not to function?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.