Jump to content

RobertP

Members
  • Posts

    287
  • Joined

  • Last visited

Everything posted by RobertP

  1. $(window).ready(function(){ $("span#console").html("Loaded"); $("html").mousedown(function(e){ $("span#console").html("id="+$(this).closest("div").attr("id")); }); });​
  2. the header function sends the header. if the browser wants to obey that header is another question. it is possible to turn off the redirect headers for most browsers. don't rely on your visitors hardware.
  3. as long as it wont fire any unexpected code, then there should be no problems.
  4. http://jsfiddle.net/AwzVJ/ i need to get the id of the closest div. in my example i need to get the id fr=or div#context :S
  5. function getTimeByZone($zone){ $default = date_default_timezone_get(); $defaultOffset = date('Z'); date_default_timezone_set($zone); $offset = date('Z'); date_default_timezone_set($default); return ($offset-$defaultOffset)+time(); } echo date('d-m-Y h:i:s a',getTimeByZone('America/Toronto')).'<br />'; echo date('d-m-Y h:i:s a',getTimeByZone('Europe/Lisbon')).'<br />'; echo date('d-m-Y h:i:s a',getTimeByZone('Asia/Tokyo')).'<br />'; echo date('d-m-Y h:i:s a',getTimeByZone('Pacific/Samoa')).'<br />'; exit; results: 17-06-2012 09:15:24 pm 18-06-2012 02:15:24 am 18-06-2012 10:15:24 am 17-06-2012 02:15:24 pm
  6. to your question, should i validate against regex? well i do for my login system. but its not needed 100% as you have already validated their email address when they created their account.
  7. well hosting the database on their network is just as easy as hosting it over the internet. about protecting your code, you just need to make sure the server is secure.
  8. woow .. (glad to be a father !)
  9. you will need to sanitize if you plan to use that information anywhere else. for example logging failed login attempts for admin accounts ..
  10. case insensitive (simple match) $haystack^=$needle (starts with) $haystack$=$needle (ends with) case sensitive (exact) $haystack^==$needle (starts with) $haystack$==$needle (ends with)
  11. this is a little ''way'' off topic, but does anyone know what car this is?
  12. got it !! preg_match_all('/[<]td[>]([^<]*)[<][\/]td/i',strip_tags($data,'<td>'),$matches,PREG_PATTERN_ORDER);
  13. the javascript runs on your domain, so the cookies save their aswell.
  14. <table> <tr class="even_tr"> <td> 2012-06-15 </td> <td>git.gludoe.com</td> <td>963.00KB</td> </tr> </table> preg_match_all("/\<td\>(.*)\<\/td\>/",strip_tags($data,'<td>'),$matches); i remove all the html tags except td because some td's have <b> in them.
  15. maybe more comparison operators? $haystack^=$needle (starts with) $haystack$=$needle (ends with) etc..
  16. You can use jQuery.post to send information from javascript to php, and use jQuery.getJSON to send data from php to javascript.
  17. nothing should be before your html tag, except your doctype doctage <html> <head> ... </head> <body> ... </body> </html> & some reading material: http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#adef-scope
  18. http://www.webfaction.com?affiliate=sikken The best i have ever seen.
  19. well i have been looking into git, this might be helpful .. or it might not be. (just through down my idea)
  20. RobertP

    PHP 5.4

    Just to inform everyone, time to move to PDO if you have not already. mysql_* functions are *soft deprecated* ...
  21. i think i got it working? can someone test aswell please? function getTimeByZone($zone){ $default = date_default_timezone_get(); date_default_timezone_set($zone); $time = time()+date('Z'); date_default_timezone_set($default); return $time; }
  22. would this work? function getTimeByZone($zone){ return strtotime((new DateTime(null,new DateTimeZone($zone)))->format('Y-m-d H:i:sP')); } ps: i need the current unix timestamp for the zone
  23. has anyone attempted this? php version:5.4.3 function getTimeByZone($zone){ $default = ini_get('date.timezone'); ini_set('date.timezone',$zone); $time = time(); ini_set('date.timezone',$default); return $time; } echo getTimeByZone('America/Toronto').'<br />'; echo getTimeByZone('Europe/Amsterdam').'<br />'; echo getTimeByZone('GMT-8').'<br />'; outputs all the same. ps: i know i should use http://php.net/manual/en/book.datetime.php, but i cant seem to get it working properly, same output as above. $date->setTimezone(new DateTimeZone('GMT-8') );
×
×
  • 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.