Jump to content

[SOLVED] Just trying to get an example to work... Wondering if i have all the required...


ineedhelpbigtime

Recommended Posts

Just trying to get an example to work... Wondering if i have all the required extensions...

 

The problem i am having is with this function:

function check_username($username) {
        global $taken_usernames;
        $resp = array();
        $username = trim($username);
        if (!$username) {
            $resp = array('ok' => false, 'msg' => "Please specify a username");
        } else if (!preg_match('/^[a-z0-9\.\-_]+$/', $username)) {
            $resp = array('ok' => false, "msg" => "Your username can only contain alphanumerics and period, dash and underscore (.-_)");
        } else if (in_array($username, $taken_usernames)) {
            $resp = array("ok" => false, "msg" => "The selected username is not available");
        } else {
            $resp = array("ok" => true, "msg" => "This username is free");
        }

        return $resp;        
    }

 

All of the php runs correctly up until the

=>

. I dunno why its not working. Is there some extension i need for this? It seems like => is exiting php much like ?> would....

If you are seeing raw php code in your browser, either php is not installed on your web server, you are using lazy-way short open tags <? and your code is not being seeing as php code, or you are not browsing to the file using a URL on your web server.

 

So, does any php code work at all, use only full opening <?php tags in all your code, and what exactly is the URL you are entering in your browser?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.