Where to insert a phrase in the right place
| From: | Mário Gamito | Date: | Mon, 09 Apr 2007 19:51:53 +0000 |
| Subject: | Where to insert a phrase in the right place | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-252355@lists.php.net to get a copy of this message | ||
Hi,
I'm making this site that was static and now has some dynamic features,
so it's a little bit patched :)
If you care to visit
http://www.telbit.pt/2/login.php
you'll notice that the word "Welcome" is already present, and only
should be after the download.
Also, the error "You didn't fill all fields, please try again." is being
displayed on page load.
This is my problem and to which i ask you for your help.
How can i make the word "Welcome" appear only after the login ?
My code follows my signature.
Any help would be appreciated.
Warm Regards
--
:wq! Mário Gamito
--
<p><a href="recover-password.php">Forgot your password ?</a>
<?php
if ($_GET['error']) {
// SESSION
$field1 = $_SESSION['field1'];
$field2 = $_SESSION['field2'];
// GET
$field1 = urldecode($_GET['field1']);
$field2 = urldecode($_GET['field2']);
}
$email = mysql_escape_string($_REQUEST['email']);
$pass = mysql_escape_string($_REQUEST['pass']);
include('config.php');
include('adodb/adodb.inc.php');
// connect to MySQL
$conn->debug=1;
$conn = &ADONewConnection('mysql');
$conn->PConnect($host,$user,$password,$database);
// get password from db
$rsSel = "SELECT name, password FROM subscribers WHERE email = '$email'
AND valid = '1'";
$rs = $conn->Execute($rsSel);
$name = $rs->fields[0];
$password_db = $rs->fields[1];
if ($pass != $password_db) {
"&field1=".urlencode($_POST['field1'])."&field2=".urlencode($_POST['field2']);
echo "<div class=\"blocoApresentacao\">
<p>Wrong password, please try again.</p>
</div>";
exit;
}
print('Welcome ' . $name);
unset ($_SESSION['error']);
$conn->Close();
?>
<!-- end .titulo -->
</div>
<!-- end #secContent -->
</div>
<!-- end #Content e #picContent-->
</div>
</div>
<div id="footer">
<p id="copyright">Copyright©2006 Telbit -
Tecnologias de Informação, Lda.</p>