|
|
|
Thursday, 02 February 2012 23:54 |
// Simple PHP Math Image Captcha
// captcha width
$captcha_w = 150;
// captcha height
$captcha_h = 50;
// minimum font size; each operation element changes size
$min_font_size = 12;
// maximum font size
$max_font_size = 18;
// rotation angle
$angle = 20;
// background grid size
$bg_size = 13;
// path to font - needed to display the operation elements
$font_path = 'fonts/courbd.ttf';
// array of possible operators
$operators=array('+','-','*');
// first number random value; keep it lower than $second_num
$first_num = rand(1,5);
// second number random value
$second_num = rand(6,11);
?>
Credits: 4Dlink Weblists and web4link.com dir Read more: |
|
|
Tuesday, 31 January 2012 23:39 |
// ZIP File PHP source code script credits devco.net
//download this function first - http://uk2.php.net/manual/en/ref.zip.php
require ("incl/zipfile.inc.php");
$zipfile = new zipfile();
$filedata = implode("", file("incl/zipfile.inc.php"));
$zipfile->add_dir("incl/");
$zipfile->add_file($filedata, "incl/zipfile.inc.php");
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=zipfile.zip");
echo $zipfile->file();
?>
Credits: 4DLink Web Lists and Web 4 link Read more: |
|
Wednesday, 18 January 2012 09:45 |
PHP MySQL Select Row Randomly Fast
//CODE FROM WWW.GREGGDEV.COM
function random_row($table, $column) {
$max_sql = "SELECT max(" . $column . ")
AS max_id
FROM " . $table;
$max_row = mysql_fetch_array(mysql_query($max_sql));
$random_number = mt_rand(1, $max_row['max_id']);
$random_sql = "SELECT * FROM " . $table . "
WHERE " . $column . " >= " . $random_number . "
ORDER BY " . $column . " ASC
LIMIT 1";
$random_row = mysql_fetch_row(mysql_query($random_sql));
if (!is_array($random_row)) {
$random_sql = "SELECT * FROM " . $table . "
WHERE " . $column . " < " . $random_number . "
ORDER BY " . $column . " DESC
LIMIT 1";
$random_row = mysql_fetch_row(mysql_query($random_sql));
}
return $random_row;
}
//USAGE
echo '';
print_r(random_row('YOUR_TABLE', 'YOUR_COLUMN'));
echo ' ';
?>
Credits: 4dlink web lists and web4link.com Read more: |
|
|
Thursday, 05 January 2012 01:30 |
Syntax: extract(array,extract_rules,prefix)
Sample code:
$a = 'Original';
$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");
extract($my_array);
echo "\$a = $a; \$b = $b; \$c = $c";
?>
OUTPUT:
$a = Cat; $b = Dog; $c = Horse
Credit: 4DLink Dir and W3Schools.com | Web4link
 Read more: |
|
Thursday, 29 December 2011 09:05 |
Pop Under Javascript Code
replace http://www.your-Domain.com with your own domain
Credits: HighPR 4DLink and DesignerWiz.com Read more: |
|
|
|
|
|