Created
July 9, 2009 11:38
-
-
Save jdp/143591 to your computer and use it in GitHub Desktop.
Magneton, the superdense PHP framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $u=$_GET['u'];$l=$u();extract($l);include("view/{$u}.php"); |
You should check out twitto as well http://twitto.org/
But seriously this is really not secure, I wouldn't encourage anybody using these kinds of stuff in production.
Is it Enterprise-Ready?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The framework that fits in a tweet! Or a vim line.
To use it, write each action of your app in an individual function, and pass the variables you want to send to the view as the return values of the function. For example, app.php:
The extract() function brings the associations from an array into the current namespace as variables, and then the view is evaluated in the current namespace. That allows the action's function to pass variables to the view.
And the associated view, view/posts.php:
When http://yourdomain/app.php?u=posts is accessed, the value of
$_GET['u']
is treated as a function name and executed. The locals are extracted, and the view is shown. Then, just set up a few rewrite rules and everything's gravy.I know how insecure it is. It's just a novelty. Oh man please do not deploy this.