URL Shortening for long URLs
This snippet requires a 3rd party service to work.
It will take your url, such as: http://phpsnips.com
and convert it to a shorter URL such as:
http://m8.to/BA
<?php
$long_url = "http://www.
This snippet requires a 3rd party service to work.
It will take your url, such as: http://phpsnips.com
and convert it to a shorter URL such as:
http://m8.to/BA
<?php
$long_url = "http://www.
<?php
// Insert into database
mysql_query("INSERT INTO my_table (`column1`, `column2`) VALUES (‘one’, ‘two’)");
// Next Get what the auto incremented number was that was inserted
$id = mysql_inser
<?php
function watermark($file, $watermark, $pos = null, $x = 0, $y = 0){
$details = getimagesize($file);
$wDetails = getimagesize($watermark);
if(!is_null($pos)){
switch($pos){
case TOP
<?php
function is_prime($num){
for($i=$num;$i > 0;$i–){
$v = $num / $i;
if(!is_float($v)){
if($v != $num && $v != 1)
return FALSE;
}
}
return TRUE;
}
for($i = 1;$i<=100;$
<?php
// include the database
include ‘db.php’;
$query = ‘INSERT INTO `table_name` (`ownerID`, `favorites`) VALUES ‘;
// This foreach we will pretend that we passed an array of
// checkboxs,
<?php
$variable = ‘Hello Kitty!’;
if($variable == ‘Kitty’){
echo ‘Goodbye Kitty.’;
}else{
// Note the extra space before "How"
// Remove it and then see what happens…
echo $vari
<?php
function page_rank($page, $type = ‘alexa’){
switch($type){
case ‘alexa’:
$url = ‘http://alexa.com/siteinfo/’;
$handle = fopen($url.$page, ‘r’);
break;
case ‘google’:
$url
<?php
function return_between($string, $start, $stop){
$st = $string;
$list = array();
for($i=0;$i<strlen($string);$i++){
$temp = strpos($st, $start);
$str = substr($st, $temp+1);
$spl
<?php
include ‘incl/db.php’; // Include the database
// Set the page, use one if the get page is not a number or is negative
if(!isset($_GET[‘page’]) || !ctype_digit($_GET[‘page’]))
$page = 1
<?php
function to_link($string){
return preg_replace("~(http|https|ftp|ftps)://(.*?)(\s|\n|[,.?!](\s|\n)|$)~", ‘<a href="$1://$2">$1://$2</a>$3’,$string);
}
$html = ‘This line of text has three