Archive | Php Source Codes

How to get the password if it’s saved on the computer using Javascript.

Let’s say your password is saved on Hotmail.com, open the site, replace Hotmail.com with this code :

javascript:(function(){var s,F,j,f,i; s = “”; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == “password”) s += f[i].value + “\n”; } } if (s) alert(“Passwords in forms on this page:\n\n” + s); else alert(“There are no passwords in forms on this page.”);})();

Hit Enter: A pop-up will come saying the password.
Also can be used if your in a friend’s house.

Source:- Teachpk.com

Posted in Computer Tips, Internet Tips, Php Source Codes

Get visitors IP address

How to get visitors IP address? If you want to get your web site visitor’s IP address then PHP provides you complete solution for this. I made a function to get IP address of visitor.

<?php
function visitorip() {
    if (getenv(‘HTTP_CLIENT_IP’)) $ip = getenv(‘HTTP_CLIENT_IP’);
    elseif (getenv(‘HTTP_X_FORWARDED_FOR’))    $ip = getenv(‘HTTP_X_FORWARDED_FOR’);
    elseif (getenv(‘HTTP_X_FORWARDED’)) $ip = getenv(‘HTTP_X_FORWARDED’);
    elseif (getenv(‘HTTP_FORWARDED_FOR’)) $ip = getenv(‘HTTP_FORWARDED_FOR’);
    elseif (getenv(‘HTTP_FORWARDED’)) $ip = getenv(‘HTTP_FORWARDED’);
    else $ip = $_SERVER['REMOTE_ADDR'];
    return $ip;
}

echo “Your IP address is “.visitorip();
?>
In result web site visitor’s ip address will appear. In example above i made a function named visitorip() will check all conditions for getting ip and will return ip address. echo command of PHP will receive ip address will display on page.

Posted in Php Source Codes

Get current Page URL in php

PHP: How to Get the Current Page URL

PHP programmers need sometimes current page URL to show or save in database. There is no built-in function exist in PHP to get current page url. I made a function to show current page URL.

I used the following built-in $_SERVER array in this function. If you want to show all element return by $_SERVER array then you can use these commands.

<?php
   echo "<pre>";
   print_r ($_SERVER);
   echo "</pre>";
?>

All elements by $_SERVER will appear in your browser window.

I made function which returns current page URL:

<?php
function currenturl() {
   $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
   $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
   $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
   return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI'];
}

function strleft($s1, $s2) {
	return substr($s1, 0, strpos($s1, $s2));
}
?>

Example using function above:

<?php
   echo currenturl();
?>

Posted in Php Source Codes

Get Google crawl date of a web site

Google crawl date in PHP

Google crawl date using PHP source code. Google bot crawls every web site after a specific period. You can check that date using Google’s cache command in Google search engine. Here it is the example of Google cache.
I created PHP function which gets Google bot crawl date and returns in a form of string.
You can use these codes in your PHP applications.
Code are under the marks due to setting of page

function google_crawl_date($url){
  $output = file_get_contents('http://64.233.183.104/search?q=cache:'.
   urlencode($url).'&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_enPK238__238');
  $match_expression = '/appeared on (.*). The <a href/Us';
  preg_match($match_expression,$output,$matches);
  if ($matches[1]=="") return "No Date found";
  else return $matches[1];
}

Usage of function above

<?php
  echo google_craw_date(http://paktelecom.net);
?>

Posted in Php Source Codes

Translator

English flagItalian flagKorean flagChinese (Simplified) flagChinese (Traditional) flagPortuguese flagGerman flagFrench flagSpanish flagJapanese flagArabic flagRussian flagGreek flagDutch flagBulgarian flagCzech flagCroatian flagDanish flagFinnish flagHindi flagPolish flagRomanian flagSwedish flagNorwegian flagCatalan flagFilipino flagHebrew flagIndonesian flagLatvian flagLithuanian flagSerbian flagSlovak flagSlovenian flagUkrainian flagVietnamese flagAlbanian flagEstonian flagGalician flagMaltese flagThai flagTurkish flagHungarian flagBelarus flagIrish flagIcelandic flagMacedonian flagMalay flagPersian flag

Email Subscription

Subscribe via RSS Feed stay updated with blog articles


Receive latest cellular companies news by email, Enter your email address:

Archives

Polls

Which Cellular Company is Best?

View Results

Loading ... Loading ...

Similar Posts

    None Found

Advertise

Twitter Updates