PHP 1000lines
Right,
As I have important GCSE exam coming up I decided to challenge myself. The challenge? To create various bits of software using only one file and less than 1000lines? The result
A complete blogging system, using 969, which includes, install, and
- Add, Edit and Delete posts
- Add, Edit and Delete comments
- Modify the style sheet (stored in the same file)
- Archive page
- Various bits of Ajax
Thoughts?
- Added RSS Functionality
That's a pretty good challenge, what will it be programmed in? If it is one file then you can't change languages TOO much because it would take up lines for calling the languages. I am very interested to see how it will turn out.
Does your line count include comments and headers? Or is it only lines of code? This seems like it would be pretty tough, but I am mostly non-internet based dev, and alot of the online side of things are not my strong side when developing, but that is alot of stuff to fit in 1000 lines, but I am rooting for ya. Be sure to tell me how you did. :D
NC
At the moment I am working on improving the admin pannel, although with about 41 lines of leeway thats kinda tricky. The beta release is going out on monday, but an example is here
Did I mention that the code has to be properly spaced and tabbed as well?
Its all in PHP and doesn't include any other files (although if you want it will overwrite the htaccess to make the url's pretty
Ehr.. Sql DoS (right flash :P?)
http://phpgsy.com/1000lines/highlight.php
Not quite finished but I'd rather you learn something more about PHP so you can spot the two vulns and 4 other bugs
SORRY. It works now.
function blog ( ) { $this->{get_parent_class(CLASS)}(); $this->arrayActions = unserialize ( ACTIONS ); $this->action = isset ( $_GET['action'] ) && !is_array ( $_GET['action'] ) && isset ( $this->arrayActions[$_GET['action']] ) ? strtolower ( $_GET['action'] ) : 'home'; $this->request = isset ( $_GET['request'] ) ? true : false;
$this->request = isset ( $_GET['ajax'] ) ? true : false;
$this->{$this->arrayActions[$this->action]}();
echo $this->parsePage();
}
I think that you can make -2 lines here.
{ $this->{get_parent_class(CLASS)}();
and
echo $this->parsePage(); }
I don't think it's cheating
mozzer wrote: Hmm, show me where you shortened it (without ruining the layout)
hmm well, if you look at the code, almost every 5. line is blank. At least for my monitor. I think you can see it also.
$this->request = isset ( $_GET['request'] ) ? true : false;
$this->request = isset ( $_GET['ajax'] ) ? true : false;
}
function showNews ( $rss = false )
}
function showRSS ( )
}
function updateMySQL ( )
And many more
CP's I am calling you
kaksii wrote: He wanted to know which lines. (Helpful kaksii always helps) ;)
Dude… there is trying to get CP and there is going insane… you're drifting :P
[/offtopic]
On topic… what do people think of the way I am storing the CSS as a serialized array which is converted from standard CSS? Keeps it on one line and allows for editting