Professional Web Applications Themes

Proposing a change to the language - PHP Development

I have thought of a great idea for a new language construct, the fetch command. Basically it solves the problem of getting variables from forms. How many times have you seen? username = _REQUEST["username"]; password = _REQUEST["password"]; jobTitle = _REQUEST["job_title"]; salary = _REQUEST["sal"]; organisations = _REQUEST["org"]; ect.. ect.. ect..! Thats a horrible, but an all to common start to many scripts. So, we have registered globals, which are sadly being depricated for security reasons. My idea solves both prolems! Basically, you only regester the globals you acctually want. So, in the above example, the code would look like... fetch username, ...

  1. #1

    Default Proposing a change to the language

    I have thought of a great idea for a new language construct, the fetch
    command. Basically it solves the problem of getting variables from
    forms. How many times have you seen?

    username = _REQUEST["username"];
    password = _REQUEST["password"];
    jobTitle = _REQUEST["job_title"];
    salary = _REQUEST["sal"];
    organisations = _REQUEST["org"];
    ect.. ect.. ect..!

    Thats a horrible, but an all to common start to many scripts. So, we
    have registered globals, which are sadly being depricated for
    security reasons. My idea solves both prolems! Basically, you
    only regester the globals you acctually want. So, in the above
    example, the code would look like...

    fetch username, password, job_title, sal, org;

    Now, the variables you fetched will be super global but other
    variables wouln't be.

    So, what do you think? If you guys like the idea I will write up a
    formal thing on it and put a petition up on my website.



    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    tibberous Guest

  2. #2

    Default Re: Proposing a change to the language

    I think it already exists -
    [url]http://ca2.php.net/manual/en/function.extract.php[/url], with
    'parameters' for php 4.2 and beyond.

    The answer is
    [url]http://www.php.net/manual/en/index.php[/url]

    [url]http://forums.llamasery.com[/url]

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    AndyB Guest

  3. #3

    Default Re: Proposing a change to the language

    I've never seen PHP_extract(), but I'll check it out. I've
    been using the following instead:

    PHP Code:

    function checkvar(var){

    if(isset(
    _GET[var])){ var =
    _GET[var]; }
    elseif(isset(
    _POST[var])){ var =
    _POST[var]; }
    elseif(isset(
    _COOKIE[var])){ var =
    _COOKIE[var]; }
    elseif(isset(
    _SESSION[var])){ var =
    _SESSION[var]; }
    elseif(isset(
    _FILES[var])){ var =
    _FILES[var]; }
    else{var = 
    "";}

    return(var);
    }

    require_once(
    "Functions/checkvar.php");

    vars =
    array(
    "a","p","id","prop","page");

    foreach(
    vars as value){
    value checkvar("value");

    I used else{ var = ""; } for a custom script,
    but you can awlays return(NULL); if you need too.

    Never take an idea and make it fit into a language;
    rather, take a language and make it fit into your idea.

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    PHP_Brad Guest

Similar Threads

  1. how do I change Flash Player's locale (UI language) ?
    By asdfas in forum Macromedia Flash Player
    Replies: 1
    Last Post: February 26th, 02:47 AM
  2. Change language interface
    By Mouchi webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 1
    Last Post: February 20th, 08:19 PM
  3. How i can change the interface language??
    By teefo in forum Adobe Photoshop & Illustrator
    Replies: 2
    Last Post: August 6th, 06:03 AM
  4. change WIN XP language
    By Walter Clayton in forum Windows XP/2000/ME
    Replies: 4
    Last Post: July 18th, 10:33 PM
  5. Can i change language on my OS
    By Rob Tween in forum Windows XP/2000/ME
    Replies: 1
    Last Post: July 7th, 08:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139