Okay. I'm using the following install script to set up the MySQL table for a counter. I'm having problems though:
Parse error: parse error, unexpected $ in /home/ketsuka/public_html/install.php on line 92
Problem I'm finding is there are only 91 lines in the file, so I'm not sure what $ it's talking about...
<?php
/*************************************
* Dissionance Counter v0.1 *
* by Nite Phire *
*====================================*
* [url]http://dissonance.ketsukaiten.net/[/url] *
* [email]nitephire@ketsukaiten.net[/email] *
*************************************/
//
// DO NOT EDIT BELOW !!!
//
// Retrieves the data.
$date = date(mdy);
$mysqlhost = $_POST['host'];
$mysqluser = $_POST['username'];
$mysqlpassword = $_POST['password'];
$database = $_POST['database'];
$tableprefix = $_POST['tableprefix'];
$hitstotal = $_POST['hitstotal'];
$uniquetotal = $_POST['uniquetotal'];
// Checks if form has been submitted.
if (isset ($_POST['install'])) {
// Checks that all data has been submitted.
if (! isset ($_POST['host']) ||
! isset ($_POST['username']) ||
! isset ($_POST['password']) ||
! isset ($_POST['database']) ||
! isset ($_POST['tableprefix']) ||
! isset ($_POST['hitstotal']) ||
! isset ($_POST['uniquetotal'])) {
print '<html>
<body>
You must go back and fill out all fields of the form!
</body>
</html>';
} else {
// Connects to MySQL.
mysql_connect ($mysqlhost, $mysqluser, $mysqlpassword)
or die ("Wrong host, username, or password.");
mysql_select_db ($database)
or die ("Could not select database.");
// Creates the stats table.
mysql_query (
'CREATE TABLE' . $tableprefix . '_stats (
type VARCHAR(6) NOT NULL,
total INT UNSIGNED NOT NULL,
date DATE NOT NULL,
today INT UNSIGNED NOT NULL,
ipaddress LONGTEXT NOT NULL
);
INSERT INTO' . $tableprefix . 'stats (type, total, date, today)
VALUES
("hits", ' . $hitstotal . ', ' . $date . ', 0),
("unique", ' . $uniquetotal . ', ' . $date . ', 0);
');
// Displays a comforting message...
print '<html>
<body>
Dissonance Stats successfully installed.
</body>
</html>';
}
} else {
// If not submitted, it displays a form.
print'<html>
<body>
<form method="post" action="install.php">
MySQL Host: <input type="text" name="host" size="30" value="localhost"><br>
MySQL Username: <input type="text" name="username" size="30"><br>
MySQL Password: <input type="password" name="password" size="30"><br>
MySQL Database: <input type="text" name="database" size="30"><br>
Table Prefix: <input type="text" name="tableprefix" size="30"><br>
Total Hits So Far: <input type="text" name="hitstotal" size="30" value="0"><br>
Total Unique Hits So Far: <input type="text" name="uniquetotal" size="30" value="0"><br>
<input type="submit" name="install" value="install">
</form>
</body>
</html>
}
?>