View Full Version : Javascript question

04-17-2008, 02:09 PM
I have this code at the moment, i want to take off document.location = 'nextpage.php?x=' + x + '&y=' + y + '&room=<?= $room ?>'; so its all on 1 page what is the code to make into 1 code instead of having 2 files, thanks.

<script type="text/javascript">
function locationRefresh(e) {
e = e || window.event;
var x = e.clientX;
var y = e.clientY;
document.location = 'nextpage.php?x=' + x + '&y=' + y + '&room=<?= $room ?>';


include "global.php";

$query3 = mysql_query("SELECT * FROM onlineusers WHERE username = '$username'")
or die("Could not insert data because ".mysql_error());
$qry3 = mysql_fetch_array( $query3 );

$x = $_GET['x'];
$y = $_GET['y'];
$myFile = "store/cords/x/$username.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = fread($fh, filesize($myFile));
fwrite($fh, $x);

$myFile2 = "store/cords/y/$username.txt";
$fh2 = fopen($myFile2, 'w') or die("can't open file");
$stringData2 = fread($fh2, filesize($myFile2));
fwrite($fh2, $y);

if ($qry3[setaway]=="y")
include "setaway.php";

header('Location: usersonlineframe.php?room=' . $room);

04-17-2008, 02:12 PM
What d0o you mean? Theres no javascript in this, or that location... Can you please explain to me a little better on what you want with this?
And just a little tip, using numbers in variables isn't always the best thing to do. Its just like(in math(simple)):
x = 10 x2 = 25...x10 + x2 = w
Whats the value of w?

04-17-2008, 11:28 PM
sorry i edited my post. x and y is the position of the mouse where i click and it writes the x and y information to a txt file to store the data.