Title.zip

What is Twitter Cards?

398

Twitter Card is a metadata protocol used by Twitter to display rich media (like images,videos,and previews) when a link to a webpage is shared on the platform.By adding specific meta tags to the section of a webpage's HTML,developers can control how conten...

What is OpenGraph?

364

Open Graph is a protocol originally created by Facebook that allows web pages to become rich objects within social media platforms.By using Open Graph meta tags in the HTML of a webpage,developers can control how their content is displayed when shared on s...

JavaScript Code to Get Page Keywords

342

Keywords are important because they help convey the subject and purpose of content to both users and search engines.In the context of web development and SEO (Search Engine Optimization),keywords serve several critical roles,including improving discoverabi...

Code to Extract the Site Thumbnail Image for Twitter or Facebook

386

To extract a site thumbnail (often referred to as Open Graph or Twitter Card image) from an HTML string,we need to look for specific tags that are commonly used for social media sharing on platforms like Facebook and Twitter.These tags include Open Graph (...

HTML redirection in PHP

398

HTML redirection,in the context of PHP,involves using the `header()` function to send an HTTP redirect header to the browser,instructing it to load a different URL.This is typically achieved by setting the `Location` header to the target URL.For instance,`...

How to get current filename as variable ?

767

Sometimes you need just the filename of the current script,without the path.This snippet does just that using the SCRIPT_NAME and explode function. Getting the Current Filename as a VariableHere's how to retrieve the current filename in your script::Unders...

email validation, simple

411

Let's assume a email validation function - returns TRUE or FALSE.Checks format only,does not use any networking functions to verify the account actually exists.

for loop - simple

448

for loop - basic control structure. This example loops until the variable hits 10 and then breaks out. 10) {       break;   }   echo $i;}?>sample output :12345678910

form action - detect form post

427

PHP provides super global variables which is available anywhere.1.$_POST Superglobal:- This array holds all data submitted via the HTTP POST method.It's the most common way to access form data.- To access a form field value,use the field name as the key: ....

How to make random number ?

515

Generate a random number using mt_rand.From the php documentation- "If called without the optional min,max arguments mt_rand() returns a pseudo-random value between 0 and RAND_MAX.If you want a random number between 5 and 15 (inclusive),for example,use mt_...

How to force cookies, disable php sessid in URL ?

552

This commands disables php from rewriting URLs to add a phpsessid, and forces the use of cookie sessions instead. Using cookies is largely thought of as the preferred way to use sessions - both more secure and better for SEO. This can be accomplished by se...

How to include a file with error reporting ?

426

Sometimes you want to be able to give some feedback if a PHP include has failed.Here is a version using the fopen command,which can search the include path. Here's another example much better simple than the above.As you can see,just add @ in front of the ...

PHP form handling example in single page

412

This example shows a very simple form together with the form handling process on a single page. Below is another approach based on Heredoc I like:

How to get Referral URL ?

2,068

Grabs the referring URL - get the HTTP_REFERER and save it to a variable. code snippet: .While not inherently intended for API security,the HTTP_REFERER header can be a valuable tool for implementing an API that restricts access to certain resources based ...

How to convert formatted date time string to datetime?

443

Whatever the formatted string is,strtotime() function convert the formatted date time string to datetime.Following example shows the simple reference can convert date time string whatever the formatted input is.

Adding and Subtracting Time

553

The time () function generates a long string of numbers representing how many seconds have passed since January 1, 1970. It is possible to add and subtract time by adding and subtracting seconds.

The three simplest regular expressions you will use in PHP

580

The three most basic searches using regular expressions are searching for the strings start, the strings end, or for characters it contains. We can do these using the following symbols:^ indicates the string starts with the specified characters, so "^strcp...

Number Format

481

In this article we'll make number format like 0001, 0002, 0003 in stead of 1, 2 ,3. It's very easy to do this for your counter, category or product ID. etc.

A Function Returns Large Random Numbers

425

This basically randomly pick a number between the min and max values. This is made because the rand() and mt_rand() function can not accept numbers larger than 2^31 or 2^63,depend on your processor and complier.

Function AccountCryptPassword($password,$salt)

724

Encryption and password account accessFunction AccountCryptPassword($password,$salt) {  if($salt=="")  {   srand(time());   $random=rand();   $itoa64=". / 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; ...

Cardinal Endings

490

This php based script will find numbers and give them a cardinal ending.This can be useful for displaying rankings or results of a competition.The script is easy to install and use .Explanation::addOrdinalSuffix($number): This function adds the appropriate...

URL Rewriter PHP

612

URL Rewriter PHP is a short code that can be used to rewrite dynamic PHP urls as URL's that link to static htmlpages.Increases search engine rankings by creating a static system of page linking as well as making all content available. Associated Data for U...