Jump to content

lynxus

Members
  • Posts

    286
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.imsupporting.com

Profile Information

  • Gender
    Not Telling

lynxus's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi Guys, I have two values. 1) Number of users connected. ( Ex: 3456 ) 2) Number of users configured. ( Ex: 4100 ) How can I show this as a percentage. Ie: there are X% users connected. ( A percentage of the total configured ) Now, my maths is normally good but i just dont trust my workings lol. Ive been doing : $percent = $connected / $configured * 100; Thanks L
  2. Hi Guys, I currently have a method of getting a users attention by injecting a flash file in an ajax response and placing it in a div. However, Newer security measures from browsers mean that the file doesnt play on certain versions of certain browsers.. Anyway. Is there another method of achieving this? I see that facebook play a sound when a new message comes in, so it must be possible? ( Html5? ) Essentially I need a website (javascript?) to query playsound.php If playsound.php responds with "1" ( ie it just replies with an output of 1 ) then id like it to play a sound. I would then use a JS timer to run the ajax query every so often to check if it needs to play a sound. Does anyone have any ideas on how I can do this? As it appears my original method of using ajax to fill a div with a flash element is fastly becoming outdated. Thanks in advance Graham
  3. Try putting some id's in the form.. <form action ="reply.php" id="myForm" method="post" > Name: <input type="text" name="name" id="name" size="25" maxlength="50" /> <br> </br> Description: <textarea name="editor1" id="editor1"> </textarea> <input type="submit" value="Submit" /> </form>
  4. Although, I personally didnt use message1 and message2.... The below should work anyway without the need to generate new strings.: $message = preg_replace("/(?<!href=\")((https?:\/\/)(www\.|ftp\.)?[\w\-]+\.[^\s\<]+)(?!\")/ism", "<a href=\"\\1\" target=\"_blank\">\\1</a>", $message); $message = preg_replace("/(?<!http:\/\/)(?<!https:\/\/)((www|ftp)\.[\w\-]+\.[^\s\<]+)(?!\")/ism", "<a href=\"http://\\1\" target=\"_blank\">\\1</a>", $message);
  5. Good times. Thanks muchly. Been trying to learn regex and my brain hurts lol.. Getting there though
  6. Hi, Thanks for taking a look again.. yeah google.com etc dont worry about ( as long as it starts with www. or http:// or ftp. ) is good enough for me. I only put that in the $message as a test to see what your regex did
  7. Thanks very much for your reply. It doesn't seem to do anything? ( it doesn't seem to replace anything and no errors in logs.. ) <html><body> <?php $message = "Why not visit www.google.com or google.com or http://www.google.com or http://google.com or www.google.co.uk or http://google.co.uk "; $message = preg_replace("/^(?<!href=\")(https?:\/\/)?((www|ftp)\.[\w\-]+\.[^\s\<]+)(?!\")/ism", "<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $message); echo $message; ?> </body> </html>
  8. Hi Guys, I have the following code that uses ereg however im useless when it comes to regex so I dont know how to move to preg .. Essentially, It takes a string and makes a URL "clickable" ie: if it finds a link like http://www.google.com it would change http://www.google.com to a proper html href Could someone help convert this to preg so my code is more compatible with newer version of PHP.. Thanks muchly in advance. Graham $message = "Have you seen google? http://www.google.com "; $message = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]"," :link: <a title=\"Click to open in a new window\" alt=\"Click to open in a new window\" target=\"blank\" href=\"\\0\">\\0</a>", $message);
  9. Hi Guys, I have the following code. I have a div named data that gets filled in by the data from data.php How can i get it so it ONLY updates that div when the data is different as currently it doesnt. It seems to update even though its the same ( If i have something selected in teh div, it will de-select when it updates ( although the html is the same )) Thanks in advance. <script language="javascript" type="text/javascript"> <!-- function getdata() { $(document).ready(function(){ $.get("data.php", function(result){ if(result != $("#data").html()) { $("#data").html(result); } }); }); } //--> var timer = null; timer = setInterval('getdata()', 2000); </script>
  10. Ah ha, perfect.. ( Couldn't find that page anywhere ) Thanks again. -G
  11. Is there a list of what can be put into this field: $myDateTime->setTimezone(new DateTimeZone('America/New_York')); I cant seem to find a definitive one
  12. As promised, I tried it and it works perfectly. Thanks very much. -Graham
  13. Cheers man, Ill give it a try in the morning and let yall know.
  14. None currently ( Im assuming the data is correct in the DB ) I get dates from the database ( thats saved as UTC ) Id like to convert some dates on the fly to other timezones ( so i can display datetimes in other peoples locales ) I hope that makes sense?
×
×
  • 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.