Jump to content

wrs

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wrs's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Not sure what to instruct you to study other than the PHP manual in general Here is a function for generating random strings: function generateRandom($length = { // A list of characters permitted to be part of the generated string $allowed_chars = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; // The length of the above string, minus 1 ( array/string indexes start at 0 not 1 ) $allowed_length = strlen($allowed_chars) - 1; // make sure PHP knows that we want to consider $str as a string $str = ''; for($i = 0; $i < $length; $i++){ // loop how many characters we want // generate a random number to be used as the index $index = mt_rand(0, $allowed_length); // add the character at $index of $allowed_chars to our string $str .= $allowed_chars[$index]; } // return random string return $str; } You would gather this random string and concat it to another with: $newString = generateRandom(20) . 'otherstring';
  2. The problem here is that your eval() statement must be sane PHP. eval('if ($user == "something") return true; else return false;') Now your eval statement will return true or false, and can be placed within your if() block. $o = 'name == bob'; $parts = explode(' ', $o); $user = Array( 'name' => 'bob', ); $str = 'if ($user[\''.$parts[0].'\'] '.$parts[1].' \''.$parts[2].'\') return true; else return false;'; if (eval($str)) echo 'name matches'; else echo 'name does not match';
  3. I'll have to assume that this "URL not found /index/contact" error you are receiving is a 404 error generated by your webserver/browser because it was unable to find the file '<documentroot>/index/contact' on disk. It seems like you have configured your ZF app to handle index/contact correctly, so whats the problem? Probably, it is because you have not instructed your webserver to 'redirect' all requests to your index.php file where they can be correctly handled by your ZF app. For apache webservers, you would make use of the mod_rewrite module which allows you to do the above. In your virtualhost config, or .htaccess, you would want something along the lines of: RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /index.php [NC,L] Basically, this instructs Apache to rewrite all requests which would normally result in a 404 File Not Found back to your index.php for correct handling. There are several ways of doing this, but this is a good starting place. This is actually covered in the ZF Quickstart Guide
×
×
  • 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.