Posts Tagged ‘PHP’

One of my blog user “Chris” asked for FTP clean up script, so here it is: //CONFIG SECTION //******************************************************* // Credentials for FTP Server $source_server_ip = “your_domain_or_IP”; // Server IP or domain name eg: or ftp.domain.tld // Credentials for FTP account $ftphost = “ip_or_hostname_of_ftp”; // FTP host IP or domain name $ftpacct = “userid”; […]

  I was looking for a working script to take full backup (all files+databases+emails) manually or using cron services on my hosting server, each CPanel user by one. But most of the scripts are either old, totally unusable or commercial. So I wrote one for my own use and sharing here so others don’t need […]

  Updating PHP in CentOS to latest PHP 5.3 or PHP 5.4 is not an easy task so I am writing this post. I had to do this for a project in which I need to install latest Zend Loader with PHP 5.3 support.

Syntax Highlighter

Posted: 10th August 2010 by Babar Shafiq in Programming
Tags: , ,

SyntaxHighlighter: SyntaxHighlighter is a fully functional self-contained code syntax highlighter developed in JavaScript.

PHP Validations

Posted: 10th August 2010 by Babar Shafiq in Programming
Tags: , , ,

Validate Email We can perform an email validation through this function. function isValidEmail($email){ return eregi(‘^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$’, $email); } After fainted for a few seconds when i saw unreal4u finding, i decided to throw up preg_match solution instead. function isValidEmail($email){ return preg_match(‘/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i’, $email); } PHP 5.2 and above. function fnValidateEmail($email) { return filter_var($email, FILTER_VALIDATE_EMAIL); } Sanitize Email […]