Gregg Posted August 28, 2006 Share Posted August 28, 2006 Ok, in the login form i would like to make it so when they hit the page it has a table above the form saying Welcome... blablabla.And if they submit the for and get an error it replaces the welcome message with the error message in the center of that table instead of allways top left lol!I want to know how to ad the welcome message and how to get it to show up where i want it.[code]<?/* Check User Script */session_start(); // Start Sessioninclude 'db.php';// Conver to simple variables$username = $_POST['username'];$password = $_POST['password'];if((!$username) || (!$password)){ echo "Welcome, please login!<br />"; include 'login_form.html'; exit();}// Convert password to md5 hash$password = md5($password);// check if the user info validates the db$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");$login_check = mysql_num_rows($sql);if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; session_register('email_address'); $_SESSION['email_address'] = $email_address; session_register('special_user'); $_SESSION['user_level'] = $user_level; mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'"); header("Location: login_success.php"); }} else { echo "You could not be logged in, either the Username/Password do not match,<br> our records.. Or you have not Validated your Membership with us yet!<br />"; include 'login_form.html';}?>[/code]Like DEFAULT= Welcome, blablablabla...Error=thetext. Quote Link to comment Share on other sites More sharing options...
wompas.dub Posted August 28, 2006 Share Posted August 28, 2006 Try using a CSS template. Quote Link to comment Share on other sites More sharing options...
radar Posted August 28, 2006 Share Posted August 28, 2006 OOP Templating engines... try using one called FastTemplate -- but if you get that one you want the one that was written for php3.. you have to go in and rename one of the functions as they try to recall it twice.. but ya just rename the second one by putting a 1 at the end... Another option would be to use Smarty.. http://www.php.net/smarty I think that is the url to smarty.. its a templating engine we use at work.. only problem is youve got to get it on your server.. FastTemplate is easier to impliment as it is only 1 file.. From that you can do just about anything you want... Quote Link to comment Share on other sites More sharing options...
Gregg Posted August 28, 2006 Author Share Posted August 28, 2006 What i ment was just a simple php sniplet i could place anywhere so it wont move and distort the template.Like this:<? echo $Message or print;?> something to that afect. 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.