Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Design Forum > Web Design & Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Web Design & Programming Discussion of web design, and server-side & client-side scripting

Reply
 
LinkBack Thread Tools
Old 07-20-2009, 12:06 AM   #1 (permalink)
Troubled
 
Join Date: May 2009
Posts: 71
OS: Computer = WXP, Server = linux w/ php 5


? About LOLCODE

i am attempting to build the first ever file upload script in lolcode
i have just a html form , and the function is upload.lol
heres the parser i am using
PHP Code:
<?php
/*
lol_core.php Ver 0.2
Copyright (c) 2007 Jeff Jones, www.tetraboy.com
EDITED BY CALTHEPHENOM TO INCLUDE "KITTY SEZ" , "KTHXBAI" AND "GIMME PLOX",and lastly,CAN HAZ commands, Which are supposed to ba "VISIBAL", KTHXBYE,AND CAN HAS, commands
www.calthephenom.info
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
function lol_core_parse($code) {
    
$code lol_core_replace($code);
    return 
$code;
}
//@todo only replace inside tags
function lol_core_replace($code) {
    
$array = array(
        
'/^HAI$/','<?php',
        
'/^KTHXBYE$/','?>',
        
'/^KTHXBAI$/','?>',
        
'/^[\s]*CAN HAS ([^\.]+)\?$/','include(\'$1.php\');',
        
'/^[\s]*GIMME PLOX ([^\.]+)$/','require(\'$1.php\');',
        
'/^[\s]*CAN HAZ ([^\.]+)$/','require(\'$1.php\');',
        
'/^[\s]*KITTY SEZ ([a-zA-Z0-9-]+)$/','echo \$$1;',
        
'/^[\s]*KITTY SEZ (.*)$/','echo $1;',
        
'/^[\s]*I HAS ([a-zA-Z0-9_-]+)$/','\$$1 = null;',
        
'/^[\s]*I HAS ([a-zA-Z0-9_-]+) IZ (BUCKET)$/','\$$1 = array(',
        
'/^[\s]*I HAS ([a-zA-Z0-9_-]+) IZ ([a-zA-Z0-9]+)$/','\$$1 = \'$2\';',
        
'/^[\s]*I HAS ([a-zA-Z0-9_-]+) IZ (.*)$/','\$$1 = $2;',
        
'/^[\s]*([a-zA-Z0-9_-]+) IZ (BUCKET)$/','\$$1 = array(',
        
'/^[\s]*([a-zA-Z0-9_-]+) IZ ([a-zA-Z0-9]+)$/','\$$1 = \'$2\';',
        
'/^[\s]*([a-zA-Z0-9_-]+) IZ (.*)$/','\$$1 = $2;',
        
'/&&([a-zA-Z0-9_-]+)&&/','\$\$$1',
        
'/&([a-zA-Z0-9_-]+)&/','\$$1',
        
'/&([a-zA-Z0-9_-]+)#([a-zA-Z0-9,_-]+)&/e','lol_core_pregArray(\'$1\',\'$2\');',
        
'/^([\s]*)(KTHX)([\s]*)$/','}',
        
'/^[\s]*([a-zA-Z0-9_-]+) UPUP!$/','\$$1++;',
        
'/^[\s]*([a-zA-Z0-9_-]+) DOWNDOWN!$/','\$$1--;',
        
'/^[\s]*I FOUND MAH ([a-zA-Z0-9_-]+)$/','return \$$1;',
        
'/^[\s]*I FOUND MAH (.*)$/','return $1;',
        
'/^[\s]*SO IM LIKE ([a-zA-Z0-9_-]+) WITH (.*)$/e','lol_core_pregFunc(\'$1\',\'$2\');',
        
'/^[\s]*BTW (.*)$/','//$1',
        
'/^[\s]*BTW!$/','/*',
        
'/^[\s]*!BTW$/','*/',
        
'/^[\s]*ALWAYZ ([a-zA-Z0-9_-]+) IZ (.*)$/','define("__$1__","$2");',
        
'/^[\s]*(IZ) (.*)$/e','lol_core_pregExpression(\'if\',\'$2\');',
        
'/^[\s]*(ORLY) (.*)$/e','lol_core_pregExpression(\'elseif\',\'$2\');',
        
'/^[\s]*(NOWAI)$/e','lol_core_pregExpression(\'else\',\'$2\');',
        
'/^[\s]*BUCKET$/',');',
        
'/^[\s]*BAG$/','),',
        
'/^[\s]*(!!) FISH (".*") !!$/','$2,',
        
'/^[\s]*([a-zA-Z0-9_-]+) FISH IZ BAG$/','\'$1\' => array(',
        
'/^[\s]*([a-zA-Z0-9_-]+) FISH (".*") !!$/','\'$1\' => $2,',
        
'/^[\s]*IM IN UR ([a-zA-Z0-9_-]+) ITZA ([a-zA-Z0-9_-]+)$/','foreach(\$$1 as \$$2) {',
        
'/^[\s]*IM IN UR ([a-zA-Z0-9_-]+) ITZA (.*)$/','foreach(\$$1 as $2) {',
    );
    
$search = array();
    
$replace = array();
    
$lines explode("\n",$code);

    foreach(
$array as $key=>$var){
        if(
$key)    {
            
$replace[] = $var;
        } else {
            
$search[] = $var;
        }
    }
    
$lines preg_replace($search,$replace,$lines);
    
$code implode("\n",$lines);
    return 
$code;
}
function 
lol_core_pregArray($name,$string) {
    
$var '$'.$name;
    
$keys explode(',',$string.',');
    foreach(
$keys as $key) {
        if(
$key !== '') {
            
$var .= "['{$key}']";
        }
    }
    return 
$var;
}
function 
lol_core_pregExpression($name,$string) {
    switch(
$name) {
        case 
'if':
            
$expr "if ($string) {";
        break;
        case 
'elseif':
            
$expr "} elseif ($string) {";
        break;
        case 
'else':
            
$expr "} else {";
        break;
    }
    return 
$expr;
}
function 
lol_core_pregFunc($name,$args) {
    
$func 'function '.$name.' (';
    
$args explode(' ',$args);
    
$i=0;
    foreach (
$args as $arg) {
        if(
$i==1){$func .= ',';}
        
$func .= '$'.$arg;
        
$i=1;
    }
    
$func .= ') {';
    return 
$func;
}
?>

Last edited by calthephenom; 07-20-2009 at 12:07 AM.
calthephenom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 07-20-2009, 09:33 PM   #2 (permalink)
Manager, Design
 
ebackhus's Avatar
 
Join Date: Apr 2005
Location: SATX
Posts: 14,254
OS: WinXP Pro SP3/Windows 7 RTM

My System

Blog Entries: 28
Send a message via ICQ to ebackhus Send a message via AIM to ebackhus Send a message via MSN to ebackhus Send a message via Yahoo to ebackhus Send a message via Skype™ to ebackhus
Re: ? About LOLCODE

bukkit iz speld rong
__________________


-----------------------------
There are no dumb questions, unless a customer is asking them.

Help in the fight against cancer and other serious illnesses.
ebackhus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-21-2009, 03:35 PM   #3 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,879
OS: Vista, various linux distros


Re: ? About LOLCODE

Quote:
Originally Posted by ebackhus View Post
bukkit iz speld rong
MegaLolz!
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 07-30-2009, 07:26 PM   #4 (permalink)
Troubled
 
Join Date: May 2009
Posts: 71
OS: Computer = WXP, Server = linux w/ php 5


Re: ? About LOLCODE

bumpzorx
calthephenom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-06-2009, 09:20 AM   #5 (permalink)
Troubled
 
Join Date: May 2009
Posts: 71
OS: Computer = WXP, Server = linux w/ php 5


Re: ? About LOLCODE

hai thur
calthephenom is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 08:46 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85