...

View Full Version : Help me with this PHP Script



greek_hyperion
10-12-2003, 05:47 PM
When I try to run my PHP registration script I get a bunch of blocks and o's can some one help! Take a look
Http://www.redwarning.net/reg.php If you need the script I can e-mail it to you. If you can help please e-mail me. Jusitn@redwarning.net Thanks!

bcarl314
10-12-2003, 05:56 PM
You don't have php set up on the server.

Notice the title <?php echo $page_title; ?>

greek_hyperion
10-12-2003, 06:05 PM
No php is there. The origional script is nothing but php and it runs. I think the title did that because I didn't setup a macro to handle .inc file types. I called that html from an include. Have any more ideas??

bcarl314
10-13-2003, 01:10 AM
Well, beyond that, you'll have to post the code for more help.

Also, take a look at the forum guidelines. Subject could be better worded.

greek_hyperion
10-13-2003, 01:24 AM
<?php #script 1.0 - php reg

$page_title='register';
include ('incs/header.inc');

if(isset($_POST['submit'])) {

$message = NULL;

if (empty($_POST['f_name'])) {
$fn = FALSE;
$message .= '<p>You forgot to enter a first name!</p>';
} else {
$fn = $_POST['f_name'];
}


if (empty($_POST['l_name'])) {
$ln = FALSE;
$message .= '<p>You forgot to enter a last name!</p>';
} else {
$ln = $_POST['l_name'];
}


if (empty($_POST['email'])) {
$e = FALSE;
$message .= '<p>You forgot to enter an e-mail address!</p>';
} else {
$e = $_POST['email'];
}


if (empty($_POST['username'])) {
$u = FALSE;
$message .= '<p>You forgot to enter a username!</p>';
} else {
$u = $_POST['f_name'];
}


if (empty($_POST['pass1'])) {
$p = FALSE;
$message .= '<p>You forgot to enter a password!</p>';
} else {
if ($_POST['pass1'] == $_POST['pass2']) {
$p = FLASE;
$message .= '<p>Your password did not match the confimed password</p>';
}
}

if ($fn && $ln && $e && $u && $p) {
require_once ('incs/connect.php');


$query = "INSERT INTO users (username, f_name, l_name, email, password, reg_date) VALUES ('$u', '$fn' '$ln', '$e', PASSWORD('$p'), NOW() )";
$result = @mysql_query ($query);
if ($result) {

echo '<p><b> You have been registered!</b></p>';
include ('incs/footer.inc');
exit();
} else {
$message .= '<P>.mysql_error().</p>';
}

msql_close();

}else{
$message .= '<p>Please try again</p>';
}

}
if (isset($message)) {
echo '<font color="red">', $message, '</font>';

}
?>



<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset><legend>Enter info below</legend>

<p>First Name: <input type="text" name="f_name" size="15" maxlength="15" value="<?php if (isset($_POST['f_name'])) echo $_POST['f_name']; ?>" /></p>
<BR>
<p>Last Name: <input type="text" name="l_name" size="20" maxlength="20" value="<?php if (isset($_POST['l_name'])) echo $_POST['l_name']; ?>" /></p>
<BR>
<p>E-mail: <input type="text" name="email" size="20" maxlength="20" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p>
<BR>
<p>Username: <input type="text" name="username" size="15" maxlength="15" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></p>
<BR>
<p>Password: <input type="password" name="pass1" size="8" maxlength="8"/></p>
<BR>
<p>Confirm Password: <input type="password" name="pass2" size="8" maxlength="8"/></p>
<center> <input type="submit" name="submit" value="Register"/> </center> </fieldset> </form>
<?php
inculde ('incs/footer.inc');
?>

SDP2006
10-13-2003, 03:11 AM
those blocks and junk could be a result of not <hmtl> tag's or no declaration of DTD

Len Whistler
10-13-2003, 03:14 AM
<?php #script 1.0 - php reg

$page_title='register';
include ('incs/header.inc');

if(isset($_POST['submit'])) {

$message = NULL;

if (empty($_POST['f_name'])) {
$fn = FALSE;
$message .= '<p>You forgot to enter a first name!</p>';
} else {
$fn = $_POST['f_name'];
}


if (empty($_POST['l_name'])) {
$ln = FALSE;
$message .= '<p>You forgot to enter a last name!</p>';
} else {
$ln = $_POST['l_name'];
}


if (empty($_POST['email'])) {
$e = FALSE;
$message .= '<p>You forgot to enter an e-mail address!</p>';
} else {
$e = $_POST['email'];
}


if (empty($_POST['username'])) {
$u = FALSE;
$message .= '<p>You forgot to enter a username!</p>';
} else {
$u = $_POST['f_name'];
}


if (empty($_POST['pass1'])) {
$p = FALSE;
$message .= '<p>You forgot to enter a password!</p>';
} else {
if ($_POST['pass1'] == $_POST['pass2']) {
$p = FLASE;
$message .= '<p>Your password did not match the confimed password</p>';
}
}

if ($fn && $ln && $e && $u && $p) {
require_once ('incs/connect.php');


$query = "INSERT INTO users (username, f_name, l_name, email, password, reg_date) VALUES ('$u', '$fn' '$ln', '$e', PASSWORD('$p'), NOW() )";
$result = @mysql_query ($query);
if ($result) {

echo '<p><b> You have been registered!</b></p>';
include ('incs/footer.inc');
exit();
} else {
$message .= '<P>.mysql_error().</p>';
}

msql_close();

}else{
$message .= '<p>Please try again</p>';
}

}
if (isset($message)) {
echo '<font color="red">', $message, '</font>';

}
?>



<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset><legend>Enter info below</legend>

<p>First Name: <input type="text" name="f_name" size="15" maxlength="15" value="<?php if (isset($_POST['f_name'])) echo $_POST['f_name']; ?>" /></p>
<BR>
<p>Last Name: <input type="text" name="l_name" size="20" maxlength="20" value="<?php if (isset($_POST['l_name'])) echo $_POST['l_name']; ?>" /></p>
<BR>
<p>E-mail: <input type="text" name="email" size="20" maxlength="20" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p>
<BR>
<p>Username: <input type="text" name="username" size="15" maxlength="15" value="<?php if (isset($_POST['username'])) echo $_POST['username']; ?>" /></p>
<BR>
<p>Password: <input type="password" name="pass1" size="8" maxlength="8"/></p>
<BR>
<p>Confirm Password: <input type="password" name="pass2" size="8" maxlength="8"/></p>
<center> <input type="submit" name="submit" value="Register"/> </center> </fieldset> </form>
<?php
inculde ('incs/footer.inc');
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum