Well, this is my first ever try at making an install file, and it isn't going too well. I have the following code:
I get the following error when viewing it:PHP Code:<?
include "iconfig.php";
// DO NOT edit the following unless you know what you are doing
if ($_GET['step'] == '1') {
$query = mysql_query("CREATE TABLE `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL,
`password` varchar(500) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
$query = mysql_query("CREATE TABLE `petition` (
`id` INT( 20 ) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 30 ) NOT NULL ,
`other` VARCHAR( 30 ) NOT NULL ,
`comment` VARCHAR( 200 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `admin` (
`navigation` TEXT( 10000 ) NOT NULL ,
`maincontent` TEXT( 10000 ) NOT NULL ,
`php` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL ,
`footer` VARCHAR( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `home` (
`navigation` TEXT( 10000 ) NOT NULL ,
`maincontent` TEXT( 10000 ) NOT NULL ,
`php` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL ,
`footer` TEXT( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `other` (
`navigation` TEXT( 10000 ) NOT NULL ,
`maincontent` TEXT( 10000 ) NOT NULL ,
`php` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL ,
`footer` TEXT( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `sign` (
`navigation` TEXT( 10000 ) NOT NULL ,
`maincontent` TEXT( 10000 ) NOT NULL ,
`php` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL ,
`footer` TEXT( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `view` (
`navigation` TEXT( 10000 ) NOT NULL ,
`maincontent` TEXT( 10000 ) NOT NULL ,
`php` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL ,
`footer` TEXT( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("CREATE TABLE `titles` (
`home` TEXT( 10000 ) NOT NULL ,
`sign` TEXT( 10000 ) NOT NULL ,
`view` TEXT( 10000 ) NOT NULL ,
`other` TEXT( 10000 ) NOT NULL
) ENGINE = MYISAM");
$query = mysql_query("INSERT INTO `admin` (`navigation`, `maincontent`, `php`, `other`, `footer`) VALUES (Home | <a href=\"edit.php\">View + Edit Comments / Other Details</a> | <a href=\"editpage.php\">Edit Pages</a> | <a href=\"editsite.php\">Edit Site Details</a>, Welcome to the administration panel, use the links above to navigate your way through the panel., This is optional PHP, you don't really need it for the admin CP main page., This is where you put any other stuff, you can edit all of this using the Edit Site Pages link., Footer BBZ. Add your copyright etc. here.);");
$query = mysql_query("INSERT INTO `home` (`navigation`, `maincontent`, `php`, `other`, `footer`) VALUES (Home | <a href=\"sign.php\">Sign</a> <a href=\"view.php\">View Entries</a> | <a href=\"other.php\">Other</a>, Welcome! Edit all this text in the admin CP., This is optional PHP, you don't really need it for the main page., This is where you put any other stuff, you can edit all of this using the Edit Site Pages link., Footer BBZ. Add your copyright etc. here.);");
$query = mysql_query("INSERT INTO `sign` (`navigation`, `maincontent`, `php`, `other`, `footer`) VALUES (<a href=\"index.php\">Home</a> | Sign <a href=\"view.php\">View Entries</a> | <a href=\"other.php\">Other</a>, Welcome! Edit all this text in the admin CP. This is NOT where you stick the form, etc., <?php
// The database
include 'config.php';
// The variables
$name = ($_POST[\"name\"]);
$other = ($_POST[\"other\"]);
$comment = ($_POST[\"comment\"]);
$ip = $_SERVER[REMOTE_ADDR];
//Those horrible IF's - Form data
if ($_GET[\"action\"] == \"submit\")
{
if ($name == "")
{
echo \"Whoops! You didn't enter your name.\";
exit;
}
if ($comment== "")
{
echo \"Whoops! You didnt enter a comment.\";
exit;
}
$name = addslashes(htmlspecialchars($name));
$grade = addslashes(htmlspecialchars($grade));
$comment = addslashes(htmlspecialchars($comment));
$addpetition = mysql_query(\"INSERT INTO `petition` (`name`, `other`, `comment`, `ip`) VALUES ('$name','$other','$comment', '$ip')\");
// The form details are fine, display text & details
echo \"Thank you for signing the petition! Here are the details you submitted: <br />
Name: $name<br />
Other: $other<br />
Your comment: $comment<br />
<br />
To view all the signatures, click <a href=\"view.php\">here.</a> To go back to the home page, click <a href=\"index.php\">here.</a>\";
exit;
}
else
// Display the form
{
echo \"
<div align\"center\">Want Miss Oppedisano to stay at O.L.H? Sign the petition below. Your support is needed.<br />
<strong>Remember, only sign the petition once!</strong></div><br />
<br />
<form action=\"?action=submit\" method=\"post\">
<div id=\"title\">Name:</div>
<input type=\"text\" name=\"name\"><br /><br />
<div id=\"title\">Other (EDIT IN ADMIN CP):</div>
<input type=\"text\" name=\"other\"><br /><br />
<div id=\"title\">Comment:</div>
<style=\"width=\"169\"; height=\"116\"><textarea rows=\"7\" input type=\"text\" name=\"comment\" cols=\"28\"></textarea><br />
<input type=\"submit\" name=\"submit\" value=\"Sign the petition!\">
</form>\";
exit;
}
?>, This is where you put any other stuff, you can edit all of this using the Edit Site Pages link., Footer BBZ. Add your copyright etc. here.);");
exit;
}
$query = mysql_query("INSERT INTO `view` (`navigation`, `maincontent`, `php`, `other`, `footer`) VALUES (<a href=\"index.php\">Home</a> | <a href=\"sign.php\">Sign</a> View Entries | <a href=\"other.php\">Other</a>, Welcome! Edit all this text in the admin CP. This is NOT where you stick the form, etc., <?php
//DB connection
include \"config.php\";
// Display number of entries
$query = mysql_query(\"select count(*) from petition\");
$result = mysql_result($query, 0);
echo \"We have a total of <strong>$result</strong> signatures!\";
?>
<?php
// The database connetcion
include \"config.php\";
$sql = \"SELECT * FROM petition\";
$check = mysql_query(\"SELECT name, other, comment FROM petition\") or die(\"Sorry, the data couldn't be displayed. Please check back later.\");
// The above variables will be used to check our connection to MySQL.
while ($display = mysql_fetch_array($check)) {
$name = $display['name'];
$other = $display['other'];
$comment = $display['comment'];
// Above are variables defined for our Name, Gradeand Comment.
echo \"
<strong>Name:</strong> $name
<br>
<strong>Other:</strong> $other
<br>
<strong>Comment:</strong><br>$comment
<br>
____________________________________________________________<br /><br />
\";
}
?>, This is where you put any other stuff, you can edit all of this using the Edit Site Pages link., Footer BBZ. Add your copyright etc. here.);");
$query = mysql_query("INSERT INTO `other` (`navigation`, `maincontent`, `php`, `other`, `footer`) VALUES (<a href=\"index.php\">Home</a> | <a href=\"sign.php\">Sign</a> <a href=\"view.php\">View Entries</a> | Other, Welcome! Edit all this text in the admin CP. This is NOT where you stick the form, etc., This is optional PHP, you don't really need it for the other page. But it is other, so add whatever you want here., This is where you put any other stuff, you can edit all of this in the admin CP., Footer BBZ. Add your copyright etc. here.);");
echo ("Step 1 done! Now, please enter your desired username and password for admin CP.<br />
<form action=\"?step=2\" method=\"post\">
Username:<br />
<input type=\"text\" name=\"name\"><br />
Password:<br />
<input type=\"text\" name=\"password\"><br />
<input type=\"submit\" name=\"start\" value=\"Step 2\"></form>");
};
$user = ($_POST["username"]);
$pass = ($_POST["password"]);
$pass = md5($password);
elseif ($_GET['step'] == '2') {
$query = mysql_query("INSERT INTO `users` ( `uid` , `username` , `password` ) VALUES ( NULL, ‘$user’, ‘$pass‘ )");
};
else ("Welcome to the erPETITION v0.1 installer! This will add all the necessary databases and codes into your mySQL DB. Before you continue, <strong>please</strong> make sure your database info is correct.
Host: $db[host] <br>Username: $db[user] <br>Password: $db[pass] <br> Database: $db[name]<br />
If your database info is incorrect, please go and edit config.php now.<br />
<form action=\"?step=1\" method=\"post\"><input type=\"submit\" name=\"start\" value=\"Step 1\"></form>");
?>
Line 85 is:Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/deano/public_html/admin/install.php on line 85I'm pretty sure somebody knows the problem, as I've experimented and cannot figure out how to fix it. And, if you're nice enough/have the time, do you mind cleaning up the code a little?PHP Code:$name = ($_POST[\"name\"]);
Thanks. +rep to any help.
P.S.: The post editor doesnt let me add the beginning slash toThere is suppose to be a "\" before "name\", but it doesn't show up.PHP Code:$name = ($_POST[\"name\"])
Moved by Agesilaus (Forum Moderator) from Design and Development: Please post in the correct forum in future.






Reply With Quote





