Jump to content

'Invalid password' error message


seivadeel

Recommended Posts

I am very very very new to PHP, so I need a solution to my problem in layman's language, please!

 

Basically, the problem's this:

 

When people register on my site, they are automatically sent their login details as you would expect. However, when they then try to login, they get the error message 'invalid password', even though I've checked PhPAdmin & the passwords are there!

 

What is happening?

 

Please help!

Link to comment
Share on other sites

Here is the script:

 

Login

 

 

Username: error('user'); ?>

Password: " /> error("pass"); ?>

value('remember') != ""){ echo "checked"; } ?> /> Remember me next time   

 

[Forgot Password?]

 

 

 

generateRandStr(8); $password=md5($newpass); include('scripts/mysql_class.php'); $DB = new mysql(); $connected = $DB->Connect(); // check username duplicates and add numbers to end $username_sql = "SELECT username FROM users WHERE username LIKE '$new_username%' ORDER BY username ASC"; $username_query = $DB->Query($username_sql); while($username_array = $DB->FetchArray($username_query)) { extract($username_array); } if ($count!=0) { if ($username==$new_username) { $new_username=$username."_1"; } else { list($name, $number) = explode('_', $username); $new_number=$number+1; $new_username=$new_username."_".$new_number; } } $sql = "INSERT INTO users (username, password, email, userlevel, joined, paid, currency) VALUES ('$new_username', 'from passback', '$payer_email', '1', '$today', '$amount', '$currency')"; $query = $DB->Query($sql); $message_txt="Dear $new_username/n/nThanks for joining The English Boutique/n/nYou can login in anytime by going to www.theenglishboutique.com/members.php/n/nYour account name is $username/nYour password is:$newpass/n/nWe hope you and your students find our teaching materials useful. Please send us a comments about how you are using them in class./n/nThe English Boutique team."; $message_html="Dear $new_username

 

Thanks for joining The English Boutique

 

You can login in anytime by going to www.theenglishboutique.com/members.php

 

Your account name is $username

Your password is:$newpass

 

We hope you and your students find our teaching materials useful. Please send us a comments about how you are using them in class

Link to comment
Share on other sites

Er...sorry - does this help?

 

echo "<b>Payment details</b><br />";
			echo "Name: $firstname $lastname<br />";
			echo "Email: $payer_email<br />";
			echo "Item: $itemname<br />";
			echo "Amount: $amount $currency<br /><br />";

			if ($stauts=='Completed') {
				echo "Your transaction has been completed, and a receipt from Paypal.com has been emailed to you. You may log into your account at <a href='www.paypal.com/row' target='new'>www.paypal.com/row</a> to view details of this transaction.<br /><br />";
				echo "For security purposes, your personal log-in details for The English Boutique have been sent to you by email.<br /><br />";
			} else {
				echo "Your transaction from Paypal is still pending.  Once this has been confirmed, a receipt from Paypal.com will be emailed to you. You may log into your account at <a href='www.paypal.com/row' target='new'>www.paypal.com/row</a> to view the status of this transaction.<br /><br />";
				echo "For security purposes, your personal log-in details for The English Boutique will be sent to you by email as soon as payment has.been completed.<br /><br />";
			}
		?>
			<h1 class='boxed'>Login</h1>
			<form action="process.php" method="post">
			<table align="left" border="0" cellspacing="0" cellpadding="3">
			<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value('user'); ?>" /></td><td><? echo $form->error('user'); ?></td></tr>
			<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>" /></td><td><? echo $form->error("pass"); ?></td></tr>
			<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value('remember') != ""){ echo "checked"; } ?> />
			Remember me next time     
			<input type="hidden" name="sublogin" value="1" />
			<input type="submit" value="Login" /></td></tr>
			<tr><td colspan="2" align="left"><br /><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
			</table>
			</form><br /><br /><br />
		<?

		$new_username=strtolower($firstname.$lastname);
		$today=date('y-m-d');
		$newpass = $session->generateRandStr(;
		$password=md5($newpass);

		include('scripts/mysql_class.php');
		$DB = new mysql();
		$connected = $DB->Connect();

		// check username duplicates and add numbers to end
		$username_sql = "SELECT username FROM users WHERE username LIKE '$new_username%' ORDER BY username ASC";
		$username_query = $DB->Query($username_sql);
		while($username_array = $DB->FetchArray($username_query)) {
			extract($username_array);
		}
		if ($count!=0) {
			if ($username==$new_username) { $new_username=$username."_1"; }
			else {
				list($name, $number) = explode('_', $username);
				$new_number=$number+1;
				$new_username=$new_username."_".$new_number;
			}
		}

		$sql = "INSERT INTO users (username, password, email, userlevel, joined, paid, currency) VALUES ('$new_username', 'from passback', '$payer_email', '1', '$today', '$amount', '$currency')";
		$query = $DB->Query($sql);

		$message_txt="Dear $new_username/n/nThanks for joining The English Boutique/n/nYou can login in anytime by going to www.theenglishboutique.com/members.php/n/nYour account name is $username/nYour password is:$newpass/n/nWe hope you and your students find our teaching materials useful. Please send us a comments about how you are using them in class./n/nThe English Boutique team.";
		$message_html="Dear $new_username<br /><br />Thanks for joining The English Boutique<br /><br />You can login in anytime by going to <a href='www.theenglishboutique.com/members.php'>www.theenglishboutique.com/members.php</a><br /><br />Your account name is <b>$username</b><br />Your password is:<b>$newpass</b><br /><br />We hope you and your students find our teaching materials useful. Please send us a comments about how you are using them in class<br /><hr />The English Boutique team.";

		include('scripts/mailer_class.php');

		$payer_email='nick@skin-graft.com';
		$mailer=new ComposeMail("$payer_email","Your login details for The English Boutique");
		$mailer->sh_fromName("The English Boutique.com");
		$mailer->sh_fromAddr("info@theenglishboutique.com");
		$mailer->addTextPlainBodyPart("$message_txt");
		$mailer->addHTMLBodyPart("$message_html");
		$mailer->BuildAndSendMessage();

		}
	}
   else if (strcmp ($lines[0], "FAIL") == 0) {
   // log for manual investigation
}
}
fclose ($fp);


} else if($session->logged_in) {
/**
 * User has already logged in, so display relavent links, including
 * a link to the admin center if the user is an administrator.
 */

echo "<br />[Main] ";
if($session->isAdmin()){
	echo "[<a href='resources.php?downloads'>Download Stats</a>] ";
	echo "[<a href='resources.php?users'>User stats</a>] ";
	echo "[<a href='resources.php?new'>Add Resource</a>] ";
	echo "[<a href=\"admin/admin.php\">Admin Center</a>] ";
} else {
	echo "[<a href=\"userinfo.php?user=$session->username\">Account</a>] ";
	echo "[<a href=\"useredit.php\">Edit</a>] ";
	echo "[<a href=\"userfiles.php?user=$session->username\">Files</a>] ";
   	}
echo "[<a href=\"process.php\">Logout</a>] ";
echo "<br /><hr />";

echo "<h1>Logged In</h1>";
   	echo "<p>Welcome <b>$session->username</b>, you are logged in. </p>";

/**
* Just a little page footer, tells how many registered members
* there are, how many users currently logged in and viewing site,
* and how many guests viewing site. Active users are displayed,
* with link to their user information.
*/
if($session->isAdmin()){
echo "<h2><b>Member Total:</b> ".$database->getNumMembers()."</h2>";
echo "<p>There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.</p>";

include("include/view_active.php");
}

} else {
?>

<div style="width:350px; float:right; border:solid black 0;">
<h1 class='boxed'>Login</h1>
<?
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value('user'); ?>" /></td><td><? echo $form->error('user'); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>" /></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value('remember') != ""){ echo "checked"; } ?> />
Remember me next time     
<input type="hidden" name="sublogin" value="1" />
<input type="submit" value="Login" /></td></tr>
<tr><td colspan="2" align="left"><br /><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
</table>
</form>
</div>

<div style="width:400px; border:solid black 0;">
<h1 class='boxed'>Why sign up? <span class='small-red'>the benefits</span></h1>
<p>Membership of The English Boutique gives you access to:</p>
<p><span class="red">120 hours</span> of  course materials (Level 1 and 2)</p>
<p><span class="red">20 </span> listenings worksheets</p>
<p>A <span class="red">library</span> of teacher's resources</p>
<p><span class="red">ALL</span> student and teacher  resources under development for the coming year (including a new Level 3 course)</p>
<p>The minimum we ask is $2, but how much is all this really worth to you ... ?</p>
</div>


<h4>Click below to join today !</h4>
<h1 class='boxed'><span class='small-red'><a href="register.php" class="red">Click to join today !</a></span></h1>

<!-- <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="business@nojosandbox.com">
<input type="hidden" name="item_name" value="1 year access to The English Boutique">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form> -->

<? } ?>
</div>

<br /><br /><br />
</body>
</html>

Link to comment
Share on other sites

Er...sorry - does this help?

 

Not really. You might want to narrow your problem down and post the relevent code. Please use the full <?php tags when posting (its good practice anyway) and then place your code within [ code ][ /code ] (without the spaces) tags.

 

Also, as it seems you may be new to help forums... a quick read of the link in my signiture may help you. Its your job to make it easy for us to want to help you.

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.