Jump to content


Welcome table, replaced with error table?

  • Please log in to reply
3 replies to this topic

#1 Gregg

  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 28 August 2006 - 01:44 AM

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.
/* Check User Script */
session_start();  // Start Session

include 'db.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];

if((!$username) || (!$password)){
    echo "Welcome, please login!<br />";
    include 'login_form.html';

// 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['first_name'] = $first_name;
        $_SESSION['last_name'] = $last_name;
        $_SESSION['email_address'] = $email_address;
        $_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';

Like DEFAULT= Welcome, blablablabla...

#2 wompas.dub

  • Members
  • PipPip
  • Member
  • 10 posts

Posted 28 August 2006 - 01:46 AM

Try using a CSS template.

#3 radar

  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 28 August 2006 - 02:46 AM

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...

#4 Gregg

  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 28 August 2006 - 04:40 AM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users