Jump to content

MasterACE14

Members
  • Posts

    2,687
  • Joined

  • Last visited

Posts posted by MasterACE14

  1. Good Day Everyone,

     

    I recently was looking for a decent framework to build a new website on and at a glance Yii Framework (http://www.yiiframework.com/) seemed to suit my needs. But after starting to work with I noticed it is perhaps a little too user friendly. I am now tossing up between CodeIgniter (http://ellislab.com/codeigniter) and PHPDevShell (http://www.phpdevshell.org/). If anyone has any prior experience with either frameworks I would love to hear your thoughts.

     

    While Yii generates a lot of code for you, providing a base to work off. I have always preferred building functionality myself in conjunction with a framework that doesn't provide a base for you.

     

    Any thoughts, ideas are welcome.

     

    Kind Regards,

    Ace

  2. I'm trying to validate a string so it can only be alphanumeric characters 0-9, a-z, A-Z and the following characters " ", "-", "!", "(", ")", "/", ".", ","

     

    Looking at the php manual and a few different tutorial sites I'm not having much luck, I can get the alphanumeric part, but not those other characters.

     

    I currently have...

    $string = "FN#*F#)@)"; // should be invalid
    if(!preg_match('/^[a-zA-Z0-9]+$/i', $string))
        echo "Invalid Input"; 

     

    Not sure where to go from here.

     

    Any help is very much appreciated.

     

    Kind Regards,

    Ace

  3. you could of course, make sure you have everything nice and secure so it is unlikely(but not impossible) that you will be hacked in the first place. As for DB admins viewing stuff they shouldn't... if they can't be trusted, why would they be a DB admin in the first place?

     

    My two cents.

     

    -Ace

  4. should add some error checking, rather than assuming that the query will ALWAYS return one or more results.

     

    if(mysql_num_rows($result) > 0) 
    {
    while ($row = mysql_fetch_assoc($result)) 
    { 
    echo '<option value="'.$row["username"].'">'.$row["username"].'</option>';
    }
    } else {
       echo '<option>No Usernames</option>';
    }

     

    EDIT: It's probably not displaying any usernames because either the query isn't working as expected, or you have no records in that table.

  5. note that it's not only variables that can be passed as arguments, can also pass arrays, objects etc

     

    And obviously you don't HAVE to pass a variable, take the following for example...

    function some_function($text) {
       return $text;
    }
    
    $message = some_function("my random text");
    echo $message; // Output: my random text

  6. are you after something like...

    <?php
    
    function parsetemplate($template, $array) { // Replace template with proper content.
    
            foreach($array as $a => $b) {
                $template = str_replace("{%{$a}%}", $b, $template);
            }
            return $template;
        }
    
    $test = "this is a test {%email%} message {%gallery%} rtfgdsfgdsfg";
    
    $content['email'] = 'something@somewhere.com';
    $content['gallery'] = 'random';
    
    echo parsetemplate($test, $content);
    ?>
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.