Jump to content

shelluk

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by shelluk

  1. The wait.php with the wait is just for the purpose of demonstrating a delay which I might see in what I am going to try and achieve. I think I've nailed it though, this looks like it does exactly what I want All queries get processed in quick succession, not after the last one completed. <html> <head> <title>This is a ajax test page</title> <script src="[url="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js%22></script>"]http://ajax.googleap...n.js"></script>[/url] <script language="Javascript" type="text/javascript"> function gogo(x) { for(var y=0;y<=x;y++) { populate(y); } } function populate(i) { var xmlhttp; if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById('row'+i).innerHTML = xmlhttp.responseText; } } document.getElementById('row'+i).innerHTML = 'Loading...'; xmlhttp.open('GET', 'wait.php?q='+i, true); xmlhttp.send(null); } </script> </head> <?PHP $x = '10'; echo '<body onload="gogo('.$x.')">'; for( $y=0; $y<=$x; $y++ ){ echo ' <div id="row'.$y.'">#'.$y.'#</div>'.PHP_EOL; } ?> </body> </html>
  2. Actually stijn's didn't work as intended. row 0 = 0 secs row 1 = 1 secs row 2 = 3 (2+1) secs row 3 = 6 secs (3+2+1) secs .. and so on I want all to start at the same time. No waiting. I'll take a closer look at what you said Christian. It's a shame div doesn't support an onload!
  3. Hi Christian I did what stijn said and it did work. I did wonder before hand though and did try making xmlhttp an array. It didn't help though. Thanks Michelle
  4. That works, thanks stijn0713! May be it's good to ask if I'm going around this the right way. The above is just an example for me to get my head around this (I'm new to Javascript/AJAX). I have a variable amount of queries (and so divs), with each out putting to their own div to process. While each one is being processed (some queries could take 5 secs to process while some are instant), I want it to show 'Loading...' in the div rather than the whole page being on hold for 5 seconds (or 10 if 2 of them take 5 seconds to process for example). Thank you
  5. Hi At risk of looking liking an idiot here I feel. Here goes though! I have the following code. Only the one with 'row10' changes though. Everything else sticks on 'Loading...'. Looking at the Apache logs I can see it is requesting each page (wait.php?q=0.. waiting.php?q=1... and so on up to 10). index.php <html> <head> <title>This is a ajax test page</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script language="Javascript" type="text/javascript"> function ajax(id) { for(var i=0;i<=id;i++) { rowid = 'row'+i; var xmlhttp; if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 3) { } if (xmlhttp.readyState == 4) { document.getElementById(rowid).innerHTML = xmlhttp.responseText; } } document.getElementById(rowid).innerHTML = 'Loading...'; xmlhttp.open('GET', 'wait.php?q='+i, true); xmlhttp.send(null); } } </script> </head> <?PHP $x = '10'; echo '<body onload="ajax('.$x.')">'; for( $y=0; $y<=$x; $y++ ){ echo ' <div id="row'.$y.'">#'.$y.'#</div>'.PHP_EOL; } ?> </body> </html> wait.php <?PHP $q = $_GET['q']; sleep($q); echo 'That should have taken '.$q.' seconds.'; ?> Can any one point out my mistake please? Thanks Shell
  6. Hi Kicken Thank you. That did the trick Shell
  7. Hi I'm exploring the DOMDocument class for the first time to do some screen scraping. I am getting the following error though: PHP Warning: DOMDocument::loadHTMLFile(https://192.168.1.59/): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported\r\n in /var/www/default/path/file.php on line 25 PHP Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https%3A%2F%2F192.168.1.59%2F" in /var/www/default/path/file.php on line 25 I've tried adding urlencode() as I saw it suggested in a few places but had no luck (and didn't expect it to help as there is nothing fancy is in the URL?). $url = urlencode('https://192.168.1.59/'); $doc = new DOMDocument(); $doc->loadHtmlFile( $url ); $xpath = new DOMXPath( $doc ); $nodelist = $xpath->query( "/html/body/div[@class='applicationPalette']/table/tbody/tr[2]/td[@class='rightContentPane']/div[@class='pad10'][1]/table/tbody/tr[2]/td[@class='itemLargeFont']" ); I think I need to force HTTP 1.0 but I'm failing at working out how. Or am I wrong all together and it's something else? Thank you!
  8. Thanks to both of you. Decided to go digging after you both mentioned extensions. It turned out to be imagick! All up to date with the stable branch of Debian so had to force a newer version of imagick down through the testing branch. I've escaped alive and with everything now working. The fact it was completing the script up to the last line was throwing me, I thought it would be bombing out before if it was a seg fault. Thank you!
  9. Thanks requinix. I've done that, after some read and writes as expected, it ends with: close(3) = 0 close(1) = 0 close(2) = 0 exit_group(0) = ? This is the last line of the script. Done. Segmentation fault I've set the last line of the script to: exit("This is the last line of the script. Done.".PHP_EOL); I am, confused.
  10. Hi I have a php script which is piped to by my mail server (exim). It runs and does what it needs to do, I even have as the last 2 lines the following, which run and print "Done"! exit("Done"); ?> Yet the script terminates with "Segmentation fault (core dumped)". I have tried to do a backtrace on the core dump file but with no luck. Never gone in to to gdb and backtraces before so don't really know what I'm doing to be honest. I've tried recompiling php with --enable-debug which I am assuming it has done but I am not sure how to check. # gdb /usr/bin/php5 /tmp/core-dumps/core-php.30729 GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/php5...Reading symbols from /usr/lib/debug/usr/bin/php5...done. (no debugging symbols found)...done. warning: core file may not match specified executable file. [New Thread 30729] warning: Can't read pathname for load map: Input/output error. Reading symbols from /lib/i686/cmov/libcrypt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libcrypt.so.1 Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libonig.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libonig.so.2 Reading symbols from /usr/lib/i686/cmov/libssl.so.0.9.8...(no debugging symbols found)...done. Loaded symbols for /usr/lib/i686/cmov/libssl.so.0.9.8 Reading symbols from /usr/lib/libdb-4.8.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libdb-4.8.so Reading symbols from /usr/lib/libqdbm.so.14...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libqdbm.so.14 Reading symbols from /lib/libbz2.so.1.0...(no debugging symbols found)...done. Loaded symbols for /lib/libbz2.so.1.0 Reading symbols from /lib/libpcre.so.3...(no debugging symbols found)...done. Loaded symbols for /lib/libpcre.so.3 Reading symbols from /lib/i686/cmov/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libm.so.6 Reading symbols from /lib/i686/cmov/libdl.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libdl.so.2 Reading symbols from /lib/i686/cmov/libnsl.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libnsl.so.1 Reading symbols from /usr/lib/libgssapi_krb5.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libgssapi_krb5.so.2 Reading symbols from /usr/lib/libkrb5.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libkrb5.so.3 Reading symbols from /usr/lib/libk5crypto.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libk5crypto.so.3 Reading symbols from /lib/libcom_err.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libcom_err.so.2 Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libxml2.so.2 Reading symbols from /lib/i686/cmov/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libc.so.6 Reading symbols from /usr/lib/i686/cmov/libcrypto.so.0.9.8...(no debugging symbols found)...done. Loaded symbols for /usr/lib/i686/cmov/libcrypto.so.0.9.8 Reading symbols from /lib/i686/cmov/libresolv.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libresolv.so.2 Reading symbols from /lib/i686/cmov/libpthread.so.0...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libpthread.so.0 Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr/lib/libkrb5support.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libkrb5support.so.0 Reading symbols from /lib/libkeyutils.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libkeyutils.so.1 Reading symbols from /usr/lib/libxcb.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libxcb.so.1 Reading symbols from /lib/i686/cmov/librt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/librt.so.1 Reading symbols from /usr/lib/libXau.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXau.so.6 Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXdmcp.so.6 Reading symbols from /usr/lib/php5/20090626+lfs/suhosin.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/php5/20090626+lfs/suhosin.so Reading symbols from /lib/i686/cmov/libnss_files.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libnss_files.so.2 Core was generated by `php -q ./mailReader.php'. Program terminated with signal 11, Segmentation fault. #0 0xb6472562 in ?? () (gdb) bt #0 0xb6472562 in ?? () #1 0xb647269b in ?? () #2 0xb6470d40 in ?? () #3 0xb6f96955 in start_thread () from /lib/i686/cmov/libpthread.so.0 #4 0xb71e31de in clone () from /lib/i686/cmov/libc.so.6 # uname -a Linux eeever 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux PHP Version => 5.3.3-7+squeeze14 I think the issue is "no debugging symbols found". I install php5-dbg but it clearly hasn't worked. Has any one either any idea why it is seg faulting even though it executes to the end, or what I'm doing wrong with trying to debug it please?
  11. Hi Can any one suggest a good script for the below please? Googling php file explorer turns up lots and lots which I am looking through but I was wondering if any one could recommend anything from experience please I need it to: - Browse a file system with all kinds of office type documents and a lot of images - Thumbnail previews of the images would be ideal as some are very large, so it would be quicker for a user to find the image they are looking for and then download the full res one - For thumbnails etc of the above to not clutter the existing file structure but to be stored to one side some where, as people will be browsing these files via Samba, FTP, etc too - For it to understand the user permissions of the file system for the user that has logged in to the web site Bonus points: - A mobile (iPhone) browser side aswell. Just a bonus thing though as I can go about this in other ways if needed. Thank you Shell
  12. I hope I've chosen the right forum. If not I apologise. I was wondering if any one could help me come up with a way round this. As I'm struggling to do so. I get the following error: This is a result of the line: $resultC = $resolverC->query($domain,'mx'); From this code: $resolverC = new Net_DNS_Resolver(); // use domains own namservers to look up // $nss is an array of the nameservers for the domain // which we are looping through one at a time $resolverC->nameservers = array($nss[$x]); $resultC = $resolverC->query($domain,'mx'); I know why I get this error but how do I get around it so my page finishes executing gracefully and returns a friendly error? I get it because that nameserver doesn't respond to requests for one reason or another, and times out. Example of what happens with the same request when you do it with nslookup to demonstrate the problem: C:\>nslookup Default Server: dc01.company.local Address: 192.168.1.1 > server ns1.xyzcompany.com Default Server: ns1.xyzcompany.com Address: 194.123.123.123 > xyzcompany.com Server: ns1.xyzcompany.com Address: 194.123.123.123 DNS request timed out. timeout was 2 seconds. DNS request timed out. timeout was 2 seconds. *** Request to ns1.xyzcompany.com timed-out Thanks for your help, Shell
  13. Before the mysql_free_result($user_conditional); at the end! Not ended if (@$row_user_conditional['Access'] == "2") {
  14. You wil need to use the url http://youipaddress:8080 as well after changing the port. Get a friend or someone to test this though from another PC/work or something. Your router may just be getting confused trying to NAT to that IP as it knows it's already its own. Seen this plenty of times on home routers!
  15. BTW. Realised it was clear by what I mean when I say "they appear on top". Like this: __________ _____ _____________________________ | | | | | line 3 |e 2 |text this is a line of text | |__________|_____|_____________________________|
  16. Has any one managed to come up with some way of doing the following? Divs below each other with the width sized to the test with in. __________ | | | blah | |__________| ___________________________________ | | | blah blah blah blah blah blah | |___________________________________| ____________________ | | | blah blah blah | |___________________| I'm getting it all on top of each other though using the following code though (IE6 and FF3). <html> <head> <title>Test</title> <style type="text/css"> div { position: absolute; background-color: #EEEEEE; width: auto; padding: 20px; border: solid 1px black; } </style> </head> <body> <div> this is a line of text this is a line of text this is a line of text this is a line of text </div> <div> this is line 2 </div> <div> line 3 </div> </body> </html> It does seem may be one of those never ending no "one" answer questions. A lot of the forum posts I found in google though are all rather old as well. Any ideas? Thanks, Shell
  17. Surely you can't. PHP is server side. For the password to be encrypted from the client it needs to be done client side. That's PHP out the window... As you say, use JS, but they've asked how to with PHP!
  18. What are the permissions on that folder and file?
  19. Meant to add.. which yes isn't multidimensional but I don't see where that is needed. There is only 2 items appearing once? Why is an array even needed?
  20. If I understand you correctly. Change your line to: $myArray = array($productItem, $productSize); Then read with $myArray[0] or $myArray[1]. For example: <?php $_SESSION['productItem'] = $productItem; $_SESSION['productSize'] = $productSize; $productItem .= ','.$_REQUEST['itemID']; $productSize .= ','.$_REQUEST['sizeID']; $myArray = array($productItem, $productSize); //To test echo "Item ".$myArray[0]." and size ".$myArray[1]; ?>
  21. Sorry, can you explain the problem a bit clearer giving examples/details if it helps. What you've said doesn't make much sense tbh... I think you're saying apache is using the IP of your router as it's IP...? Surely it's not an using the IP of the machine it is installed on...? but... huh?
  22. Check if it contains :00 using strstr, if so echo a break before echoing that time?
  23. Can you add some echo statements in there just to echo $to and $Sentto to confirm what it thinks they are? Thanks, Shell
  24. Thanks kenrbnsn. Looks good. Will play this evening!
  25. Can you give me any links to examples or something related to what I'm trying to do if possible please? Examples I'm finding seem over complicated for what I want and are resulting in me sitting here confused. Thanks, Shell
×
×
  • 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.