Page 2 of 2

Posted: Wed Jun 07, 2006 4:26 pm
by Christopher
Simplified, but maybe something like:

Code: Select all

$content = '';
     $link = mysql_connect( $host, $user, $pass );
     mysql_select_db( $dbname );
     if( $errmsg = mysql_error($link)){
          $content .= error("Could not connect to database. ($errmsg)");
     } else {
         $username = trim($_POST['username']);
         $userpass =  trim($_POST['userpass']);
         $query = "SELECT * FROM $table WHERE username = '$username' AND userpass = '$userpass'";
         $result = mysql_query( $query );
         if( !$result ){
               $content .= error('You are not registered.');
         } else{
               $content .= Success();
         }
         mysql_free_result( $result );
         mysql_close( $link );
     }

     include 'mypagetemplate.php';
mypagetemplate.php:

Code: Select all

<html>
<head>
.....
</head>
<body>
- header here

-- left nav bar here

<?php echo $content; ?>

-- footer here
</body>
</html>

Posted: Wed Jun 07, 2006 5:04 pm
by daedalus__
Sorry, I didn't read any of the code. Usually when I am using error surpression, it is for one reason:

Code: Select all

if (@include() == 0)
{
    echo $error_message;
}
If the @ is ommited the default error message still pops through and that is unhappy for me.