Jump to content

.php?id=1,2,3 not working properly


Lotto320

Recommended Posts

Okay, so I am trying to make a play.php file connected to my database, this database got a table named "webclientcreate".

 

When I go to play.php?id=1, it is showing the proper one (the 1st row wich got id 1 in it), however if I after that go to something random like play.php?fsfasd the ID 1s page still pops up..

I can also go to play.php?id=2 and still get the id 1's data.

 

I want to make it that every row got its own information (well it does, but the php file doesnt seem to recieve it correctly).

 

PHP version: 5.2.17

MySQL version: 5.1

 

Heres a picture of my table rows:

521b45ffee574ac3ba91e80.png

 

I've censored the MySQL connection information, I know it is working properly.

 

<?php

$connect = mysql_connect("mysql12.000webhost.com","****","******") or die(mysql_error());
mysql_select_db("***") or die(mysql_error());


$extract = mysql_query("SELECT * FROM webclientcreate");
$numrows = mysql_num_rows($extract);

while ($row = mysql_fetch_assoc($extract))
{
$id = $row['id'];
$server = $row['name'];
$ip   = $row['ip'];
$port = $row['port'];
$background = $row['background'];
}
if (isset($ip)&&isset($port)&&!empty($ip)&&!empty($port)) {

if (! $sock = @fsockopen($ip, $port, $num, $error, 1)) 
echo "";
else{ 
echo "<img src='fs/newyear/online.png'/>$ip on port $port is currently<B><FONT COLOR=lime> Online</b></FONT>"; 
fclose($sock);
}

}

?>
<title>Playing <?php echo $server; ?> - ID <?php echo $id; ?> </title>

<center>
<body bgcolor="#000000">

<applet name=client width=765 height=503 archive='<?php echo $jars; ?>' code='client.class'>

<PARAM name='java_arguments' value='-Xmx700m'>

<PARAM name='server_name' value='<?php echo $server; ?>'>

<PARAM name='detail' value='low'>

<PARAM name='ip' value='<?php echo $ip; ?>'>

<PARAM name='port' value='<?php echo $port; ?>'>

<PARAM name='background_image' value='<?php echo $background; ?>'>

<PARAM name='headicons' value=''>

</applet>
</center>

Link to comment
Share on other sites

This line is wrong:

$extract = mysql_query("SELECT * FROM webclientcreate");

 

You are not setting the id to choose:

$id = mysql_real_escape_string($_GET['id']);
$extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' LIMIT 1");

 

Since there is only one result, you can also get rid of the while loop (But keep the contents).

Link to comment
Share on other sites

Thanks, but I didnt understand the "keep the content" part  :-\

So I tried to understand it:

 

<?php

$connect = mysql_connect("mysql12.000webhost.com","***","***") or die(mysql_error());
mysql_select_db("***") or die(mysql_error());


$id = mysql_real_escape_string($_GET['id']);
$extract = mysql_query("SELECT * FROM webclientcreate WHERE id='$id' LIMIT 1 WHERE ip='$ip' WHERE port='$port' WHERE name='$name' WHERE background='$background'");
?>

This ^^ Didnt make any differance then the one with only WHERE id='$id'.

 

The ID's shows up correctly now, but I want this applet to be connected to the database:

 

<applet name=client width=765 height=503 archive='<?php echo $jars; ?>' code='client.class'>

<PARAM name='java_arguments' value='-Xmx700m'>

<PARAM name='server_name' value='<?php echo $name; ?>'>

<PARAM name='detail' value='low'>

<PARAM name='ip' value='<?php echo $ip; ?>'>

<PARAM name='port' value='<?php echo $port; ?>'>

<PARAM name='background_image' value='<?php echo $background; ?>'>

<PARAM name='headicons' value=''>

</applet>

 

And the $server part to show up in the title too.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.