Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Way to bring back an old thread, haha I just did this not too long ago, though. var winW = 0; var winH =0; if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = window.innerWidth; winH = window.innerHeight; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } } Above works fine for me in every browser I could test (the only one I didnt get to test with was IE6)
  2. Have you tried to set the content-length and connection headers? xmlHttp11.onreadystatechange = function() { if(xmlHttp11.readyState == 4 && xmlHttp11.status == 200) { document.getElementById("tpost-window").innerHTML = xmlHttp11.responseText; } } xmlHttp11.open("POST", "ajax/ajax-tradingpost.php", true); xmlHttp11.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp11.setRequestHeader("Content-length", params.length); xmlHttp11t.setRequestHeader("Connection", "close"); xmlHttp11.send(params); I could be wrong, considering I haven't used POST in ajax as much as GET, but I've always needed them.
  3. Philip

    ajax form

    You mentioned it keeps losing the POST variable, but your script is running via the GET vars. What does the openpage.php look like?
  4. Finally got it to work, had to use a sub query. If anybody has any improvements to the following code, I would really appreciate the feedback SELECT users.username, users.link, users.clicks, users.hits, users.maxed, (users.clicks - users.hits) AS ch FROM `users` WHERE NOT EXISTS (SELECT `from` FROM `clicks` WHERE clicks.to=users.link AND clicks.from=[CURRENT USER, get this value from PHP]) AND users.suspend =0 AND users.vacation =0 ORDER BY ch DESC
  5. Okay, I admit I'm still pretty noob at MySQL... But here's what I got: Table 'users': id username link clicks hits suspend vacation maxed 1 joe abcd 1 0 0 0 0 2 bob dbca 0 0 0 0 0 3 jim linksomewhere 0 0 0 0 0 Table 'clicks': to from dbca 1 Where, clicks.to is linked to users.link and clicks.from is linked to users.id. What I am trying to do is something along the lines of Select stuff from tables users where user isn't suspended and user isn't on vacation and user has not clicked that link. Example: Before joe clicks bob's link, I should be able to print a list and look like: Now, joe clicks bob's link and it inserts bob's link and joe's id into the table 'clicks' (as seen as the example entry in the tables above). Now, when I print the list for user joe, it shouldn't show bob's link anymore. What I have kinda works, but it'll display some results twice. I've also aimlessly tried a left join. Here's what I've got (left joined): SELECT users.username, users.link, users.clicks, users.hits, users.maxed, (users.clicks - users.hits) AS ch FROM `users` LEFT JOIN `clicks` ON users.id != clicks.from AND users.link != clicks.to WHERE users.suspend =0 AND users.vacation =0 ORDER BY ch DESC (normal join): SELECT users.username, users.link, users.clicks, users.hits, users.maxed, (users.clicks - users.hits) AS ch FROM `users` , `clicks` WHERE users.suspend =0 AND users.vacation =0 AND users.id != clicks.from AND users.link != clicks.to ORDER BY ch DESC
  6. Going to take a guess, in your query: ...,name,profil,company,... profil or profile?
  7. @ darkfreaks, Zend encoder (guard) is anything BUT free, haha. Unless you have, what $800 to throw away? I'll admit, I'm quite interested to see if anybody has used any free ones.
  8. Also, make sure an ID was input, otherwise instead of a nice error message they'll get this mess:
  9. Okay, I'm looking at your code now, and am curious about some things. SELECT * FROM `forum_replies` WHERE `tid`='".$tid."' I'm going to guess tid is topic ID? But where do you set $tid? $select_sql = "SELECT * FROM `forum_replies` ORDER BY id ASC LIMIT ".$end.",".$limit.""; $select_res = mysql_query($select_sql) or die(mysql_error()); What is that being called for? Nothing after it is using it
  10. So you want to be able to call $numTimes later in your PHP script and it would display 10, is that correct?
  11. Or just print it out in a format like "$123"? <?php $var = 'variableName'; $$var = 'test'; echo $var; //prints variableName echo $variableName; // prints test ?> Are you trying to do like variable variables?
  12. Try: <?php include_once('/home/xxxxxxxx/public_html/footer.php'); // using path, instead of domain ?>
  13. It depends on what you mean. Setting the contents of the file to $variable - yes. Creating a variable in the text file - no (unless you parsed the text file as php code.. which wouldn't be safe nor practical)
  14. What does this output: <?php $tempVar = 'showtop.php?t_id='.$_POST['t_id'].'&rt='.$_GET['rt']; echo $tempVar; //header("location: $tempVar"); ?>
  15. Try this: <?php $ip = $_SERVER['REMOTE_ADDR']; $useripdata = "/ip/$ip.txt"; if (file_exists($useripdata)) { foreach (file($useripdata) as $line) { echo '$' . $line; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } echo "<meta http-equiv='refresh' content='$reloadtime'>"; } else { if (isset($_POST['action'])) { $numTimes = (isset($_POST['times']) && is_numeric($_POST['times']))?$_POST['times']:10; $shorturl = $_POST['url']; $autoplay = "&autoplay=1"; $reloadtime = $_POST['reloadtime']; $setwidth = $_POST['setwidth']; $setheight = $_POST['setheight']; $shorturl = $_POST['url']; $fullurl = "http://www.youtube.com/watch?v=$shorturl"; $myFile = "./ip/$ip.txt"; $fh = fopen($myFile, 'w'); $stringData = "numTimes = 10 \n"; fwrite($fh, $stringData); $stringData = "shorturl = $shorturl \n"; fwrite($fh, $stringData); $stringData = "autoplay = $autoplay \n"; fwrite($fh, $stringData); $stringData = "reloadtime = $reloadtime \n"; fwrite($fh, $stringData); $stringData = "setwidth = $setwidth \n"; fwrite($fh, $stringData); $stringData = "setheight = $setheight \n"; fwrite($fh, $stringData); $stringData = "fullurl = $fullurl \n"; fwrite($fh, $stringData); fclose($fh); function check_if_valid($fullurl) { $res = (($check = @fopen($fullurl, ‘r’)) === false) ? false : @fclose($check); return ($res == TRUE) ? VIDEO_IS_VALID:VIDEO_IS_INVALID ; } if ($HTTP_POST_VARS["submitted"] == "yes"){ echo "<meta http-equiv='refresh' content='$reloadtime'>"; } for ($i=0; $i < $numTimes; $i++) { echo '<object width="$setwidth" height="$setheight""><param name="movie" value="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1"></param><param name="allowFullScreen" value="false"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $shorturl . '&hl=en&fs=1$autoplay" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="false" width="$setwidth" height="$setheight"></embed></object>'; } } else { $self = $_SERVER['PHP_SELF']; echo "<table border='1'>"; echo "<form action='$self' method='post'>"; echo "<tr>"; echo "<td>Video Url:<input type='text' readonly='1' value='http://www.youtube.com/watch?v=' size='30'><input type='Text' name='url'></td>"; echo "</tr>"; echo "<tr>"; echo "<td>(Number)<input type='text' name='times' value='10'> of Times to Display Video in <input type='text' name='reloadtime' value='5'>(Seconds)</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Set Width <input type='text' name='setwidth' value='425'> Set Height <input type='text' name='setheight' value='344'>"; echo "</tr>"; echo "<tr>"; echo "<td align='center' valign='center'><input type='submit' name='action' value='Submit'>"; echo "<input type='hidden' name='submitted' value='yes'>"; echo "</td>"; echo "</tr>"; echo "</form>"; echo "</table>"; } } ?> You had it check to see if $_POST['action'] is there, but not if it wasn't.
  16. Well, <?php header("Location: showtop.php?t_id=".$_POST["t_id"]."&rt=".$_GET['rt']); ? The $_POST[] has " instead of '
  17. I used http://www.tizag.com/phpT/ for a while. Their site is easy to navigate, easy to read, and they typically have the exact example I am looking for.
  18. It doesn't appear they do - you can always try submitting a ticket to their support and ask if they will allow it (or have them do it for you)
  19. If it's shared, most likely not. Who is your provider?
  20. I could be mistaken, but your first line is missing # (haven't worked with sql dumps for a while, but thats what it looks like to me)
  21. urlencode($string) would convert 'TeléfonoCasa' to 'Tel%E9fonoCasa' then you could use urldecode($string) to switch back to 'TeléfonoCasa'
  22. What error are you getting?
  23. get should work... i don't know why it wouldn't <?php if(isset($_GET['record'])) { echo $_GET['record']; } ?> That doesn't return anything?
  24. include "../connect.php"; you must include the full path, i.e.: /home/username/public_html/folders/connect.php
  25. If you have the form on the same page, you can do it like: <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <input type="text" name="email" value="<?php if(isset($_POST['email'])) { echo $_POST['email']; }?>"> ... </form> If not, then you could do sessions (i wouldnt recommend it since it takes up some memory for something pretty trivial such as this), or via GET & passing it through the URL. I would suggest looking into integrating the form on the same page as the php script.
×
×
  • 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.