Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Help

Links for php scripts

Moderators: macek, egami, gesf

Help

Postby usmcrewcheif » Thu May 09, 2013 6:39 pm

I need help! This piece of coding is messed up. It was working great but I think I deleted a character or added an extra one and can't figure it out. This is obviously for a members login page but when it pulls the page up it shows the user name and password boxes with the button and the following text below it

""; if ($_POST['loginbtn']){ $username = $_POST['username']; $password = $_POST['password']; if ($username){ if ($password){ require("connect.php"); $password = md5($password); $query = mysql_query("SELECT * FROM users WHERE username = '$username'"); $numrows = mysql_num_rows($query); if ($numrows ==1)( $row = mysql_fetch_assoc($query); $dbuser = $row['username']; $dbfirstname = $row['first_name']; $dbid = $row['id']; $dbpass = $row['password']; $dbactive = $row['active']; if($password == $dbpass){ if($dbactive == 1){ $_SESSION['userid'] = $dbid; $_SESSION['username'] = $dbuser; echo "You have been logged in $dbfirstname. Click here to login to the Member's area."; } else echo"Your account has not been activated yet. $form"; } else echo "You did not enter the correct password. $form"; ) else echo "The username you entered was not found. $form"; mysql_close(); } else echo "You must enter your password. $form"; } else echo "You must enter your username. $form"; } else echo$form; ?> "

Any help would be greatly appreciated!

Here is the code for the section I think the issue is in.

<?php

$form = "<form action="checkuser.php" method="post" name="" id="">
<table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td width="22%">Username</td>
<td width="78%"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="loginbtn" value="Login"></td>
</tr>
</table>
</form>";

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

if ($username){
if ($password){

require("connect.php");

$password = md5($password);
$query = mysql_query("SELECT * FROM users WHERE username = '$username'");
$numrows = mysql_num_rows($query);
if ($numrows ==1)(
$row = mysql_fetch_assoc($query);
$dbuser = $row['username'];
$dbfirstname = $row['first_name'];
$dbid = $row['id'];
$dbpass = $row['password'];
$dbactive = $row['active'];

if($password == $dbpass){
if($dbactive == 1){

$_SESSION['userid'] = $dbid;
$_SESSION['username'] = $dbuser;

echo "You have been logged in <b>$dbfirstname</b>. <a href='login_success.php'>Click here</a> to login to the Member's area.";
}
else
echo"Your account has not been activated yet. $form";

}
else
echo "You did not enter the correct password. $form";
)
else
echo "The username you entered was not found. $form";



mysql_close();

}
else
echo "You must enter your password. $form";
}
else
echo "You must enter your username. $form";
}
else
echo$form;

?>

<br /><center>
<a href="lost_pw.html">Forgot your Password? Click here for help.</a><br /><br />
<a href="join.php">Are you a new user? Click here to register.</a>
</center></td>
usmcrewcheif
New php-forum User
New php-forum User
 
Posts: 7
Joined: Wed Aug 29, 2012 9:03 pm

Re: Help

Postby developerahusain » Tue May 28, 2013 10:31 pm

here is the problem you change this
else
echo "You did not enter the correct password. $form";
)

into this
else
echo "You did not enter the correct password. $form";
}

Developer ahusain
developerahusain
New php-forum User
New php-forum User
 
Posts: 36
Joined: Tue May 28, 2013 10:04 pm
Location: India,Lucknow


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron