August 24th, 2010
Have a database bigger than 2MB? want to import them somewhere else? but you cant and PHPmyAdmin just gave you the dead end message below?
No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.
Have no fear, there’s a solution:
Look for the php.ini file -> c:/wamp/www/apache2/bin/php.ini
Then change the following lines:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
To these new values:
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 100M
Then restart wamp5 and retry importing…
Happy coding
Tags: importing large database, large sql, MySQL, PHP, php.ini, phpmyadmin
Posted in Found, MySQL, PHP, What I have learned today | No Comments »
August 19th, 2010
What’s a webserver directory index anyway?
When an HTTP client (generally a Web browser) requests a URL that points to a directory structure instead of an actual Web page within the directory, the Web server will generally serve a general page, which is often referred to as a main or “index” page.
Most often index.html or index.php are used by developers, but we can set it to any file we want to with the help of .htaccess
on your .htaccess file write:
Above code is just telling that I want the file home.html be by default index page.
but you can also do this:
DirectoryIndex home.html index.html index.php
Above is telling the server that to use home.html as my default index page and if not use index.html else use index.php and so on…
So that’s it, fairly easy…
Tags: .htacces, deafult index file, DirectoryIndex, webserver directory index
Posted in Found, General, Server, What I have learned today | No Comments »
August 5th, 2010
If you want to see the error page in theme design and don’t like redirecting to error page URL or duplicating HTML in the error page template, here is a way to apply your theme template to the error page.
First, put the following code in templates/system/error.php:
Dont forget to put it
<?php
if ($this->error->code == '404') {
header('Location:www.domain.com/your-custom-error-page.html');
exit();
}
?>
Thats it!
Tags: 404, 404 redirect, joomla 404, joomla custom 404
Posted in General, PHP | No Comments »
July 17th, 2010
Here’s the code im using for all of the websites and projects
<?php
session_start();
$strlength = rand(4,7);
for($i=1;$i<=$strlength;$i++){
$textornumber = rand(1,3);
if($textornumber == 1){
$captchastr .= chr(rand(49,57));
}
if($textornumber == 2){
$captchastr .= chr(rand(65,78));
}
if($textornumber == 3){
$captchastr .= chr(rand(80,90));
}
}
$randcolR = rand(100,230);
$randcolG = rand(100,230);
$randcolB = rand(100,230);
//initialize image $captcha is handle dimensions 200,50
$captcha = imageCreate(200,50);
$backcolor = imageColorAllocate($captcha, $randcolR, $randcolG, $randcolB);
$txtcolor = imageColorAllocate($captcha, ($randcolR - 20), ($randcolG - 20), ($randcolB - 20));
for($i=1;$i<=$strlength;$i++){
$clockorcounter = rand(1,2);
if ($clockorcounter == 1){
$rotangle = rand(0,45);
}
if ($clockorcounter == 2){
$rotangle = rand(315,360);
}
//$i*25 spaces the characters 25 pixels apart
imagettftext($captcha,rand(14,20),$rotangle,($i*25),30,$txtcolor,"fonts/arial.ttf",substr($captchastr,($i-1),1));
}
for($i=1; $i<=4;$i++){
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$txtcolor);
}
for($i=1; $i<=4;$i++){
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$backcolor);
}
//Send the headers (at last possible time)
header('Content-type: image/png');
//Output the image as a PNG
imagePNG($captcha);
//Delete the image from memory
imageDestroy($captcha);
$_SESSION[captchastr] = $captchastr;
?>
Tags: captcha, ceating your own captcha, creating your own security image, security images, spam prevention
Posted in PHP | No Comments »
July 17th, 2010
How to enable GD library on Wamp5?
(This I assume you have running wamp5 on your system)
Click Wamp5 icon on lower right hand of your screen (see image)

Click PHP settings …

Click PHP extensions …

If there’s an triangle already showing right across php_gd2 GD is already running and you can now create image on the fly(via PHP), but if no triangle it is not enabled and to enable it just click and restart your server
Thats it. Its really amazing right
Tags: create image on the fly, enable gd library on wamp5, gd library, gd library on wamp5
Posted in General, PHP | No Comments »