
The reason being is because those things are inside quotation marks, therefore, needing "\"s. If that makes any sense.Hi Adam,
You have things like
$query = mysql_query(\"select count(*) from petition\");
$result = mysql_result($query, 0);
there shouldn't be any \ before " when it's pure PHP. If it's an HTML echo (ie echo "<input type=\"text\"> then there should, but on a query (ie query = mysql_query(\"INSTER INTO......\") there shouldn't be \.
I'm not sure if it effects the script, but it isn't needed.
Might be the cause, I really don't know but I do know it doesn't need to be there.
Good luck mate!
OK, I've lost it im drunk off my head
I will reply tomorrow wirh a decent reply...
Just try changing the $_POST["name\"] to $_POST['name']
Cya tomorrow dude!!
Last edited by adamFTW; 15-12-2007 at 12:11 AM.
Right, I'm sober now haha.
The code is very bad. Why are there random ?>'s and things that are dividing the script up? Also all the \'s before the "'s aren't needed, they're only needed when you're echoing HTML (ie <input type=\"text\">).
I tried to fix it - it's a big mess though, one error after another.
Here's what I fixed up if anybody wants to fix it on from there.
Current error: The last line (php closing ?>).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.");
// 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>");
?>
After you closed it, there was still some more PHP code left..?
Try thatPHP Code:<?
##WERE GOING TO CONFIGURE SOME VARIABLES !
$installerpagename = "installer.php"; #CHANGE THIS TO THE NAME OF THE INSTALLER PAGE
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.");
// 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!";
// 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.);");
print ("
Step 1 Complete! Please Enter your AdminCP Details:\n \n \n \n \n \n
<form action=\"$installerpagename?step=2\" method=\"post\">
Username:
<input type=\"text\" name=\"name\">\n
Password:
<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>");
?>![]()
Last edited by rh4u; 15-12-2007 at 02:29 PM. Reason: Php is annoying.
my sig ran away,
What's the point in doing $query = mysql_query... etc?
I'm pretty sure that wont actually execute, just take out $query =
It executes, because it's determining the value of the $query value, which is what you're technically telling the script to do.
Want to hide these adverts? Register an account for free!