Jump to content


Photo

Wierd Error Please help


  • Please log in to reply
2 replies to this topic

#1 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 06 October 2006 - 11:41 PM

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\thephp\xampp\htdocs\nevux130RC1\install\install1.php on line 29

$user = $_POST['databaseuname']\;



[full script]
<html>
<head>
<style type="text/css">
a:link, a:visited, a:active {text-decoration: underline;color: #FFFFFF; }
a:hover {text-decoration: underline;color: #ABC0DA; }
.linkheader{border-right:1px solid #000;border-left:1px solid #000;font-weight:bold;text-align:center;height:30px;width:100%;background-image: url(./../skin/category.gif)}
.linkbody{border-right:1px solid #000;border-left:1px solid #000;text-align:center;background-color: #5385B4;width:100%;}
body,html{text-align:center;background-color: #4F4F4F;}
.lastcatrow{height:10px;background-image: url(./../skin/category.gif);border:1px solid black;}
</style>
</head>
<body>
	<table class='linkheader' width='100%'>
		<tr>
			<td>Create Config File</td>
		</tr>
	<table>
<?php
if(isset($_POST['createfile'])){
if($_POST['dbpassword'] != $_POST['dbpasswordc']){
echo "<table class='linkbody' width='100%' colspan='2'><tr><td>Database Passwords are not matching<a href='install2.php'> here</a>.</td></tr></table><table class='lastcatrow'><tr><td></td></tr></table>";
exit;
}
$config = "./../config.php";
$database = "database.php";
$handling = fopen($config, 'w');
$StringData = "<?php
ob_start()\;
$user = $_POST['databaseuname']\;
$pass = $_POST['dbpassword']\;
$database = $_POST['databasename']\;
mysql_connect(\"localhost\",$user,$pass) or die(mysql_error())\;
mysql_select_db($database) or die(mysql_error())\;
$cookieid = htmlspecialchars($_COOKIE[uid])\;
$cookiepass = htmlspecialchars($_COOKIE[upass])\;
$logged = mysql_query(\"SELECT * FROM users WHERE id='$cookieid' AND password='$cookiepass' \")\;
$logged = mysql_fetch_array($logged)\;
?>
";
fwrite($handling, $StringData);
$handling2 = fopen($database, 'w');
$StringData2 = "<?php
$user = $_POST['databaseuname']\;
$pass = $_POST['dbpassword']\;
$database = $_POST['databasename']\;
mysql_connect(\"localhost\",$user,$pass) or die(mysql_error())\;
mysql_select_db($database) or die(mysql_error())\;
?>
";
fwrite($handling2, $StringData2);
echo "<table class='linkbody' width='100%' colspan='2'><tr><td>Database information was complete go to next step <a href='install2.php'> here</a>.</td></tr></table>";
}else{
?>
<form method='post'>
	<table class='linkbody' width='100%' colspan='2'>
		<tr>
			<td>
				Database Name:
			</td>
			<td>
				<input type='text' name='databasename'>
			</td>
		</tr>
		<tr>
			<td>
				DB Password:
			</td>
			<td>
				<input type='password' name='dbpassword'>
			</td>
		</tr>
		<tr>
			<td>
				DB Password Check:
			</td>
			<td>
				<input type='password' name='dbpasswordc'>
			</td>
		</tr>
		<tr>
			<td>
				Database Username:
			</td>
			<td>
				<input type='text' name='databaseuname'>
			</td>
		</tr>
		<tr>
			<td>
				Create Config File:
			</td>
			<td>
				<input type='submit' name='createfile' value='Create DB File'>
			</td>
		</tr>
	</table>
</form>
<? } ?>
<table class='lastcatrow' width='100%'>
<tr><td></td></tr>
</table>
</body>
</html>

now i updated script and when i did this:

$StringData = "<?php
ob_start()\;
\$user = \$_POST['databaseuname']\;
\$pass = \$_POST['dbpassword']\;
\$database = \$_POST['databasename']\;
mysql_connect(\"localhost\",\$user,\$pass) or die(mysql_error())\;
mysql_select_db(\$database) or die(mysql_error())\;
\$cookieid = htmlspecialchars(\$_COOKIE[uid])\;
\$cookiepass = htmlspecialchars(\$_COOKIE[upass])\;
\$logged = mysql_query(\"SELECT * FROM users WHERE id='\$cookieid' AND password='$cookiepass' \")\;
\$logged = mysql_fetch_array(\$logged)\;
?>
";

it worked BUT
i get this in the database file also in Config.php file:

<?php
$user = $_POST['databaseuname'];
$pass = $_POST['dbpassword'];
$database = $_POST['databasename'];
mysql_connect("localhost",$user,$pass) or die(mysql_error())\;
mysql_select_db($\database) or die(mysql_error())\;
?>


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 06 October 2006 - 11:50 PM

Whats with all the backslashes?

#3 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 07 October 2006 - 01:37 AM

Ummmm wayyyy too many backslashes... try removing them all unless theyre used in echo's or something of the such...
Why doesn't anyone ever say hi, hey, or whad up world?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users