dennismonsewicz
Members-
Posts
1,136 -
Joined
-
Last visited
Everything posted by dennismonsewicz
-
[SOLVED] Communicating between windows
dennismonsewicz replied to dennismonsewicz's topic in Javascript Help
bump -
[SOLVED] Communicating between windows
dennismonsewicz replied to dennismonsewicz's topic in Javascript Help
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? -
[SOLVED] Communicating between windows
dennismonsewicz replied to dennismonsewicz's topic in Javascript Help
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? -
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?
-
how do you pass that var into the onunload function so when the pop under is triggered i can display the url name?
-
Is there a way to pass the site URL from the main window (whatever page the client is on) to a popunder?
-
Copy link to clipboard on click... possible?
dennismonsewicz replied to 5kyy8lu3's topic in PHP Coding Help
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! -
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
-
i would also check your sites spam filters.
-
yeah what ^he^ said
-
also check into mysql injection solutions... inserting raw data into a db table can be very dangerous
-
[SOLVED] drop table if exists question
dennismonsewicz replied to dennismonsewicz's topic in PHP Coding Help
i actually found that site right after i posted the question... sorry for not googling the answer myself! -
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`;
-
you have to set what session['Username'] is so change this if(isset($_SESSION['Username'])) { to $_SESSION['Username'] = $_POST['Username']; if(isset($_SESSION['Username'])) {
-
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" />
-
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
-
i would check ALL instances of the var $username
-
what errors are you receiving, if any?
-
<?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
-
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; } ?>
-
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 ?>
-
can you post the whole script? its usually cause you have forgotten a bracket somewhere
-
[SOLVED] if else statement inside of another if else statement?
dennismonsewicz replied to berry05's topic in PHP Coding Help
yeah thats a good one bud! Good luck with everything man! -
[SOLVED] if else statement inside of another if else statement?
dennismonsewicz replied to berry05's topic in PHP Coding Help
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 -
[SOLVED] if else statement inside of another if else statement?
dennismonsewicz replied to berry05's topic in PHP Coding Help
you could simplify the process and use a switch