hi, sound like i'm a begger in the subject area lol. Anyway, just started learning php, cant say that i'm finding it easy but i'm struggling along. I have several questions which would be great if anyone had some advice to:
Does a php page have to include "head.inc" and "foot.inc"?
How is the layout of a page controlled, is it through normal html and then the php code "interactivity" added, or is the layout of the page also controlled by php?
Below is the index of an open source counter that i downloaded to try and learn from, what i am trying to do is adjust things in it to see if what i do works or not. On the index i have not been able to extract for example the login php script, cos what i want to do is design a nice index page and then simply add the login script.
Any advice, ideas, pointers or anything would be appreciated.
Leo
🙂
<?php
include "main_location.inc";
if (defined('PHP_SESS')) {
session_start();
session_destroy();
} else {
setcookie("username", "", time() - 3600);
setcookie("password", "", time() - 3600);
}
$view = 'loginout'; $setfocus = 'login_form.usr';
include="head.inc";
?>
<p> </p>
<p> </p>
<table align="center" cellpadding="3" cellspacing="0" class="color2" border="0">
<tr>
<td class="color3"><b>counter login</b></td>
</tr>
<tr>
<td>
<?php
if (isset($wrongpw)) echo $strMsgWrongPw;
else if (isset($newpw)) echo $strMsgNewPw;
else echo $strEnterUsernPw.':<br />';
if ($md5form) {
?>
<script language="JavaScript" type="text/javascript"><!--
var html = "<form action=\"login.<?php echo CFG_PHPEXT; ?>\" name=\"login_form\" method=\"post\" onSubmit=\"return validateForm(this)\">\n" +
"<input type=\"hidden\" name=\"js_onoff\" value=\"on\" />\n" +
"<input type=\"hidden\" name=\"md5_pw\" value=\"\" />\n" +
"<label for=\"username\" accesskey=\"U\"><?php echo $strUsername; ?>: </label>\n" +
"<input size=\"15\" id=\"username\" class=\"myInput\" type=\"text\" name=\"usr\" tabindex=\"1\" />\n" +
"<label for=\"password\" accesskey=\"P\"><?php echo $strPassword; ?>: </label>\n" +
"<input size=\"8\" id=\"password\" class=\"myInput\" type=\"password\" name=\"pw\" tabindex=\"2\" /> \n" +
"<input class=\"myInput\" type=\"submit\" value=\"Login\" name=\"submit\" />\n" +
"</form>\n";
document.open();
document.write(html);
document.close();
//-->
</script>
<noscript>
<?php
} // if (md5form)
?>
<form action="login.<?php echo CFG_PHPEXT; ?>" name="login_form" method="post">
<label for="username" accesskey="U"><?php echo $strUsername; ?>: </label>
<input size="15" id="username" class="myInput" type="text" name="usr" tabindex="1" />
<label for="password" accesskey="P"><?php echo $strPassword; ?>: </label>
<input size="8" id="password" class="myInput" type="password" name="pw" tabindex="2" />
<input class="myInput" type="submit" value="Login" name="submit" />
</form>
<?php
if ($md5form) echo '</noscript>';
?>
<br /><br />
<?php echo $strLostPw; ?> <a href="dspNewPw.<?php echo CFG_PHPEXT; ?>"><?php echo $strLinkNewPw; ?></a>
</td>
</tr>
</table>
<p> </p>
<?php
// hide the signup-section if signup_ok = false (set this in /admin/setup.php)
if ($signup_ok) {
?>
<table cellpadding="3" cellspacing="0" class="color2" border="0" align="center">
<tr>
<td class="color3"><b><?php echo $strGetFreeAccount; ?></b></td>
</tr>
<tr>
<td><a href="dspSignup.<?php echo CFG_PHPEXT; ?>"><?php echo $strSignUpUseracc; ?></a></td>
</tr>
</table>
<?php
} // if ($signup_ok)
?>
<p> </p>
<p> </p>
<?php
include INC_FOOT;
?>🙂 🙂