Jump to content

lynxus

Members
  • Posts

    286
  • Joined

  • Last visited

    Never

Everything posted by lynxus

  1. Hi Guys, I have a question.. I have the below html5 code that will show a html5 notification: <script> function RequestPermission (callback) { window.webkitNotifications.requestPermission(callback); } function showNotification(){ if (window.webkitNotifications.checkPermission() > 0) { RequestPermission(showNotification); } else { window.webkitNotifications.createNotification("http://a1.twimg.com/profile_images/710503034/lillypad_rss_normal.png", "TITLE", "Hello, Im a message.").show(); } } </script> How can I use ajax to call notify.php and if notify.php returns the value of "1" the page / ajax will then call the showNotification() function? Please anyone? This is killing me and I suck @ JS / Ajax / Jquery.. An example code would be ace. Essentially im looking for something like. ajaxrequest="notify.php" if ajaxrequest.answer = "1" { showNotification(); } Any thoughts?
  2. You Sir, Are awesome! Thanks very much. Seems to work perfectly. Been working with mysql for years and can never get to grip with dates. TYVM! +-------+---------------------+ | num | time | +-------+---------------------+ | 2523 | 2010-09-16 01:16:44 | | 5099 | 2010-09-15 01:29:49 | | 4450 | 2010-09-14 00:59:52 | | 4520 | 2010-09-13 01:09:22 | | 3821 | 2010-09-12 00:35:59 | | 3678 | 2010-09-11 00:38:43 | | 4113 | 2010-09-10 00:21:41 | | 8967 | 2010-09-09 00:54:38 | | 5675 | 2010-09-08 00:26:58 | | 6443 | 2010-09-07 00:11:01 | | 6438 | 2010-09-06 00:32:14 | | 6987 | 2010-09-05 00:22:10 | | 6520 | 2010-09-04 00:13:09 | | 6183 | 2010-09-03 00:24:40 | | 5873 | 2010-09-02 00:36:49 | | 4198 | 2010-09-01 16:49:55 | | 7666 | 2010-08-31 00:24:56 | | 8065 | 2010-08-30 00:12:09 | | 6659 | 2010-08-29 02:42:18 | | 6990 | 2010-08-28 00:32:07 | | 7500 | 2010-08-27 01:22:08 | | 7835 | 2010-08-26 01:53:50 | | 9492 | 2010-08-25 01:35:59 | | 8840 | 2010-08-24 01:41:53 | | 8897 | 2010-08-23 01:20:19 | | 10663 | 2010-08-22 01:19:16 | | 7469 | 2010-08-21 18:53:21 | | 8764 | 2010-08-20 02:49:38 | | 8076 | 2010-08-19 01:56:28 | | 10755 | 2010-08-18 04:42:17 | +-------+---------------------+ 30 rows in set (0.48 sec)
  3. Hi Guys, Ive got a DB with website visitor details in like below: Table = visitors for this example, lets say it has the colums, ID , DATE 1 2010-07-02 00:08:03 2 2010-07-02 00:08:03 3 2010-07-03 00:09:03 4 2010-07-04 00:02:03 5 2010-07-04 00:04:03 Etc.. Now, I want to find HOW many rows for each day for the last 30 days.. So i can output.. Day1 - 30 ( 30 rows match for this day, Thus 30 visitors.. ) Day2 - 20 Day3 - 44 Etc.. Does this make sense? This way i can then chart how many visitors have visited in the last 30 days.. Does this make sense? Any ideas what syntax to use to do this query? I suppose i will want to While through it 30 times to retrive the value so i can build the string with values .. ( or an array with 30 values? ) Thanks G
  4. Thanks for your help. I never thought about the GET issue. Ive resolved it by doing this in JS ( before sending data ) message = message.replace("&", "%amp"); message = message.replace("+", "%plus"); Then in PHP i have: $message = str_replace("%amp", "&", $message); $message = str_replace("%plus", "+", $message); Then i escape the string. @ Wildteen. The form is being sent via Ajax. So im using ajax.open(get,url,true); Ive "hacked it" so it works now. I will eventually change the JS / Ajax to use POST
  5. I take it, If i use htmlentitys is this a js function too? Ie: JS replace/htmlentitys encode the string.. PHP can then decode the scriing.. and pass to the DB? Thanks G
  6. Ahhh shit yeah. I suppose i need to encode it in JS somehow.. Or post it.. I didnt think of that.. Thanks G
  7. Heres the entire code: $username=$_SERVER['REMOTE_ADDR']; $message = $_GET['message']; $siteid = $_GET['siteid']; $owner = $_GET['username']; // If the user hasnt entered anything just die silently, Stops them from filling screen with empty lines. if ($message == "") { die; } $error = "0"; $con = mysql_connect("localhost","UNAME","PASSWORD"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("DB", $con); $siteid = mysql_real_escape_string($siteid); $username = mysql_real_escape_string($username); $owner = mysql_real_escape_string($owner); $message = mysql_real_escape_string($message); mysql_query("INSERT INTO data (username, message, owner, siteid, dispname) VALUES ('$username', '$message', '$owner', '$siteid', '$owner')"); mysql_close($con);
  8. Hi Guys, Im having issues with mysql_real_escape_string For instance, I understand that it only escapes chars, However they just are not entering the DB.. For example. $message = "How much is P&P to the UK?"; $message = mysql_real_escape_string($message); However when i insert it into a mysql DB, it only inserts "How much is P" Any ideas how i can get this to work. I want to have these %^&*%$£"!"@ chars in the DB however i want to avoid injections the best way possible. Any help would be grateful. Thanks G
  9. TY, i will give it a try, seems sensible. Thanks G
  10. Hi Guys, Lets say i have: $nums = "70,60,50,40,30,20,10"; How can i somehow invert it so it reads: $nums = "10,20,30,40,50,60,70"; I hope someone can help, Its driving me crazy.
  11. Thanks man, That seems to work Thanks again.
  12. Cool, This is where my PHP goes bad. I really cant get to grips with the date function and matching it against a date thats in a var.
  13. Hi Guys, I have a script that has a date stamp like $datetime = "Jun 25 15:40:54" How can i check this against the system time and only do stuff if its in the last 2 minutes? Ie: if ($datetime "is in the last 2 minutes") { do stuff; } Info: Its a linux server if that helps. Any help here would be great. Thanks G
  14. I cant seem to find the pages with size 8 text? Everything appears to have a minimum size of 12px..
  15. Hi , Thanks for your input. Not sure why the menus are different as they should be included from one file.. Odd. Ill take a look. Ill also change the text on the other pages. Im never sure what font size to use best for my sites. Ill re-jigg the trial stuff. ( There is no download page, its all webbased ) Thanks for your input. -G
  16. I have made some major changes now. Menus have been re-done and gfx have been redone. Any thoughts? Should leave well alone now? -G
  17. Yeah, if you want someone to review your site, i really wouldn't suggest asking people to pay to see it. ( even if it is $0.01 )
  18. I would of thought execing an external system file wouldnt of timed out. I run a local whois through a php script and sometimes the local whois takes forever without timing out. Maybe try no hupping the program? ie: exec('nohup ftp some_other_code &'); or maybe just do it in perl to save some headache?
  19. Thanks for the comment. Ill make sure to change the links and the features page.
  20. Hi Guys, I've been working hard in the background for some time now and have finished what should "hopefully" be a professional looking website. Any ideas? Thoughts? General opinion ? http://www.imsupporting.com Thanks G
  21. to grab the number? in index.php do: $number = $_GET['id']; echo "$number"; ( Will print 34 )
  22. Hi guys, Ive got a few pages in an array Ie: blaa.com?stat=1 blaa.com?moo=2 blaa.com?other=3 How can i get PHP to while through my $url and load eahc of those pages. Those PHPpages then take teh value and do stuff. I just need to find a whiel to while through the urls so it sends the data.. Any ideas? Also id like it to timeout after 5 seconds ( teh server may be busy ) IE: echo "Updating url $url"; update the url; echo "done"; Then repeat until the array is empty ?
  23. you could maybe use str_replace? str_replace(' ', '', $tags); http://php.net/manual/en/function.str-replace.php ?
  24. We pay for Redhat enterprise. Its not bad. The support is good and we also pay for redhat satalite ( so we can do decent package management for our systems ) While, i would personally stick to centos. I fyour business really wants it, Just go to RHEL.
×
×
  • 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.