How to execute PHP with cron
Every now and then you will run across a task that needs to be executed through PHP however this task cannot or should not be ran by a visitor opening a webpage (such as a maintanance or caching script). The only way to run these scripts would be to do [...]
Archive for December, 2009
How to execute PHP with cron
Generating random passwords
Generating random passwords
It becomes practical and more useful if the tutorial is written in the form of a funtction. This function will hopefully work anywhere.
The basic idea behind this random password is that it will give a different password every time it is called. This can only be done by using the time as the [...]
Looping Statements in PHP
In programming it is often required to repeat a block of code for a given number of times or until a certain condition is not true. For this, we use looping statements. PHP has two major looping statements (FOR and WHILE).
In common practice, FOR loop is mostly used when we need to loop a code [...]
PHP Login script tutorial
PHP Login script tutorial
Overview In this tutorial create 3 files
1. main_login.php
2. checklogin.php
3. login_success.php
Step
1. Create table “members” in database “test”.
2. Create file main_login.php.
3. Create file checklogin.php.
4. Create file login_success.php.
5. Create file logout.php
1- Create table “members”
Code:
CREATE TABLE `members` (
[...]
Simple Ad Rotation Script
Overview
In this script (very easy script), we have 3 ads for rotation
first ad we want it to display 70%
second ad we want to display 20%
and the last one we want to display 10%
What to do
1. Random number 1-100
- if result = 1-70 (we have opportunity to display ad 1, 70%)
- if result = 71-90 (we [...]
Get adsense stats from PHP
Get adsense stats from PHP
Why not let your own script fetch the statistics directly from google adsense reporting site? It’s always much easier to have the data locally in your own database, and then create scripts to display the stats in the way you are interested in.
I will now give you the code that collects [...]
XML processing with PHP
XML processing with PHP
Introduction
XML is Extensible Markup Language. It is a markup language – much like HTML – and was designed to describe data. XML uses tags but these tags are not predefined as in HTML. In XML you define your own tags. All XML documents have 3 types of components: Elements, attributes and data.
Let’s [...]
Simple PHP Hit Counter Script
Important
It is worth noting that this tutorial is paginated, and that the entire tutorial contains 4 pages. Just remember that the tutorial is not finished just after the first page!
PHP 4+ is required for this tutorial. PHP 5 is optional
This tutorial is for beginners with very limited knowledge of PHP. You will learn [...]
Basic Variables
Basic Variables
PHP Code:
<?php
$hello=”Hello people,”;
$php=”this is my first PHP script.”;
$php2=”FTW!”;
echo $hello.” ”.$php.” ”.$php2;
?>
Outputs….
Quote:
Hello people, this is my first PHP script. FTW!
I could of used just one variable, for example….
PHP Code:
<?php
$text=”Hello people, his is my first PHP script. FTW!”;
echo $text;
?>
But I wanted to use multi variables ftw. Learn how to join them and put spaces between then and shiz.
The . is used to [...]
Dynamic PHP Google Sitemap
Dynamic PHP Google Sitemap
This tutorial will show You how to generate google sitemaps based on Your site MySQL structure.
What is Google Sitemap?
About Google sitemap You can read on my Google Sitemap basics tutorial.
Now some theory
First – we need a site which we want to be “mapped”. I’ll show a basic one:
index.php – main page which [...]
