puregeenius Posted February 16, 2007 Share Posted February 16, 2007 hey guys im creating a beta site, and wanted to create a fake account so the user can log in and get a feel for the site. I dont really want to get involved in sessions etc as it is only an idea at the moment, so a redirection script or something would be fine, i.e. if the client types in the right u/n (maybe not even p/w) it will redirect them to the profile, if they type the wrong u/n it sends them to an error page... if you can help it would be much appreciated. Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted February 16, 2007 Share Posted February 16, 2007 Why not just display everything that doesn't need kept secret. Then if your logged in it grants you access to the pages you need kept secure. This way they can still roam around and check things out and at the same time you can keep secure data secure. Quote Link to comment Share on other sites More sharing options...
Archadian Posted February 16, 2007 Share Posted February 16, 2007 the redirect i use is this: echo "<META http-equiv=\"refresh\" content=\"1;URL=../index.php\">"; content=\"1 being the seconds it takes for it to redirect And about your Username and/or password, just set one in your database and do something like this: $result = mysql_query("SELECT id, usern, passw FROM users WHERE usern = '$user' OR passw = '$pass'", $db) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); then just check to see if the Username and/or password matches the one in your DB such as in this code above: if ($_POST['username'] == $row['usern']) { // the redirect that redirects them to the correct page } else { // the redirect that redirects them back to the login with an error message or an error page that you create with an error message linking them back to the login } Quote Link to comment Share on other sites More sharing options...
superuser2 Posted February 16, 2007 Share Posted February 16, 2007 You can also use a header redirect, however this requires that there is no output before it. To do a header redirect, simply do this header("Location: fileToRedirectTo.php"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.