Install the Most Popular Web Applications with 1 Click

InstantInstall allows you to install 9 of the most popular web applications by just uploading a simple PHP file to your server and pointing your browser to it.

You just need remote downloading enabled on your server (file_get_contents specifically) and the memory limit to a higher amount (to avoid script interruptions due to running out of memory).

Currently you can download and install the following PHP scripts using InstantInstall:

  1. WordPress – the most popular blogging platform
  2. bbPress – forum software, created by the WordPress crew
  3. Chyrp – lightweight blogging engine
  4. Drupal – CMS
  5. Joomla – portal engine
  6. phpBB – forum engine
  7. PrestaShop – eCommerce engine
  8. Symphony – web PHP framework
  9. Vanilla – forum software

[ad name=”In Post (LU)”]

Credit Card Validation Function

Credit Card

Whethere you are building a shopping cart or just requesting your customer’s credit card number for some purpose, we are constantly faced with abusers that fill invalid or fake credit card numbers. This little function courtesy of SoftwareProjects.com will help you avoid that.

function validCC($cc_num) 
{ 
  $pattern = "/^3[47]d{13}$/";//American Express 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 
  
  $pattern = "/^([30|36|38]{2})([0-9]{12})$/";//Diner's Club 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 
  
  $pattern = "/^6011d{12}$/";//Discover Card 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 
  
  $pattern = "/^5[12345]d{14}$/";//Mastercard 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 
    
  $pattern = "/^4d{12}(ddd){0,1}$/";//Visa 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 

  $pattern = "/^30[012345]d{11}$/";//Diners 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 

  $pattern = "/^3[68]d{12}$/";//Diners #2 
  if (preg_match($pattern,$cc_num)) 
  { 
    return true; 
  } 

  // Not valid 
  return false;  
}

[ad name=”In Post (LU)”]
Usage is as follows:

echo validCC("card_number_here");

Of course, it can’t check if the credit card really exists and if it has any ballance, because that’s confidential information, but at least you won’t get random numbers anymore.

Simple Random Password Generator

11232_1127502322347_1670876517_265475_2130746_n

This is a simple script that will generate a random alphanumeric password with customizeable lenght.


[ad name=”In Post”]
Usage is as follows:


The example above will return a random password with 5 characters. If you want a random password with more characters replace the five with another number (the limit is 32, enforced by the md5() function). If you don’t set the password lenght, the function will return an 8 character password by default.

Set PHP Script Timeout

Clock Icon

Most of the times the PHP script timeout is set by default by your hosting company to 30 seconds. This means that after 30 seconds of running, your script is immediately killed, which means that all the actions are not completed successfully (if they take more than 30 seconds).

You may easily increase this limit though (or decrease it, e.g to stop abusive users from running abusive code through a possible PHP exploit). One of the ways is to set the time limit inside the php.ini file, if you have access to it.

Another way is to use the set_time_limit() directive at the beginning of your PHP script. The function accepts one parameter, which is the amount of seconds the script is allowed to run. Note that this directive will have no effect if your PHP’s safe_mode is turned on.

The usage is like this:


The above code will set the PHP timeout to 60 seconds. If you want to use larger values (e.g an hour), you can easily use a matematical formula like 60*60 for 60 minutes or 5*60 for five minutes and so on.

[ad name=”In Post (LU)”]

If you want to remove the timeout completely (your script will run forever until it’s manually killed through the task manager), you can use set_time_limit(0).

Simple PHP Script to Send Email with Mail()

gmail_mailbox

There are three requirements for sending email through a PHP script: A form, an email processing script, and PHP’s mail() function to be enabled (most hosts have this enabled, but some shared hosts don’t).

Place this inside a file called mail.html





[ad name=”In Post”]
The email processing script should be inside a file called mail.php:

if(!isset($_POST['receiver'], $_POST['sender'], $_POST['subject'], $_POST['message'])) die("Error sending email"); // check if the page is tried to be accessed directly (e.g. a hacking attempt)

$to = $_POST['receiver'];
$from = $_POST['sender'];
$subject = $_POST['subject'];
$message = $_POST['message'];

$headers = "From: " . $from . "rn" .
    "Reply-To: " . $from . "rn" .
    "X-Mailer: PHP/" . phpversion();

$send = mail($to, $subject, $message, $headers);

You should take into account that this is the simplest form of the email sending script. Security measures have not been implemented, such as email validation, message filtering for harmful code (e.g. javascript injection). If you are going to use this script for a fairly popular project, I recommend that you implement some variable validation and even a captcha to avoid spam. If there is enough interest, I could make some more tutorials on those in the future.