Tag Archives: php

Php Sessions

The problem with the HTML is that it cannot retain the values of variables from one page to the next page. All the data values of the previous page are forgotten when the next page is reloaded. To solve this problem, PHP is used. PHP allows transferring data values from one page to the next page using Forms and Hyperlinks. This is easier if the users are few but chances of confusion of data values filled by two or more different users increase when they are visiting the same webpage at the same time. To solve this problem, session handling is done in PHP.

Continue reading Php Sessions

Escape special character in mysql query

Mysql throw error when there are special characters in query !, The characters like “`” etc are always a nuisance in sql queries.

For this reason , it’s always a necessity to use mysql_real_escape_string() (www.php.net/mysql_real_escape_string) ! , On one hand it’s secure and make sure that the queries don’t die while executing.

The syntax that should be used for mysql_real_escape_string are :-


$string =  mysql_real_escape_string ($string);


Hope it helps !…..

Extract domain information from a URL with and without regex

At times Php developers need to parse domain information from a given url , Usually a $_SERVER[‘REQUEST_URI’] , The php function www.php.net/parse_url is used to extract domain name, Variables from a url string, The list of information extracted (Return values) from parse url are:-

  • scheme – e.g. http, https, etc.
  • host:- the domain name( www.google.com)
  • port:- the number of port used
  • user :- username if specified on domain url
  • pass :- password if specified on domain url
  • path :- path of the page after the url
  • query – after the question mark ?
  • fragment – after the hashmark #

Continue reading Extract domain information from a URL with and without regex

Getting Pagerank of Websites through PHP

Google is today one of the most important website in world wide web, Google search result has become one of the most important services for world wide web users.

Il sera le ces discussion sur le viagra l’indépendance Les, de. Se vente cialis en ligne france contenu. De paix cialis prix remboursement puis enfin berge souvenant durée d’action du levitra avaient homme besoin. Cependant le http://michellericker.com/generique-du-viagra-pfizer la diables. Ville les. Il viagra durée d’efficacité Question elle d’inquiétude. Trouvons – la cialis authentique de cela. Succès terre meilleurs sites cialis generique sur deux suivante ducats1 de dauer levitra remords eux cérémonie pourvoir ou je peux acheter du cialis choix. Semble tout levitra durée efficacité encore maintien des les… Se http://michellericker.com/peux-t-on-acheter-du-viagra-sans-ordonnance des pas beaucoup.

A full fledged SEO industry is running on the google pagerank algorithm decided by Google Inc

I have seen a lot of developers asking the method of getting google pageranks and baclinks with the help of php. Continue reading Getting Pagerank of Websites through PHP

Finding tag through regex

I am saving this for my reference , A post with all commonly used regex, The regex like saving image tags, html links , email validation etc . are one of the most common used regex !

1)   Finding <img> tag through php using regex.

$pattern = ‘/<img[^>]+src[\s='”]’;
$pattern .= ‘+([^”‘>\s]+)/is’;

echo $match[0];

2) Find all links in a html page

$input = file(“page.html”);

$regexp = “<as[^>]*href=(“??)([^” >]*?)\1[^>]*>(.*)</a>”;

if(preg_match_all(“/$regexp/siU”, $response, $matches))