...

View Full Version : html_header() still valid?



XiledWeb
12-31-2006, 07:36 AM
Hi guys, seems I've been posting a slew of questions here lately and learning a heck of a lot. :)

My quest for a login script is almost complete - I've been working on it non-stop today and I'm just about to head off to bed. But, before I go, I would like to know if
html_header() and
html_footer() are still valid?

For instance, in my login script as follows:


<?php
//register.php
include_once "./common_db.inc";

function in_use($userid)
{
global $user_tablename;

$query = "SELECT userid FROM $user_tablename WHERE userid = '$userid'";
$result = mysql_query($query);
if(!mysql_num_rows($result)){
return 0;
}else{
return 1;
}
}
?>

<p>Create Your Account</p>
<div id="dbform">
<form method="post" action="<?php echo $PHP_SELF ?>">
<input type="hidden" name="action">
<label>User ID:<input type="text" name="userid" size="10" maxlength="10"></label><br />
<label>Password:<input type="password" name="userpassword" size="15"></label><br />
<label>Retype Password:<input type="password" name="userpassword2" size="15"></label><br />
<label>Full Name:<input type="text" name="username" size="20"></label><br />
<label>Email:<input type="text" name="useremail" size="20"></label><br />
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</div>

<?php

function create_account()
{
$userid = $_POST['userid'];
$username = $_POST['username'];
$userpassword = $_POST['userpassword'];
$userpassword2 = $_POST['userpassword2'];
$useremail = $_POST['useremail'];
global $default_dbname, $user_tablename;

if(empty($userid)){
error_message("Enter your desired User ID!");
}
if(empty($userpassword)){
error_message("Enter your desired password!");
}
if(strlen($userpassword) < 4) {
error_message("Password too short!");
}
if(empty($userpassword2)) {
error_message("Retype your password for verification!");
}
if(empty($username)) {
error_message("Enter your full name!");
}
if(empty($useremail)) {
error_message("Enter your email address!");
}
if($userpassword != $userpassword2) {
error_message("Your desired password and retyped password mismatch!");
}
$link_id = db_connect ($default_dbname);

if(in_use($userid)) {
error_message("$userid is in use. Please choose a different ID.");
}

$query = "INSERT INTO user VALUES(NULL, '$userid', password('$userpassword'),
'$username', '$useremail')";
$result = mysql_query($query);
if(!$result){
error_message(sql_error());
}
$usernumber = mysql_insert_id($link_id);
html_header();
?>
<center><h3>
<p><?php echo $username ?>, thanks for registering with us!</p></h3></center>
<div align="center"><center><table border="1" width="90%">
<tr>
<th width="30%" nowrap>User Number</TH>
<td width="70%"><?php echo $usernumber ?></td>
</tr>
<tr>
<th width="30%" nowrap>UserID</th>
<td width="70%"><?php echo $userid ?></td>
</tr>
<tr>
<th width="30%" nowrap>Password</th>
<td width="70%"><?php echo $userpassword ?></td>
</tr>
<tr>
<th width="30%" nowrap>Full Name</th>
<td width="70%"><?php echo $username ?></td>
</tr>
<tr>
<th width="30%" nowrap>Email</th>
<td width="70%"><?php echo $useremail ?></td>
</tr>
</table>
</center>
<?php
html_footer();
}

if (empty($_POST)) {
$_POST['action'] = "";
}
switch($_POST['action']) {
case "register":
create_account();
break;
default:
html_header();
register_form();
html_footer();
break;
}
?>

When the page is loaded, the error underneath the form is
Fatal error: Unknown function: html_header() in /home/xile/public_html/css/register.php on line 115

_Aerospace_Eng_
12-31-2006, 07:42 AM
There are no such existing functions. Where did you come up with those? For those to work you would need to create your own html_header() and html_footer() functions.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum