a code block is a block of php code. it's usually whats inside the '<?' and the '?>'.
stuff that is outside the '<?' and '?>' is a html block.
It sounds to me like you're not familiar with either php or html, which means you probably are unable to follow what the parts of the source are doing in a general manner, which will make it difficult to help you.
But lets try:
in your first file (apparently main.php, from the comments) It first has:
include("include/session.php");
this needs to be the first thing on your page, and inside a 'php block', ie:
<?
include("include/session.php");
?>
And I'm assuming it contains something like:
<?
session_start();
?>
which is all you really need (and making this a seperate include file for just one line of code is excessive)
the next part of the source code:
<?
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>";
echo "Welcome <b>$session->username</b> <br><br>"
."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "
."[<a href=\"useredit.php\">Edit Account</a>] ";
if($session->isAdmin()){
echo "[<a href=\"admin/admin.php\">Admin Center</a>] ";
}
echo "[<a href=\"process.php\">Logout</a>]";
}
else{
?>
<h1>Login</h1>
<?
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>
Not registered? <a href="register.php">Sign-Up</a></td>
</tr>
</table>
</form>
<?
}
?>
Is where it checks if you are logged in:
if($session->logged_in)
and if so, runs the code insice the set of curly braces ({}).
then there is the else block inside it's curly braces, which is what happens if the user is not logged in (ie. it shows the html form)
It appears the 'logged in' section also has an admin check for a higher access level of user.
It appears the key parts of logging in are 3 html form inputs: user pass and remember - the first 2 being text inputs, the latter being a checkbox.
The code provided will automatically pre-populate them with the last entered information in case of failure.
the form posts to process.php so whatever is in process.php you need to be in any page that you want to verify login on. (I usually have it on the same page)
when logged in the user gets extra menu options: a link to manage their account, a link to admin if they are an admin user and a link to the processor which apparently will log them out.
This looks like more than a basic login handler, and may not integrate into your site exactly as you want, as it seems to rely on sending people to specific places to handle them, and if you have limited html/php knowledge, you will probably run into problems getting them back to where they need to be, but hopefully some of this post will help you out.