4
Url rewriting examples using .htaccess
Hi here i will explain some URL rewriting magic using .htaccess file.
1)Rewriting user.php?id=12 to user-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?”...
How to display popular posts in wordpress
I came across different wordpress themes where they wont provide the popular post catogory, so this a simple tip to help you guys regarding the addition of how to display popular posts in wordpress themes.Usually the SIDEBAR.PHP is the is the...
Simple file upload script using php
Here i will explain a simple php script which will upload files to a particular directory specified
< ?php
session_start();
if(!isset($_POST['upload'])) {
echo '
<form name="upload" enctype="multipart/form-data" method="POST"...
Appending string using php to a text file
A very easy way to append string to a file using simple php script
<?php
$fn = “file.txt”;
$file = fopen($fn, “a+”);
$space.= “\n”;
if($_POST['addition']) fwrite($file, $_POST['addition']);
fwrite...
Get IP address using gethostbyname() function
gethostbyname() is used to get the IP address corresponding to a given Internet host name.Examples code:<?php$ip = gethostbyname(‘www.mistonline.in’);echo $ip;?>One way to discover your IP address automatically:<?php//...
Simple PHP Login Script
This is simple PHP login script
Our 1st step is to Create table “mydata” in database “test”.
———————————————————————–
CREATE TABLE ‘mydata’ (
`id` int(4) NOT NULL auto_increment,
`username`...
Arrays In PHP
There are two types of arrays we deal with in PHP.
Numeric Arrays
<?php $employee_names[0] = "Raj";
$employee_names[1] = "Thomas";
$employee_names[2] = "Anil";
echo "The first employee's name is ".$employee_names[0];
echo "<br>";
echo...
Php mysql example image gallery blob storage
abstract
This is a simple example of photo-gallery script, which uses MySQL table (BLOB field) to store images. Trivial password-protection, uploading and deleting images are supported. For Apache-version of PHP there is advanced browser-caching...
Caching of web page using php
In the modern days, most of the sites are database driven. That means that your site is actually an application which retrieves data from a DBMS ( database managment system, eg MySQL) , parses the data and shows the result to the user. Most...
How to create random passwords using php
Hi visitors here i will explain how we can create random password using simple php script.
function Random_Password($length) {
srand(date("s"));
$possible_charactors = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$string...
Hit counter using php
PHP Hit Counter
Welcome, this tutorial will guide you on how to make a PHP hit counter.
Requirments: You should know the basics to a file system unit.
Step 1: We need to create a script called ‘counter.php’ and a text file called...
Creating a simple class file using PHP
Here i will just demonstrate how to create simple php scripts using classes.First we should create a CLASS file
<?php class CarCounter{var $cars = 0;var $weightPerCar = 500.0; function add($n = 1){$this->cars = $this->cars + $n;} function...
Replacing a string using php
Simple code to replace a string using a very simple approach.
You can’t do this with ereg_replace, but you can with preg_replace.
<?
$var = ‘abcdef abcdef abcdef’;
// pattern, replacement, string
echo ereg_replace(‘abc’, ’123′, $var); // outputs ’123def 123def 123def’
// pattern, replacement, string, limit
echo preg_replace(‘/abc/’, ’123′, $var, 1); // outputs ’123def abcdef abcdef’
?>
VN:F...
