s22 Tech

Useful code.

Applications

Stand-alone PHP Scripts


• MPG – An app to keep track of your mileage
• gList – Grocery List App
• URLsh – URL Shortnener
• Upload Local IP Address to Server
• Find and Replace Text Within Files
                

LiteCart Add-ons

Coming Soon...

• 3rd Party Shipping Choices
• Custom Order Numbers
• Unprocessed Orders Notifier
• Min/Max/Pkg Product Quantities
					

URLsh Plugins

Coming Soon...

• Email Notify
• Don't Track me
                

PHP

Functions

Writes the current IP, along with today's date, to a running list.

function write_ip_to_list($current_ip, $timestamp) {
   $str_len = 17;
   if (strlen($current_ip) >= 7) {
     // This will print at least 2 spaces between the IP address and the timestamp.
      $spaces = $str_len - strlen($current_ip);
     // This prints the appropriate amount of spaces so the dates always line up.
      $line = $current_ip . str_repeat(' ', $spaces) . $timestamp;
      file_put_contents(LOCAL_MY_IP_LIST, $line . PHP_EOL, FILE_APPEND);
   }
   else {
      echo 'Houston - we have a problem!' . PHP_EOL;
   }
}