Search Results

Search found 2 results on 1 pages for 'tshabala'.

Page 1/1 | 1 

  • PHP: simplify with algorithm?

    - by tshabala
    Hello. Here's a piece of PHP code I think is not very "pretty", I'm sure it's possible to simplify it with for or something. I'm trying to find and algorithm that would work for this, but I can't figure it out, please help me. Here's the code: if(isset($four)) { if(isset($navi[$one][$two][$three][$four])) echo "/content/" . $one . "/" . $two . "/" . $three . "/" .$four . ".php"; else echo "error"; } else if(isset($three)) { if(isset($navi[$one][$two][$three])) echo "/content/" . $one . "/" . $two . "/" . $three . ".php"; else echo "error"; } else if(isset($two)) { if(isset($navi[$one][$two])) echo "/content/" . $one . "/" . $two . ".php"; else echo "error"; } else if(isset($one)) { if(isset($navi[$one]))echo "/content/" . $one . ".php"; else echo "error"; } else { echo "error"; } Thanks!

    Read the article

  • mod_rewrite: no ? and # in REQUEST_URI

    - by tshabala
    Hello. What I'm trying to do: have pretty URLs in the format 'http://domain.tld/one/two/three', that get handled by a PHP script (index.php) by looking at the REQUEST_URI server variable. In my example, the REQUEST_URI would be '/one/two/three'. (Btw., is this a good idea in general?) I'm using Apache's mod_rewrite to achieve that. Here's the RewriteRule I use in my .htaccess: RewriteRule ^/?([a-zA-Z/]+)/?$ /index.php [NC,L] This works really well thus far; it forwards every REQUEST_URI that consists of a-z, A-Z or a '/' to /index.php, where it is processed. Only drawback: '?' (question marks) and '#' (hash keys) seem to still be allowed in the REQUEST_URI, maybe even more characters that I've yet to find. Is it possible to restrict those via my .htaccess and an adequate addition to the RewriteRule? Thanks!

    Read the article

1