Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Im trying to select an array of rows. I need to select all rows with different ids: id | name 234 | name1 3 |name2 125 |name3 4 |name4 $query = "SELECT * FROM table WHERE id=(4,125) and approve=1 "; So im selecting everything from row 4 and 125....but syntax error I cant think how to do it..
  2. Im trying to split it up so i can add extra stuff to each number then make a query $string = 12 34 565 32 123; foreach(str_word_count($string,1) as $id) $id_seperate = "id=".$id." AND"; $query = "SELECT * FROM table WHERE ".$id_seperate." approve=1"; So the query should look like: $query = "SELECT * FROM table WHERE id=12 AND id=34 AND id=565 AND id=32 AND id=123 AND approve=1";
  3. Is there anyway i can split numbers, this code below works with words but i need to seperate a sting of numbers: $string = "Im a string"; foreach(str_word_count($string,1) as $word) echo $word."<br>"; I need to do this with a string of numbers: $string = 12 34 565 32 123; foreach(str_word_count($string,1) as $word) echo $word."<br>";
  4. Ok changed it to onsubmit, everything works except its not posting the form contents to the php page <form action="" method="post" onsubmit='RequireAjaxData("includes/mail_basic.php", "MyDIV"); return false;'> Phone <input type="text" name="phone" id="phone" value="" maxlength="200" size="22"> Comments:<textarea name="comments" id="comments" cols="31" rows="5"></textarea> <input type="submit" name="send" value="Send" > </form> <div id='MyDIV'></div>
  5. Its a hobby so i dont mind if i make nothing from it - my payment is building apps that ppl actually use. I want it to have no advertising at all just content. Css, images, and javascript are on main sites subdomains: http://js.main.com http://img.main.com http://css.main.com Video files are on remote server Theres one ip that has been hitting every page and stealing large amounts of bandwidth - 61.41.172.241. I cant seem to trace it
  6. Ok thatll get me started. Im already using lighthttpd. Javascript is cached using htaccess. Im also using smarty templates caching on pages that dont need {section} reoccuring Will this affect embedding. I get a large amount of incomming traffic from other sites from embedded videos
  7. Half the hits are curl bots. Have no idea how to block them This is from awstats on my server under browsers: Browser | Grabber |hits |percent Curl | Yes | 4756433 | 43.3 %
  8. Its a tube site. So membership is free, with up to 30 min vids to download and also a convert resize mod thrown in. The conversion takes some server power but this is one the second server, but ive noticed a large drop in site performance. Im allowing other sites to embed videos as well - from the main server I dont want to spend much on this because its a free site, so buying servers is out Theres gotta be advanced caching techniques out there? Heres what im using, this is all i can find on caching: #increase speed and preserve bandwidth <ifmodule mod_php4.c> php_value zlib.output_compression 16386 </ifmodule> # 1 WEEK <FilesMatch "\.(jpg|jpeg|gif|ico|png)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> # 5 MIN <FilesMatch "\.(css|js|swf|flv)$"> Header set Cache-Control "max-age=172800, private, proxy-revalidate" </FilesMatch> Header unset ETag FileETag None # stop ppl from browsing indexes Options -Indexes
  9. Porn. Of course. Ive built alot of apps for the site. Just like facebook has.
  10. Over the past month visitors to one of my site has grown exponentially, currently now over 100K per day and increasing. Im getting worried that the servers cant handle it, and its only a matter of time before they crash. Ive split my css, images, javascript up on subdomains, plenty of caching and zlib.output_compression. Using 14 separate databases - now over 250MB each and 2 servers. Thats all i can think of to do.
  11. Here is my entire page index.htm: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> <script> var object_busy= false; ShowLoading = 1 ; var MyTimer = null; Myvar = "<table align='center'><tr><td><img src='' ></td></tr></table>"; function RequireAjaxData($Request, $Control) { if ($Control == "" || $Control == null) {alert ("No output specified !"); return;} var ai = new AJAXInteraction($Request, GetServerData, $Control ); ai.doGet(); } function GetServerData ($TheData, $Control){ document.getElementById($Control).innerHTML = $TheData; } function AJAXInteraction(url, callback, $Control) { var req = init(); req.onreadystatechange = processRequest; function init() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else {alert ("Your browser seems to be out of date, Please update!"); return; } } function processRequest () { if (req.readyState == 4) { if (req.status == 200) callback(req.responseText, $Control); } else callback(Myvar , $Control); } this.doGet = function() { req.open("GET", url, true); req.send(null); } this.doPost = function(body) { req.open("POST", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(body); } } </script> </head> <body> <form action="" method="post"> Phone <input type="text" name="phone" id="phone" value="" maxlength="200" size="22"> Comments:<textarea name="comments" id="comments" cols="31" rows="5"></textarea> <input type="button" name="send" value="Send" onclick='RequireAjaxData("includes/mail_basic.php","phone","comments" , "MyDIV"); return false;'> </form> <div id='MyDIV'></div> </body> </html>
  12. Its accessing the basic_mail.php ok but not posting anything. Heres what i did: <input type="button" name="send" value="Send" onclick='RequireAjaxData("includes/mail_basic.php","phone","comments" , "MyDIV"); return false;'> <div id='MyDIV'></div>
  13. How can i post a form using http request. I can do this with a link and div becuase i know what im passing to the php page: <div id='MyDIV'> <a href='' onclick='RequireAjaxData("/ajax/quicklist.php?vid=100", "MyDIV"); return false;'> Add quicklist</a></div> How can i do this when posting a form. When a user clicks submit button the post gets submitted to the test_mail_basic.php page without page reload : <form action="ajax/test_mail_basic.php" method="post"> Phone <input type="text" name="phone" value="" maxlength="200" size="22"> Comments:<textarea name="comments" cols="31" rows="5"></textarea> <input type="submit" name="send" value="Send"> <form>
  14. Can someone give me an exapmle of how to have an image loading while a div is loading the content using ajax <div id=loading>Loading.......</div> //this will only show while the div is loading
  15. Thanks. this is alot simpler, i did it with strpos() but its a bit of work $url = parse_url($url); $url = $url['host']; $url = substr($url, 0, -4); //remove .com $url_subdomain = strpos($url, '.'); // if subdomain count characters if ($url_subdomain !== false) { $url_subdomain = $url_subdomain +1; $url = substr($url, $url_subdomain); // remove subdomain } Think ill use explode instead
  16. How can i strip a ".com" and the sudomain "sub." from a url Ive already striped the http:// part now im just left with the rest "sub.site.com" $url = parse_url("http://sub.site.com"); $display_website = $url['host'] ); What i need is just the "site" part of the url
  17. Had a look at a couple of ajax demos - impressive. Think ill learn it
  18. Yes. This is even better - less code = less thinking
  19. How can i $_POST an id without leaving the page im on Basically i want to post id "486" to page add.php add.php?id=486 I can have a link on the page im currently on like this: <a href="javascript:void(0)" onclick="add(486)">Add</a> Im not sure how to go about it
  20. Yes this would make it easier to remember Thanks
  21. If i have a file thats 500 KB in size what do i use in filesize function, bytes or kilobytes $file = "video.mpg"; //video is 514kb in size if (filesize($file) < 750){ echo $file." too small <br>"; }
  22. Im trying to see if a file has a certain name part $file = "video-of-something.mpg"; if ($file has "video"){ echo "file has video in the name"; } I just need to check if the $file has "video" in the string
  23. Ok - will do. Ill do some searching tonight on how to set it up
  24. The question you should ask your self is "why do I want to run this bash script". If you want to run it by calling a url in your browser you could use php using the exe function Im on a mission to learn every available programming language i can - Its my hobby I didnt know you can run shell commands with a function
×
×
  • 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.