Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. updated code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>JS Testing</title> <script type="text/javascript"> //setInterval("checkUrl()", 500); function checkUrl() { var oldurl = window.opener.window.location.href; document.write(oldurl); } </script> </head> <body onload="checkUrl()"> </body> </html> Is there anyway to have the page reload so it displays the URL of the parent window?
  2. ok so i have this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>JS Testing</title> <script type="text/javascript"> function checkUrl() { var oldurl = window.opener.window.location.href; setInterval(document.write(oldurl), 5000); } </script> </head> <body onload="checkUrl();"> <p>Test 1</p> </body> </html> it displays the URL it came from but it doesn't check to see if the parent window has changed... any thoughts?
  3. Can Javascript communicate between two windows using a heart beat monitor or some kind of counter? I need for a var to continually look at the main windows URL and if it changes to save that new url to the var. Any ideas on this?
  4. how do you pass that var into the onunload function so when the pop under is triggered i can display the url name?
  5. Is there a way to pass the site URL from the main window (whatever page the client is on) to a popunder?
  6. what you are asking about provides a HUGE security risk with doing something like that. Any time you are implementing code that communicates action with a users personal machine such as copying to the clipboard, there are always security bugs involved. I wouldn't worry about this and allow the user to just copy and pastes and they please!
  7. change this $fp = fopen('chat.txt', 'w'); to this $fp = fopen('chat.txt', 'a'); The a stands for append.. so the data just keeps adding onto whatever else is there
  8. also check into mysql injection solutions... inserting raw data into a db table can be very dangerous
  9. i actually found that site right after i posted the question... sorry for not googling the answer myself!
  10. I have a SQL command that drops 3 different tables if they exist. can you make this into one sql statement? Example: DROP TABLE IF EXIST `table1`, `table2`, `table3`;
  11. you have to set what session['Username'] is so change this if(isset($_SESSION['Username'])) { to $_SESSION['Username'] = $_POST['Username']; if(isset($_SESSION['Username'])) {
  12. i would change this line $Username = (isset($_POST['username'])) ? mysql_real_escape_string($_POST['username']) : FALSE; to $Username = (isset($_POST['Username'])) ? mysql_real_escape_string($_POST['Username']) : FALSE; But before doing this make sure your input field has a name of Username <input type="text" name="Username" />
  13. i would rename your $Username to something else cause you are already using $username which becomes confusing. possibly something like $gamer or something like that
  14. i would check ALL instances of the var $username
  15. what errors are you receiving, if any?
  16. <?php if ($Row < 50){ echo "You dont have enough gold to purchase a hoe!!"; } break; case "you have already baught a hoe": $Username = $_SESSION['Username']; $query = "SELECT * FROM users_items WHERE username='$Username' AND item = 'hoe'"; $result = mysql_query($query) or die( mysql_error()); if ($row = mysql_fetch_row($result)) echo "you have already bought a hoe!!"; break; case "HOE": mysql_query("INSERT INTO users_items (username, item) VALUES('$Username', 'hoe' ) ") or die(mysql_error()); break; } ?> I forgot to recapitalize your username var. Try the above
  17. try this <?php if ($Row < 50){ echo "You dont have enough gold to purchase a hoe!!"; } break; case "you have already baught a hoe": $Username = $_SESSION['Username']; $query = "SELECT * FROM users_items WHERE username='$username' AND item = 'hoe'"; $result = mysql_query($query) or die( mysql_error()); if ($row = mysql_fetch_row($result)) echo "you have already bought a hoe!!"; break; case "HOE": mysql_query("INSERT INTO users_items (username, item) VALUES('$username', 'hoe' ) ") or die(mysql_error()); break; } ?>
  18. here is an updated hoe.php file <?php session_start(); if(isset($_SESSION['Username'])) { ?> <p></p> <p><a href="shop.php">Shop</a> </p> <?php //connect mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("textgame") or die(mysql_error()); // switch $HOE = "HOE"; echo "you have bought a hoe!!"; switch ($HOE){ case "not enough gold": $Result = mysql_query("SELECT gold FROM users WHERE username='$username'"); $Row = mysql_fetch_array($Result ); if ($Row < 50) echo "You dont have enough gold to purchase a hoe!!"; break; case "you have already baught a hoe": $Username = $_SESSION['Username']; $query = "SELECT * FROM users_items WHERE username='$Username' AND item = 'hoe'"; $result = mysql_query($query) or die( mysql_error()); if ($row = mysql_fetch_row($result)) echo "you have already bought a hoe!!"; break; case "HOE": mysql_query("INSERT INTO users_items (username, item) VALUES('$Username', 'hoe' ) ") or die(mysql_error()); break; } //session_register("inventory"); $Query = "SELECT item FROM users_items WHERE username='$Username'"; $Result = mysql_query($Query); $Row = mysql_fetch_array($Result); $_SESSION['inventory'] = $Row['item']; } //I added this bracket here ?>
  19. can you post the whole script? its usually cause you have forgotten a bracket somewhere
  20. here is a good tutorial on switches http://us3.php.net/manual/en/control-structures.switch.php The one above shows you if else and a switch also try this one http://www.tizag.com/phpT/switch.php
×
×
  • 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.