Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxxxxx/public_html/index.php on line 1

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxxxxx/public_html/index.php on line 1

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/xxxxxx/public_html/index.php on line 1

Parse error: syntax error, unexpected T_CHARACTER, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/xxxxxx/public_html/index.php on line 2

i have no clue what went wrong.. what did i do...can anyone help me..
my site is http://upithere.info. im getting this error on my front page. the index.php ...

<?php include \\\"header.php\\\";
if (!$mysql[\\\'db\\\'])
{
die(\\\"Please <a href=\\\'install.php\\\'>Install</a> this first!\\\");
}
?>
Image (<a href=\\\"http://upithere.info/legal.php\\\" target=\\\"blank\\\" name=\\\"upithere.info terms\\\">This site is for AMATEUR ADULT PHOTOS ONLY.</a>)<br>
<form method=\\\"post\\\" enctype=\\\"multipart/form-data\\\" action=\\\"process.php\\\">
<input type=\\\"file\\\" name=\\\"imagefile\\\" size=\\\"27\\\">
<br>Name your picture<br>
<textarea rows=\\\"textarea\\\" width=\\\"20\\\" cols=\\\"20\\\" name=\\\"comments\\\"></textarea><br>
<input type=\\\"hidden\\\" name=\\\"MAX_FILE_SIZE\\\" value=\\\"<?php echo $maxfilesize ?>\\\">
<input type=\\\"submit\\\" value=\\\"Upload\\\" name=\\\"upload\\\">
</form>


<?php
$max = $maxfilesize/1048576;
$max = round($max, 1);
echo \\\"<br>$max MB Maximum Upload File Size\\\";


//Lets try connecting to mySQL
@ $db = mysql_pconnect($mysql[\\\'host\\\'], $mysql[\\\'user\\\'], $mysql[\\\'pass\\\']);
//IT\\\"S NOT WORKING!
if (!$db)
{
die(\\\"<br>Please make sure your Database is installed correctly. \\\");
}
mysql_select_db($mysql[\\\'db\\\']);



//get current stats
$query = \\\"SELECT * FROM `stat_cache`\\\";


$result = mysql_query($query);


if (!$result)
{
die(\\\"MySQL Select error\\\");
}
$stat = mysql_fetch_array($result);


//Space in MB
$space = $stat[\\\'space\\\'] / 1048576;
$space = round($space, 1);
//Band in MB
$band = $stat[\\\'band\\\'] / 1048576;
$band = round($band, 1);
$files = $stat[\\\'files\\\'];
$downloads = $stat[\\\'downloads\\\'];
//echo stats
echo \\\"<br>Total Files: $files\\\";
echo \\\"<br>Total Space used: $space MB\\\";
echo \\\"<br>Total Bandwidth used: $band MB\\\";
echo \\\"<br>Total Downloads: $downloads\\\";



//Cool stuff
//Random x images will
//Be displayed here :)
if($randommany)
{
echo \\\"<br/><br/><table width=\\\'\\\" . ((($randommany * 150) + (6 * ($randommany +1)))-2) . \\\"\\\' height=\\\'170px\\\' border=\\\'1\\\'><tr><td align=\\\'center\\\' colspan=\\\'\\\" . $randommany . \\\"\\\'>Random \\\" . $randommany . \\\" images</td></tr><tr>\\\";
$query = \\\"SELECT * FROM images ORDER BY rand() LIMIT \\\" . $randommany;
$result = mysql_query($query);
for ($i = 0; $i < $randommany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'152\\\' align=\\\'center\\\'><a href=\\\'\\\" . $scripturl . \\\"view/\\\" . $id . \\\"\\\'><img src=\\\'\\\" . $scripturl . \\\"thumb/\\\" . $id . \\\".jpeg\\\' border=\\\'0\\\'></a></td>\\\";
}
echo \\\"</tr><tr>\\\";
mysql_data_seek($result, 0);
for ($i = 0; $i < $randommany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'150\\\' align=\\\'center\\\'><a href=\\\'report.php?id=\\\" . $id . \\\"\\\'>Report Image</a></td>\\\";
}
echo \\\"</tr></table>\\\";
}



//Last x images will
//Be displayed here :)
if($lastmany)
{
echo \\\"<br/><br/><table width=\\\'\\\" . ((($lastmany * 150) + (6 * ($lastmany +1)))-2) . \\\"\\\' height=\\\'170px\\\' border=\\\'1\\\'><tr><td align=\\\'center\\\' colspan=\\\'\\\" . $lastmany . \\\"\\\'>Last \\\" . $lastmany . \\\" uploaded images</tr></td><tr>\\\";
$query = \\\"SELECT * FROM images ORDER BY id DESC LIMIT \\\" . $lastmany;
$result = mysql_query($query);
for ($i = 0; $i < $lastmany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'152\\\' align=\\\'center\\\'><a href=\\\'\\\" . $scripturl . \\\"view/\\\" . $id . \\\"\\\'><img src=\\\'\\\" . $scripturl . \\\"thumb/\\\" . $id . \\\".jpeg\\\' border=\\\'0\\\'></a></td>\\\";
}
echo \\\"</tr><tr>\\\";
mysql_data_seek($result, 0);
for ($i = 0; $i < $lastmany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'150\\\' align=\\\'center\\\'><a href=\\\'report.php?id=\\\" . $id . \\\"\\\'>Report Image</a></td>\\\";
}
echo \\\"</tr></table>\\\";
}



//Random x images will
//Be displayed here :)
if($randommany)
{
echo \\\"<br/><br/><table width=\\\'\\\" . ((($randommany * 150) + (6 * ($randommany +1)))-2) . \\\"\\\' height=\\\'170px\\\' border=\\\'1\\\'><tr><td align=\\\'center\\\' colspan=\\\'\\\" . $randommany . \\\"\\\'>Random \\\" . $randommany . \\\" images</td></tr><tr>\\\";
$query = \\\"SELECT * FROM images ORDER BY rand() LIMIT \\\" . $randommany;
$result = mysql_query($query);
for ($i = 0; $i < $randommany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'152\\\' align=\\\'center\\\'><a href=\\\'\\\" . $scripturl . \\\"view/\\\" . $id . \\\"\\\'><img src=\\\'\\\" . $scripturl . \\\"thumb/\\\" . $id . \\\".jpeg\\\' border=\\\'0\\\'></a></td>\\\";
}
echo \\\"</tr><tr>\\\";
mysql_data_seek($result, 0);
for ($i = 0; $i < $randommany; $i++)
{
$rand = mysql_fetch_array($result);
$id = $rand[\\\'id\\\'];
echo \\\"<td width=\\\'150\\\' align=\\\'center\\\'><a href=\\\'report.php?id=\\\" . $id . \\\"\\\'>Report Image</a></td>\\\";
}
echo \\\"</tr></table>\\\";
}


include \\\"footer.php\\\";
?>
<!-- Start of StatCounter Code -->
<script type=\\\"text/javascript\\\" language=\\\"javascript\\\">
var sc_project=2435968;
var sc_invisible=0;
var sc_partition=23;
var sc_security=\\\"c8b783c1\\\";
</script>


<script type=\\\"text/javascript\\\" language=\\\"javascript\\\" src=\\\"http://www.statcounter.com/counter/counter.js\\\"></script><noscript><a href=\\\"http://www.statcounter.com/\\\" target=\\\"_blank\\\"><img  src=\\\"http://c24.statcounter.com/counter.php?sc_project=2435968&java=0&security=c8b783c1&invisible=0\\\" alt=\\\"free web site hit counter\\\" border=\\\"0\\\"></a> </noscript>
<!-- End of StatCounter Code -->

Edited 3 Years Ago by happygeek: fixed formatting

ok i figured it out.. before this i knew nothing about php lol.

good work figuring it out.
The \ is the escape character for PHP strings (and other programming languages too).

Are you inputting PHP from a form? I believe what happened is your quotes have been escaped twice. This normally happens if you have automatic escaping of quotes during runtime. This is set in your PHP configuration (php.ini). The setting is magic_quotes_gpc ( I think ).

So you can still fix the form (wysiwyg editor) so that it only escapes once.

What you can do is check for the setting in PHP.ini in your PHP that processes the form.

This is done with the funciton: get_magic_quotes_gpc()

eg:

if (!get_magic_quotes_gpc()) {
addslashes($string);
}

read.. if not get_magic_quotes_gpc(), then addslashes(). Otherwise, you don't need escaping of strings.

This article has been dead for over six months. Start a new discussion instead.