PHP Game Script
Hello, I am working on a game and I have a few error :(
Note: I always have errors…
<?php
require_once "../htmlbegin.php";
include "../config.php";
if (isset($_SESSION['setuser']))
{
?>
<?php
$result = mysql_query("SELECT * FROM `users` WHERE user_id=".$_SESSION['setid']."");
$row = mysql_fetch_array($result);
if (!$result)
{
die('Invalid query: ' . mysql_error());
}
if (($row['new']=="yes"))
{
?>
<center>
<b>
<h2>Configuration Form</h2>
<form name='config' id='config' method='post'>
[Set IP]
<input name='ip' id='ip' type='textbox' class='textbox'>
<hr />
[Set IP.ID]
<input name='ip_id' id='ip_id' type='textbox' class='textbox'>
<hr />
[Set Router IP]
<input name='router_ip' id='route_ip' type='textbox' class='textbox'>
<hr />
[Set Router ID]
<input name='router_id' id='route_id' type='textbox' class='textbox'>
<hr />
<input name='submit' id='submit' type='submit' class='submit' value='[SET]'>
</b>
<?php
if ($_POST['submit'])
{
$ip=stripslashes($_POST['ip']);
$ip_id=stripslashes($_POST['ip_id']);
$router_ip=stripslashes($_POST['router_ip']);
$router_id=stripslashes($_POST['router_id']);
mysql_real_escape_string($ip);
mysql_real_escape_string($ip_id);
mysql_real_escape_string($router_ip);
mysql_real_escape_string($router_id);
$ip_test = mysql_query("SELECT * FROM ip_info WHERE ip='$ip'")
or die ('Error: ' . mysql_error());
if ($row = mysql_fetch_array($ip_test))
{
echo 'This IP is already in use!';
}
$ip_id_test = mysql_query("SELECT * FROM ip_info WHERE ip_id='$ip_id'")
or die ('Error: ' . mysql_error());
if ($row = mysql_fetch_array($ip_id_test))
{
echo 'This ID is in use!';
}
}
else
{
$sql = "INSERT INTO ip_info(`ip`, `ip_id`, `router_ip`, `router_id`) VALUES ('{$_POST['ip']}', '{$_POST['ip_id']}', '{$_POST['router_ip']}', '{$_POST['router_id']}')";
mysql_query($sql)
or die('Error: ' . mysql_error());
echo 'Configuration Successful!;
}
}
else
{
echo ' ';
}
?>
<?php
}
else
{
echo "Refresh Script";
}
}
else
{
echo "Refresh Script";
}
require_once "../htmlend.php";
?>
What I was trying to do with it is fairly obvious, I do not understand why it is not working. If I remove the PHP in the middle it works…
This is the error I am getting: Parse error: syntax error, unexpected ''', expecting ',' or ';' in /home/www/zbit.awardspace.com/alpha/game/config.new.php on line 75
masta_hacks wrote: VALUES ('{$_POST['ip']}', '{$_POST['ip_id']}', '{$_POST['router_ip']}', '{$_POST['router_id']}')";
What in the bloody hell is that?
What I was trying to do with it is fairly obvious, I do not understand why it is not working.
Well, for a while, it was SOMEWHAT obvious… but, that just threw it all out of whack. I'd start looking at the line above.
omg masta_hacks, learn php properly. that is the single most disgustingly messy piece of php ive ever seen, and i know what youre doing, making a php hacking game right? ive done 50% of one of these myself, and its bloody hard and requires solid php knowledge, which tbh i dont think you fully have. you really should stop setting yourself stupid hard projects for your knowledge level then asking for help when errors appear.