when posting your code, please use the "[PHP]" brackets, and name your pages appropriately.
For example...
verify.php
PHP Code:
<?php include 'includes/connection.php'; // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $rememberMe = strip_tags($_POST['remember']); // To protect Myinjection (SQL more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $fetch = mysql_fetch_array($result); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row @session_start(); $_SESSION['uid'] = $fetch['ID']; if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" if ($myusername == 'admin' && $mypassword == 'admin') { if ($rememberMe == "remember") { setcookie("loggedIn", "yes", time()+3600); } echo "<meta http-equiv='refresh' content='0;url=http://localhost/newstart/admin.php'>"; } else { echo "<meta http-equiv='refresh' content='0;url=http://localhost/newstart/index.php'>"; } } else { echo "<script>"; echo "location.href = 'wrong_login.php'"; echo "</script>"; } ?>
And so on, for each page.
Not only does it make it easier for people to help you, it's a little friendlier on the eyes as well.
Personally, (as i'm still quite the PHP newb myself) I like to plug each page in to my own server and try to solve it.
__________________
Currently Reading: Please login or register to view this content. Registration is FREE
Last edited by Lashtal; 07-31-2010 at 11:30 PM..
|