Posts

Showing posts from August, 2011

how to validate image extention by javascript?

function validate() {     var filename = document.getElementById("pimage").value;            if(filename!='')         {         var ext = getExt(filename);         if(ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "png" || ext == "")         return true;         alert("Please upload image files only.");         return false;         }     }        function getExt(filename)     {         var dot_pos = filename.lastIndexOf(".");         if(dot_pos == -1)             return "";         return filename.substr(dot_pos+1).toLowerCase();     } }

How to find a string in current Url?

If u want to check a string in current url. So go through this note: strpos($_SERVER['REQUEST_URI']); example: if(strpos($_SERVER['REQUEST_URI'],"userprofile")!==false) { Echo “profile.php” } Where $_SERVER['REQUEST_URI'] use for get the current url

How To get the url of last page in php?

In php to find the url of last page on a current page. You should use “$_SERVER['HTTP_REFERER']” $lastPageUrl = $_SERVER['HTTP_REFERER'];

How to increase the time of execution or Fatal error: Maximum execution time of 60 seconds exceeded

Sometimes execution of my $command lasts too long and after 1min it stop execution and i receive this error: Copy and paste the at the top or of your file which file you are running; ini_set('max_execution_time', 0); Setting it to 0 will make your script run forever according to the documentation of the ini-directive .

load() – jQuery API or how to use load function of jquery?

$('#likediv').load('ajax/like-updates.php',{ 'category':cat ,'type_id': typeid,'user_id': userid}); Example : function likeEvent(cat,typeid,userid) { $('#likediv').load('ajax/like-updates.php',{ 'category':cat ,'type_id': typeid,'user_id': userid}); } Note:   #like => div is a id of div where you will want to show your data. load => is a function where we gave path of a file where calculation takes place. { 'category':cat ,'type_id': typeid,'user_id': userid} => in braces we pass the parameter like there are passing 3 parameter Finally we can call a this function on any event

ul li horizontal css menu?

How to create ul li horizontal menu for header in html <style> ul { list-style-type: none; margin: auto; } li { float:left;} </style> <ul> <li>Home |&nbsp; </li> <li>about us |&nbsp; </li> <li>Help </li> </ul>