Results 1 to 3 of 3

Thread: Javascript question

  1. #1
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Javascript question

    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.

    Code:
    <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 ?>';
    }
    </script>
    nextpage.php:
    Code:
    <?php
    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);
    fclose($fh);
    
    $myFile2 = "store/cords/y/$username.txt";
    $fh2 = fopen($myFile2, 'w') or die("can't open file");
    $stringData2 = fread($fh2, filesize($myFile2));
    fwrite($fh2, $y);
    fclose($fh2);
    
    if ($qry3[setaway]=="y")
    {
    include "setaway.php";
    }
    
    header('Location: usersonlineframe.php?room=' . $room);
    ?>
    Last edited by Mike4x4; 04-17-2008 at 11:28 PM.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    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?
    Last edited by Nile; 04-17-2008 at 02:35 PM.
    Jeremy | jfein.net

  3. #3
    Join Date
    Apr 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.
    Last edited by Mike4x4; 04-17-2008 at 11:34 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •