Jump to content

zq29

Staff Alumni
  • Posts

    2,752
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by zq29

  1. Well, it looks as though you have 'index.html' in the action attribute of your form. You can't post form data to a HTML form, you have to post it to a script ending with .php

     

    You'd definitely help us, help you, if you posted up some code :)

     

    Not entirely true. You could write:

     

    AddHandler application/x-httpd-php .html
    

     

    to .htaccess and this will allow for html files to handle PHP. I know this isn't relevant here, but thought it should be noted  :D

    Yes, that is correct - But based on the question asked, do you really think that is a possibility in this case?

  2. Hmmm, I'm not sure if and what the command is to tell you which mail server is installed, but Postfix is quite a common Linux mail server - If I remember correctly, Postfix stores all of its data in a MySQL database  so see if there is a database set-up for it. If so, you're in luck, I think you just have to add a record to the users table and create a directory to store the users mail in, check the manual. If not, I'm no longer help to you...

  3. Well, it looks as though you have 'index.html' in the action attribute of your form. You can't post form data to a HTML form, you have to post it to a script ending with .php

     

    You'd definitely help us, help you, if you posted up some code :)

  4. For the database, a basic example of what I'd go with is something like this:

     

    question

    id, title

     

    option

    id, question, title

     

    answer

    id, session, question, option

     

    The PHP shouldn't be too difficult to figure out yourself based on the tables above, but if you do struggle, come back and show us your attempt and we'll help you get it working.

  5. Very basic example:

    <?php
    if(isset($_GET['cat'])) {
        $r = mysql_query("SELECT * FROM `images` WHERE `category`='$_GET[cat]'") or die(mysql_error());
        while($rr = mysql_fetch_assoc($r)) {
            //Do whatever...
        }
    } else {
        $r = mysql_query("SELECT * FROM `categories` ORDER BY `name` ASC") or die(mysql_error());
        while($rr = mysql_fetch_assoc($r)) echo "<a href='?cat=$rr[id]'>$rr[name]</a><br />";
    }
    ?>

  6. .htaccess

    RewriteEngine On
    
    RewriteRule ^foo/([0-9]+)$       index.php?page=foo&n=$1 [L]
    RewriteRule ^([a-z_]*)\.html$    index.php?page=$1

     

    No change...

     

    EDIT: Out of curiosity, I dropped the second line of that .htaccess file and it's still doing the same thing. Could this be a config issue?

     

    FURTHER EDIT: Just been messing around with my VirtualHosts config, here it is:

    <VirtualHost *>
        ServerName test.kris
        ServerAlias test.kris
        ServerAdmin kris@localhost
        DocumentRoot /var/www/test
        <Directory /var/www/test/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
        </Directory>
    </VirtualHost>

    Dropping out the "MultiViews" bit and restarting Apache appears to have fixed my issue, but the Apache docs weren't that helpful in explaining what "MultiViews" does...

  7. You don't have any [L] there.

    'last|L' (last rule)

    Stop the rewriting process here and don't apply any more rewriting rules. This corresponds to the Perl last command or the break command from the C language. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. For example, use it to rewrite the root-path URL ('/') to a real one, e.g., '/e/www/'.

    Sounds like that could be useful, thanks for pointing that out Fenway - Will give it a try tomorrow...

  8. Sorry for the late reply guys, been a bit busy! Anyways, I have just conducted a fresh test. Here are my three files:

    .htaccess

    RewriteEngine On
    
    RewriteRule ^([a-z_]*)\.html$    index.php?page=$1
    RewriteRule ^foo/([0-9]+)$       index.php?page=foo&n=$1

    index.php

    <h1>index.php</h1>
    <?php if(isset($_GET['page'])) include($_GET['page'].".php"); ?>

    foo.php

    <h1>foo.php</h1>
    <?=(isset($_GET['n'])) ? "NUMBER - $_GET[n]" : "";?>

     

    URL: http://localhost

    OUTPUT: index.php

     

    URL: http://localhost/foo.html

    OUTPUT: index.php

    foo.php

     

    URL: http://localhost/foo/4

    OUTPUT: foo.php

     

    URL: http://localhost/foo.php?n=4

    OUTPUT: foo.php

    NUMBER - 4

     

    My problem is, viewing http://localhost/foo/4 should give the same output as http://localhost/foo.php?n=4. Does this work as expected on your set-up? Maybe there is a problem with my machines config somewhere?

  9. I currently use a Google banner, but It doesn't look nice on top or bottom, and people can use CSS/JavaScript to cover it up.

    Put it in your terms and conditions that they are not allowed to obscure your advertisements - If they do, terminate their account. Pop-ups are generally automatically blocked in most modern browsers, so that's not really a viable solution. You cold do something with forced frames (old school, I know) using one of the Apache modules, I forget which one it is now that you can use to include code in all request pages...

  10. I just think allot of you older people are jealous that 15 year olds get hired as freelance allot and return high quality websites. I my self have been for the past 2 years aswell as translating into different languages (Dutch, German, French, English) for my clients meanwhile you guys are so old and slow you never have any new fresh ideas.

     

    No, I think another part of the problem is that people who charge extremely low rates are undervaluing our trade. That's why you get the odd person who says, "I'm not paying you x thousands of pounds/dollars for a website when my mate down the road can do it for about a hundred".

     

    If you truly believe you can class your work at the same level of those of us that do this for over 10 hours a day, five days a week - Why not charge a sensible amount to reflect that? You're undervaluing yourself as well, why make $200 in 3 days when you can make $2000 for doing the same amount of work? I'm sure your outlook will change on the whole situation when you're older, $200 may seem like a lot now but I wouldn't even get out of bed for that - Let alone three days of work.

  11. The only thing that doesn't make sense to me is localhost/register/foo.html being rewritten to register.php. That is what you are saying, no?

    Correct, it should be rewritten to index.php?page=register&type=foo - But it's not, it's being rewritten to register.php. None of my rules rewrite a page to not include "index.php?page=" which is why I'm confused...

  12. Here is an extract from an .htaccess file I'm working on:

    RewriteRule ^register/([a-z]+)\.html$	index.php?page=register&type=$1
    RewriteRule ^([a-z_-]+)\.html$ 	        index.php?page=$1

     

    NOTE: I have a file called register.php in my doc root.

     

    Ok, so when I point my browser at localhost/register.html I get the contents of register.php loaded into my index.php file. If I point my browser to localhost/register/foo.html I get the contents of register.php without it being loaded into index.php and 'foo' is not processed. If I change my .htaccess to the following:

     

    RewriteRule ^registration/([a-z]+)\.html$   index.php?page=register&type=$1
    RewriteRule ^([a-z_-]+)\.html$ 	            index.php?page=$1

     

    Pointing my browser to localhost/registration/foo.html displays the contents of register.php inside index.php with 'foo' being processed.

     

    Can anyone explain why the first rule doesn't work as expected? Do the rules conflict in some way?

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