You are here: Parse error: parse error, unexpected $end « PHP Programming Language « IT news, forums, messages
Parse error: parse error, unexpected $end

Posted by Ehartwig on 11/05/05 06:56

I recently created a script for user verification, solved my emailing
issues, and then re-created the script in order to work well with the
new PHP 5 that I installed on my server. After submitting user
information into my creation script, I get the following error from the
page that is suppose to insert the user data into the database, create
a code, then send an email out for verification.

Parse error: parse error, unexpected $end in
c:\wamp\www\thread\create\add2tbl.php on line 31

Below are the files in which I am using:

add2tbl.php

<?php
require "mailfunctions.php";
$username = $_POST['username'];
$md5password2 = md5($_POST['pass2']);
$email = $_POST['email'];
$md5password = md5($_POST['pass']);
if(isset($_POST['username'])) {
if ($md5password == $md5password2) {
$db = dbc();
$code = codegen();
$user = insertuser($username, $md5password, $email, $code);
if ($user == FALSE) {
die("There has been an error in adding you to the Database. Please
EMail the admin.");
}
else {
echo "<b>Passwords do not match!</b> ";
}
include("/top.html");

$mail = mailauth($username);
if ($mail) {
echo '
<p class = "subtitle">Success! Check your email.</p>';
} else {
echo '
<p class = "subtitle">We are sorry. The request did not go through
successfully due to an error in the Mail server. Please contact the
Admin.</p>';

}
include("/bottom.html");
}
?>

mailfunctions.php

<?php
function dbc() {
mysql_connect(localhost, "root");
mysql_select_db("ehartwig1");
return TRUE;
}
function codegen() {
$code = rand(10000000000000,999999999999999);
return $code;
}
function insertuser($name,$md5password,$email,$code) {
$query = "INSERT INTO threadauth (username, password, email,
authcode) VALUES ('{$name}','{$md5password}','{$email}', '{$code}') or
return(FALSE)";
$result = mysql_db_query($query);
return $result;
}
function md5fetcher($name) {
$query = mysql_query("SELECT password FROM threadauth WHERE
username='".$name."');
$result = mysql_fetch_array($query);
return $result['password'];
}
function mailfetcher($name) {
$query = mysql_query("SELECT email FROM threadauth WHERE
username='".$name."');
$result = mysql_fetch_array($query);
return $result['email'];
}

function codefetcher($name) {
$query = mysql_query("SELECT authcode FROM threadauth WHERE
username='".$name."');
$result = mysql_fetch_array($query);
return $result['authcode'];
}
function codecheck($name, $authcode) {
$code = codefetcher($name);
if ($code == $authcode) {
return TRUE;
}
else {
return FALSE;
}
}
function mailauth($username) {
$email = mailfetcher($username);
$code = codefetcher($username);
$message = "
Subscription Request
You have requested to receive a membership. You must follow the
link and insert the code provided in order to activate your account.

Username: {$username}
Activation Code: {$code}
http://www.ehartwig.com/thread/activate.php?authcode={$code}&username={$username}

Thank You.";
mail($recipient, $subject, $message) or return(FALSE);
return(TRUE);
}
?>

How can I solve this problem or what should I do differently?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация