Skip to content

All posts by Kwacho - 2. page

Simple PHP Form Error Class, Validate Errors Class, OOP

Share Button

<?php      /**   Simple Error Class * *   – Define Error Messages, Regular Expressions *   – Log Errors to Error Array *   – Sanitize Input *   – Print/Display Errors […]

Share Button

PHP Random String Generator Class, OOP.

Share Button

 <?php class GenerateRandom{          /** Variable to be used by methods */     public $randomString = ”;     public $lenght;     public $characters;     public $charactersLength;      […]

Share Button

Check if current PHP page name is the one you’re looking for.

Share Button

 <?php /** Check if current page is a specific one we’re looking for */ function isPage($checkpage){          /** Check basename of the file     *   basename returns trailing […]

Share Button

PHP MySQL Database Connection Class, OOP

Share Button

  <?php /**  *  MySQL Database configuration settings  *  Database Constants  *  If constants are defined, CONNECT else, DEFINE CONSTANTS.  *  *  Fill Values below with your own DB Credentials […]

Share Button

PHP Display YouTube Video Class, OOP. Embed YouTube Video.

Share Button

 <?php /** *   YouTube video Class – display video *   Features(Briefly): *       – Check if video Exists *       – Set Video width, length, frameborder, allowfullscreen *       – Display YouTube Video […]

Share Button

PHP Condition Statements: Shorthand, Nested, Inside function

Share Button

 <?php /** Declare String Variable  */ $name = “Kwacho”; /** *   #1   *   Regular   */ if($name){     echo $name; } else {     echo “….Oopsy”; } /** *   […]

Share Button

PHP Check Regular Expressions with preg_match()

Share Button

<?php     //Simple Regex Matching code.     /** Regular Expression     *   accepts:     *       – upper & lower case letters from a to z     *       – numbers from […]

Share Button

scp Secure Copy to remote host with Linux

Share Button

// Copy testFile.php from remote host/machine to Localhost scp username@remote_host:/etc/practice/testFile.php ./   // Copy testFile.php from Localhost to remote host/machine scp testFile.php username@remote_host:/etc/practice     Explanation:

Share Button

Get IP Addresses with ifconfig command

Share Button

Max OS X ifconfig en0 | grep -i inet | awk ‘{print $2}’ | cut -f 2 -d ‘:’ Result 178.62.55.250   RedHat ifconfig eth0 | grep -i inet | […]

Share Button

PHP function that accepts any number of arguments

Share Button

<?php     /** Function accepting any number of arguments */     function manyArgsFunc(){           /**  Returns the number of arguments passed to the function */         $numOfArgs = func_num_args();   […]

Share Button