Tuesday, July 30, 2013

Php Framework EssenceOne

Worlds Fastest and Simplest Php Framework !

Want In On A Secret ?

How about trying a dynamic take on probably the easiest Php Framework there is. And how about the most Dynamic ?  EssenceOne not only breaks down every File, Folder, Template, Model, View and Controller Alphanumerically but also stages and stacks them into easily managed class routers for Team Production and or Newbie  Builds. Now do away with the bulky nonsense that Zend and Cake and Codeigniter all wish to incorporate into every Technical School and Training Course on the Market simply to make money. 

Now how about adding Twitter-Boostrap Templating and Mobile to all of that ? That's Right ! Complete with Pop-ups, Carousels, Tool-tips, Modals, Pagination, Scrollers, Tabs, Forms, Buttons, Labels, Thumbnails, Drop-downs, Drop-ups, Layouts and all the Java you may ever need. 

Now what else can it do ? How about Session Members already installed ? And --->>>

It Is Free

Dowload Here !

To Learn More About EssenceOne And How It Works Visit Their Blog !

EssenceOne Blogger !



Sunday, June 16, 2013

Class Construct Method

Using The Class Construct Method In Php

//The difference between normal class methods and construct class methods//

class exampleOne
{
function sayHello()
{
echo 'Hello !';
}//end function
}//end class
//now to execute our class
$ourexample = new exampleOne;
$ourexample->sayHello();

class exampleTwo
{
public function __construct()
{
$this->sayHowdy();
}//end function construct

public function sayHowdy()
{
echo 'Howdy !';
}//end function
}//end class
// now we can call and execute the class using only one line below//
$example = new exampleTwo;

Sunday, April 7, 2013

Php Convert String Specific Words To Links In Paragraphs.

Php Convert String Specific Words Within Paragraphs Into Links. This little jewel allows you to do some sneaky self made tags within your blog or forum. Can be used before input or even better on coming out of the database query. The thing to remeber is that arrays are mirrored within preg_replace and require the $replacements variables to be in numeric reverse order. If you add another to the list it will be $items[3] and the new $replacements var will become [0] which moves the replacements up one numeric order. This would place shoes replacement at [3] shirts at [2] and jeans at[1] then new item var at [0].

?php
$string = 'She has shirts in blue her jeans in black and her shoes are all faded.';
$items = array();
$items[0] = '/shoes/'; //List of items you want changed//
$items[1] = '/shirts/';
$items[2] = '/jeans/';
$replacements = array();
$replacements[2] = 'a href="http://www.example.com/foot/shoes.php">Shoes /a>';
$replacements[1] = 'a href="index.php?items=shirts">Shirts /a>';
$replacements[0] = 'a href="index.php?items=jeans">Jeans /a>';
$output = preg_replace($items, $replacements, $string);
echo $output;// OR QUERY BACK INTO DATABASE//
?

Outputs: The paragraph and links on the selected items.

Sunday, February 24, 2013

Using Php To Switch Css Styles Function

Use Php To Switch Css Styles Function()


My Template Engine----> This is a secret ! Not very many programers know of this. This can switch css style sheets using php by calling this function verses another one,,in which many think impossible.
?php start tag here

function cssTemp()
{
?> php end tag here
#header_grad {
 background-image: url(/images/networks/header_grad.png);
 background-position: 0 0;
 background-repeat: no-repeat;
 float: left;
 width: 100%;
 min-height: 130px;
}

#header h1 {
 margin: 45px 28px 0 28px;
}

#header h2 {
 margin: 0 28px 0 28px;
 padding: 2px 0 26px 0;
}

#content_wrapper h3.pagetitle {
 font-size: 22px;
 font-weight: normal;
 padding-top: 10px;
 margin-bottom: 23px;
 font-family: "Trebuchet MS";
}

#header .logo {
 margin: 45px 0 45px 28px;
}
?php start tag here

} //end function cssTemp()
?> php end tag here

Then simply call the function at the top of a page between the script tags.
Add as many as you want using php if conditions= ??? if condition=true { echo csstemp1() } else { echo cssTemp2() } click a button to change templates.

Thursday, February 21, 2013

Php MVC Framework EssenceOne !

Php MVC Framework EssenceOne !

Simple

EssenceOne uses one Model index.php page to handle everything you can throw at it. Simply add new views and controllers functions and classes and include them within the indexer. Then simply route every link through the index.php file indexer. Thats it. Views take in their required functions and classes by simply including them within each view by echo. Comes with Bootstrap and sessions support for users. 

Can be Downloaded here----essenceone-php-framework/downloads/list

Requires Wamp/Xamp/Lamp/Vertrigo or Online Server using Php+ and Mysql.

Wednesday, February 20, 2013

User Roles Function

User Roles Php Function !

USER ROLES FUNCTIONS

function errorRep()
 {
  $error='Un Authorised !';
  echo $error;
 } //end function errorRep()

function userRole() //PLACE ($uid) for production //testing value only
 {
 //PLACE QUERY HERE-$result=mysql_query("SELECT id, role FROM users where id=.$uid.");
  $role=2; //data result
  $id=2;   // test only data result  //use htacces with this script.
 
if ($role == 1) {
    echo 'Is User
';
    echo 'Dashboard';
}
if ($role == 2) {
    echo 'Is Editor
';
    echo 'Dashboard';
    }
   
if ($role == 3) {
    echo 'Is Publisher
';
    echo 'Dashboard';
    }   
   
if ($role == 4 and $id==1) {    //advised to add global $admin here
    echo 'Is Admin
';
    echo 'Admin Panel';
    }   
   
if ($role == '') {
    echo errorRep();
    }       

} // end function userRole()

echo userRole();  //for production use echo userRole($uid);

Md5 Plus Endless Salt !

Md5 Plus Added Salts !

What would you give to have salts to add to md5 or sha1 and making them any length and still retrieve them for password validation?

Enter code here...THE MD5 HASH ONLY GOES UP TO 32 CHARS,,,,FOR SECURITY WHY NOT ADD MORE? Or better yet add all you want, because This script only retrieves the original Md5 hash. !!!

SALT
function saltIt()
{
$password
='razorback';
$addsalt
='a5jcmnb62sdx';
$pass
=(md5($password));
$salt
=$pass.$addsalt;
echo $salt
;
} //end function saltIt()
echo saltIt
();                 // password hash by robin deatherage
// our md5+added salt = a618b59e86b0042f6eb0341d25aedcc1a5jcmnb62sdx

UNSALT
function unSalt()
{
$mystring1
='a618b59e86b0042f6eb0341d25aedcc1a5jcmnb62sdx';//our md5+salt
$Remove_Our_Added_Salt
='a5jcmnb62sdx';

$nosalt
=(mb_substr($mystring1, 0,32));//THE-SALT-CAN-BE-ANY-LENGTH-THIS RETRIEVES ONLY THE MD5.
echo $nosalt
;
//outputs the original md5 without the added salt a618b59e86b0042f6eb0341d25aedcc1
} //end function unSalt()
echo unSalt
();

Tuesday, February 19, 2013

Url-Parser-Function

Url Parser Function !

Asign variables for each parse and build your own Framework !

function parseIt()
{
$url = 'http://127.0.0.1/root/index.php?arg=value#3445678abcd';
print_r(parse_url($url));
echo'';
echo '
http://';
echo parse_url($url, PHP_URL_HOST);
echo '
';
echo parse_url($url, PHP_URL_PATH);
echo '
?';
echo parse_url($url, PHP_URL_QUERY);
echo '
#';
echo parse_url($url, PHP_URL_FRAGMENT);
//parse_str($str);

} //end function parseIt()
echo parseIt();

OUTPUTS:
Array ( [scheme] => http [host] => 127.0.0.1 [path] => /root/index.php [query] => arg=value [fragment] => 3445678abcd )

http://127.0.0.1
/root/index.php
?arg=value
#3445678abcd

Friday, February 15, 2013

Simplist Php Framework Ever.

Simple Php Framework. 

 Make this your main controller index.php page and start creating. Include your modals, in turn they request your views and page controllers. To pass id's for user etc by using index.php?page=profile&id= etc. Links too can all be passed using index.php?page= etc.
Add more pages if needed.

include('head.php');                    //head section above body tag= one or two second for members
?>
if(isset($_GET['page']))
{
  $page = ($_GET['page']);

  if($page == 'home')
  {
  include('menu.php');          //or members menus after login with a duplicate member/index.php
  include('leftmenu.php');
  include('home.php');
  include('rightmenu.php');
  include('footer.php');
  }
    if($page == 'about')
    {
    include('menu.php');
    include('leftmenu.php');
    include('about.php');
    include('rightmenu.php');
    include('footer.php');
    }
       if($page == 'policy')
       {
       include('menu.php');
       include('leftmenu.php');
       include('policy.php');
       include('rightmenu.php');
       include('footer.php');
       }
           if($page == 'signup')
           {
            include('menu.php');
            include('leftmenu.php');
            include('signup.php');
            include('rightmenu.php');
            include('footer.php');
            }
               if($page =='')
               {
               include('menu.php');
               include('leftmenu.php');
               include('home.php');
               include('rightmenu.php');
               include('footer.php');
               }

} else {
       include('menu.php');
       include('leftmenu.php');
       include('home.php');
       include('rightmenu.php');
       include('footer.php');
}
?>

Monday, February 4, 2013

Php Percent Of Profit Calculator Function

To customize this remove the =100 and =50 from the variable values. Place this into a php page and use a form to pass the values and sanitize them then add the function call line  below that to show output of this calculator. You will need two inputs to be passed one for Retail and One for Cost.

function percentOf($retail=100, $cost=50)
{
 $profit = ($retail - $cost);
 $percent = ($profit / $retail);
 $totalpercent = ($percent * 100);
 echo 'Total Retail
$';
 echo $retail;
 echo '
Subtract Total Cost
$cost;
Equals Profit $';
 echo $profit;
 echo '
Percent Total=';
 echo $percent;
 echo '%
You made a ';
 echo $totalpercent;
 echo ' percent profit';
 
 
 
  //return $link;

} // end function percentOf()

echo percentOf();

Php Retail Grocery Daily Report Function

PHP Retail Grocery DAILY REPORT FUNCTION

function dailyRep($totalz=17098, $tax=57, $gaskey=1775, $gas=1772, $lot=412, $mo=275, $ccr=545, $nonfood=1270, $oring=23, $dep=15998)
{
 $premerch=($totalz - $gaskey - $tax - $lot - $mo - $oring);
 $totalsales=($premerch + $lot + $mo);
 $nontax=($premerch - $nonfood);
 $gasdif=($gas - $gaskey);
 $moneys=($premerch + $tax + $gas + $lot + $mo);
 $cash=($dep + $ccr);
 $cashshort=($dep + $ccr - $moneys);

 echo 'Total From Z Reading
$';
 echo $totalz;
 echo '
Less Overings
$';
 echo $oring;
 echo '
Less Gas Sales Actual-----------------------Gas Actual
$';
 echo $gas;
 echo '
Less Gas From Z Tape
$';
 echo $gaskey;
 echo '
Dif +/-
';
 echo $gasdif;
 echo '
Equals Non Taxable Grocery Sales
$';
 echo $nontax;
 echo '
Plus Taxable Grocery Sales
$';
 echo $nonfood;
 echo '
Equals Total Merchandise Sales--------------Total Merchandise Sales
$';
 echo $totalsales;
 echo '
Add Tax-------------------------------------Plus Tax
$';
 echo $tax;
 echo '
Money To Account For-----------MA-------------Money Accounting
$';
 echo $moneys;
 echo '
Credit Card Report (counts as money)--CCR-----Add To Cash Count
$';
 echo $ccr;
 echo '
Total Money Counted Including Checks & CCR----Cash Deposit Count
$';
 echo $cash;
 echo '
Cash +/-(If this line is less than M/A it is Short)Total Over/Short Cash
';
 echo $cashshort;
  //return $link;

} // end function myFunction()

echo dailyRep();  //OUR FUNCTION CALL

Saturday, February 2, 2013

Automatic Query Pagination

Automatic Pagination Using query_count And Limit Control !

Simply place then into a function and query a count from the database, and assign $total to your query returned value

$total = $result_count['value'];

//querymsql_count as $total then devide by rows !
$rows = 10; // how many rows to show on each page !
$total = 50; //taken from query_count rows in database.
$count = ($total / $rows); //devide $total by $rows and pass this for pagination foreach
foreach (range('1', ''.$count.'') as $char) {
 print '' . $char . ' | ';
}
?>

Sunday, January 20, 2013

CONVERTING WWW ENTERED TEXT TO ACTUAL LINKS

 
HOW TO CONVERT NORMAL TEXT WEB LINKS INTO ACTUAL LINKS FOR BLOGS AND WALL POST.
This code will remove any www.something .somethings from all text and convert them to actual links.

$string = " bla bla bla http://www.example.com/ bla bla http://www.example.net/ bla bla bla";

$m = preg_match_all('/www.\/\/[a-z0-9A-Z.]+(?(?=[\/])(.*))/', $string, $match);

if ($m) {
$links=$match[0];
for ($j=0;$j<$m;$j++) {
$string=str_replace($links[$j],''.$links[$j].'">'.$links[$j].'</a>',$string);
}
}

echo $string;

?>