I found this form on the scripts. However when I attemp to open the php file on the sever I get a error message Parse error: syntax error, unexpected $end on line 238
[PHP]<?
/**
* Main.php
*
* This is an example of the main page of a website. Here
* users will be able to login. However, like on most sites
* the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether
* the user has logged in or not.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("includ e/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
body {
margin-top: 0px;
color: #cccccc;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
font-weight: normal;
letter-spacing: 0px;
word-spacing: 0px;
background-color: #ffffff;
}
#content {
color: #cccccc;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
font-weight: normal;
letter-spacing: 0px;
word-spacing: 0px;
border-left: 1px #cccccc solid;
border-right: 1px #cccccc solid;
border-bottom: 1px #cccccc solid;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FORM1</title>
</head>
<?
/**
* 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"
<body>
<table width=\"500\" border=\"0\" align=\"center\ " cellpadding=\"0 \"
cellspacing=\"0 \">
<tr>
<td align=\"center\ ">
<?php
// Connect to database
$usr = 'xxxxxx';
$pwd = 'xxxxxx';
$db = 'xxxxxx';
$host = 'localhost';
# connect to database
$cid = mysql_connect($ host,$usr,$pwd) ;
mysql_select_db ($db);
if (mysql_error()) { print 'Database ERROR: ' . mysql_error(); }
##### Check if form was Submitted #####
if($_POST[mode]== add ){
### Retrieve the variables ###
if($_POST[firstname] =='' ){
$error = '* Please fill in First Name #1<br>';
}else{
$firstname = $_POST[firstname];
}
if($_POST[lastname] == ''){
$error .= '* Please fill in Last Name #2<br>';
}else{
$lastname = $_POST[lastname];
}
if($_POST[phonenumber] == ''){
$error .= '* Please fill in Phone Number #2<br>';
}else{
$phonenumber = $_POST[phonenumber];
}
if($_POST[state] == ''){
$error .= '* Please fill in Last State #2<br>';
}else{
$state = $_POST[state];
}
if($_POST[category] == ''){
$error .= '* Please fill in Category #2<br>';
}else{
$category = $_POST[category];
}
if($_POST[artistname] == ''){
$error .= '* Please fill in Artist Name #2<br>';
}else{
$artistname = $_POST[artistname];
}
if($_POST[tracktitle] == ''){
$error .= '* Please fill in Track Title #2<br>';
}else{
$tracktitle = $_POST[tracktitle];
}
if($_FILES[file][name] == ''){
$error .= '* Please select a File to upload<br>';
}else{
$file_name = $_FILES[file][name];
/* Process file*/
}
### If fields are valid then attempt an insert ###
### If not set $error and bypass the insert ###
if(!isset($erro r)){
$insert = 'INSERT INTO $talent(firstna me, lastname, phonenumber, state, category, artistname, tracktitle, $username) values (
'$firstname',
'$lastname',
'$phonenumber',
'$email',
'$state',
'$category',
'$artistname',
'$tracktitle',
'$state',
'$category',
'$file_name'
'$username',)';
if(!$result = mysql_query($in sert)){
$error .= 'Error in inserting<br>';
}else{ ### If insert goes well, redirect to another page ###
?>
<script language=\"Java Script\">
<!--
self.location=' <?php echo 'confirmation.p hp';?>'
//-->
</script>
<?
}//if(!isset($erro r)){
### If there was an error display it ###
if(isset($error )){
echo '<table width=\"300\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 \">';
echo '<tr>';
echo '<td bgcolor=\"#FF00 00\">'.$error.' </td>';
echo '</tr>';
echo '</table>';
}
}//if($_POST[mode] == add){
?>
<form action=\". '$HTTP_SERVER_V ARS[PHP_SELF]'.\"
method=\"post\" enctype=\"multi part/form-data\" name=\"add_fiel ds\"
id=\"add_fields \">
<table width=\"350\" border=\"0\" cellspacing=\"0 \" cellpadding=\"0 \" class=\"content \">
<tr>
<td width=\"120\" align=\"left\"> First Name: </td>
<td width=\"130\" align=\"right\" ><input name=\"firstnam e\" type=\"text\" id=\"firstname\ " value=\"<?php
echo $firstname;?>\" ></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Last Name: </td>
<td width=\"130\"al ign=\"right\">< input name=\"lastname \" type=\"text\" id=\"lastname\" value=\"<?php
echo $lastname;?>\"> </td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Phone Number: </td>
<td width=\"130\"al ign=\"right\">< input name=\"phonenum ber\" type=\"text\" id=\"phonenumbe r\" value=\"<?php
echo $phonenumber;?> \"></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> State: </td>
<td width=\"130\"al ign=\"right\">< input name=\"state\" type=\"text\" id=\"state\" value=\"<?php
echo $state;?>\"></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Category: </td>
<td width=\"130\"al ign=\"right\">< input name=\"category \" type=\"text\" id=\"category\" value=\"<?php
echo $category;?>\"> </td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Artist Name: </td>
<td width=\"130\"al ign=\"right\">< input name=\"artistna me\" type=\"text\" id=\"artistname \" value=\"<?php
echo $artistname;?>\ "></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Track Title: </td>
<td width=\"130\"al ign=\"right\">< input name=\"tracktit le\" type=\"text\" id=\"tracktitle \" value=\"<?php
echo $tracktitle;?>\ "></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Audio Upload: </td>
<td width=\"130\" align=\"right\" ><input type=\"file\" name=\"file\">
<br><?php echo $file_name;?></td>
</tr>
<tr align=\"center\ ">
<td colspan=\"2\">< input type=\"submit\" name=\"Submit\"
value=\"Submit\ ">
<input type=\"reset\" name=\"Submit2\ " value=\"Cancel\ "
onClick=\"self. location='redir ect.php'\">
<input name=\"mode\" type=\"hidden\" id=\"mode\" value=\"add\"> </td>
</tr>
</table>
</form></td>
</tr>
</table>
';
else{
/**
* 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>';
}
?>
<table width=\"310\">
<tr>
<td><img src=\"http://www.atlantasund ergroundhitseco mmerce.com/ATL_version2/Login_System_v. 2.0/Login_System_v. 2.1/images/audioload.gif \" width=\"340\" height=\"180\" border=\"1\" alt=\"fast track with atl hits\"></td>
</tr>
</table>
<form action=\"proces s.php\" method=\"POST\" >
<table align=\"left\" border=\"0\" cellspacing=\"0 \" cellpadding=\"3 \" class=\"T1\">
<tr><td>Usernam e:</td><td><input type=\"text\" name=\"user\" maxlength=\"30\ " value=\"<? echo $form->value('user' ); ?>\"></td><td><? echo $form->error('user' ); ?></td></tr>
<tr><td>Passwor d:</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('remembe r') != ''){ echo 'checked'; } ?>>
<font size=\"2\">Reme mber me next time &nb sp;
<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 class=\"T1\" href=\"forgotpa ss.php\">Forgot Password?</a>]</font></td><td align=\"right\" ></td></tr>
<tr><td colspan=\"2\" align=\"left\"> <br>Not registered? <a class=\"T1\" href=\"register .php\">Sign-Up!</a></td></tr>
</table>
</form>[/PHP]
I played around with it for a few days any insight would be great...
[PHP]<?
/**
* Main.php
*
* This is an example of the main page of a website. Here
* users will be able to login. However, like on most sites
* the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether
* the user has logged in or not.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 26, 2004
*/
include("includ e/session.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<style>
body {
margin-top: 0px;
color: #cccccc;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
font-weight: normal;
letter-spacing: 0px;
word-spacing: 0px;
background-color: #ffffff;
}
#content {
color: #cccccc;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 10px;
font-weight: normal;
letter-spacing: 0px;
word-spacing: 0px;
border-left: 1px #cccccc solid;
border-right: 1px #cccccc solid;
border-bottom: 1px #cccccc solid;
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FORM1</title>
</head>
<?
/**
* 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"
<body>
<table width=\"500\" border=\"0\" align=\"center\ " cellpadding=\"0 \"
cellspacing=\"0 \">
<tr>
<td align=\"center\ ">
<?php
// Connect to database
$usr = 'xxxxxx';
$pwd = 'xxxxxx';
$db = 'xxxxxx';
$host = 'localhost';
# connect to database
$cid = mysql_connect($ host,$usr,$pwd) ;
mysql_select_db ($db);
if (mysql_error()) { print 'Database ERROR: ' . mysql_error(); }
##### Check if form was Submitted #####
if($_POST[mode]== add ){
### Retrieve the variables ###
if($_POST[firstname] =='' ){
$error = '* Please fill in First Name #1<br>';
}else{
$firstname = $_POST[firstname];
}
if($_POST[lastname] == ''){
$error .= '* Please fill in Last Name #2<br>';
}else{
$lastname = $_POST[lastname];
}
if($_POST[phonenumber] == ''){
$error .= '* Please fill in Phone Number #2<br>';
}else{
$phonenumber = $_POST[phonenumber];
}
if($_POST[state] == ''){
$error .= '* Please fill in Last State #2<br>';
}else{
$state = $_POST[state];
}
if($_POST[category] == ''){
$error .= '* Please fill in Category #2<br>';
}else{
$category = $_POST[category];
}
if($_POST[artistname] == ''){
$error .= '* Please fill in Artist Name #2<br>';
}else{
$artistname = $_POST[artistname];
}
if($_POST[tracktitle] == ''){
$error .= '* Please fill in Track Title #2<br>';
}else{
$tracktitle = $_POST[tracktitle];
}
if($_FILES[file][name] == ''){
$error .= '* Please select a File to upload<br>';
}else{
$file_name = $_FILES[file][name];
/* Process file*/
}
### If fields are valid then attempt an insert ###
### If not set $error and bypass the insert ###
if(!isset($erro r)){
$insert = 'INSERT INTO $talent(firstna me, lastname, phonenumber, state, category, artistname, tracktitle, $username) values (
'$firstname',
'$lastname',
'$phonenumber',
'$email',
'$state',
'$category',
'$artistname',
'$tracktitle',
'$state',
'$category',
'$file_name'
'$username',)';
if(!$result = mysql_query($in sert)){
$error .= 'Error in inserting<br>';
}else{ ### If insert goes well, redirect to another page ###
?>
<script language=\"Java Script\">
<!--
self.location=' <?php echo 'confirmation.p hp';?>'
//-->
</script>
<?
}//if(!isset($erro r)){
### If there was an error display it ###
if(isset($error )){
echo '<table width=\"300\" border=\"0\" cellspacing=\"0 \"
cellpadding=\"0 \">';
echo '<tr>';
echo '<td bgcolor=\"#FF00 00\">'.$error.' </td>';
echo '</tr>';
echo '</table>';
}
}//if($_POST[mode] == add){
?>
<form action=\". '$HTTP_SERVER_V ARS[PHP_SELF]'.\"
method=\"post\" enctype=\"multi part/form-data\" name=\"add_fiel ds\"
id=\"add_fields \">
<table width=\"350\" border=\"0\" cellspacing=\"0 \" cellpadding=\"0 \" class=\"content \">
<tr>
<td width=\"120\" align=\"left\"> First Name: </td>
<td width=\"130\" align=\"right\" ><input name=\"firstnam e\" type=\"text\" id=\"firstname\ " value=\"<?php
echo $firstname;?>\" ></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Last Name: </td>
<td width=\"130\"al ign=\"right\">< input name=\"lastname \" type=\"text\" id=\"lastname\" value=\"<?php
echo $lastname;?>\"> </td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Phone Number: </td>
<td width=\"130\"al ign=\"right\">< input name=\"phonenum ber\" type=\"text\" id=\"phonenumbe r\" value=\"<?php
echo $phonenumber;?> \"></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> State: </td>
<td width=\"130\"al ign=\"right\">< input name=\"state\" type=\"text\" id=\"state\" value=\"<?php
echo $state;?>\"></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Category: </td>
<td width=\"130\"al ign=\"right\">< input name=\"category \" type=\"text\" id=\"category\" value=\"<?php
echo $category;?>\"> </td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Artist Name: </td>
<td width=\"130\"al ign=\"right\">< input name=\"artistna me\" type=\"text\" id=\"artistname \" value=\"<?php
echo $artistname;?>\ "></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Track Title: </td>
<td width=\"130\"al ign=\"right\">< input name=\"tracktit le\" type=\"text\" id=\"tracktitle \" value=\"<?php
echo $tracktitle;?>\ "></td>
</tr>
<tr>
<td width=\"120\" align=\"left\"> Audio Upload: </td>
<td width=\"130\" align=\"right\" ><input type=\"file\" name=\"file\">
<br><?php echo $file_name;?></td>
</tr>
<tr align=\"center\ ">
<td colspan=\"2\">< input type=\"submit\" name=\"Submit\"
value=\"Submit\ ">
<input type=\"reset\" name=\"Submit2\ " value=\"Cancel\ "
onClick=\"self. location='redir ect.php'\">
<input name=\"mode\" type=\"hidden\" id=\"mode\" value=\"add\"> </td>
</tr>
</table>
</form></td>
</tr>
</table>
';
else{
/**
* 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>';
}
?>
<table width=\"310\">
<tr>
<td><img src=\"http://www.atlantasund ergroundhitseco mmerce.com/ATL_version2/Login_System_v. 2.0/Login_System_v. 2.1/images/audioload.gif \" width=\"340\" height=\"180\" border=\"1\" alt=\"fast track with atl hits\"></td>
</tr>
</table>
<form action=\"proces s.php\" method=\"POST\" >
<table align=\"left\" border=\"0\" cellspacing=\"0 \" cellpadding=\"3 \" class=\"T1\">
<tr><td>Usernam e:</td><td><input type=\"text\" name=\"user\" maxlength=\"30\ " value=\"<? echo $form->value('user' ); ?>\"></td><td><? echo $form->error('user' ); ?></td></tr>
<tr><td>Passwor d:</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('remembe r') != ''){ echo 'checked'; } ?>>
<font size=\"2\">Reme mber me next time &nb sp;
<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 class=\"T1\" href=\"forgotpa ss.php\">Forgot Password?</a>]</font></td><td align=\"right\" ></td></tr>
<tr><td colspan=\"2\" align=\"left\"> <br>Not registered? <a class=\"T1\" href=\"register .php\">Sign-Up!</a></td></tr>
</table>
</form>[/PHP]
I played around with it for a few days any insight would be great...
Comment