Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by click

  1. Yeah, busy around here all of a sudden.


    SteveW's rewrite rule will redirect the browser and the visitor will see the new address in their browser. The [R=301] tells it to redirect. Use this if a page has been moved. Without the [R] flag, the server will serve file.html but /directory/ will still show in the visitor's browser -- there is no indication to the visitor that the request has been redirected. Choose whichever behavior you're after

  2. If you're asking if that's the correct way to define and call a function, then yes. You don't HAVE to separate it into functions, but it makes it easier to read and maintain if it's broken down into logical chunks.


    I'm a little unclear on something: Is the query only returning one story or many? You say that you want to use $story['headline'] as the page <title>, but you set and display $story in a while loop, implying that the database is going to return more than one story.


    If you're only displaying one "story", then just connect to the database and put the results in the variable $story before the "include('header.php');". That way, $story['headline'] will have been initialized for header.php to use.

  3. You need to split your code up into functions defined at the top of the file. As soon as the page loads, pull the info from the database. Then call a separate function from the body of your page that will actually display the info (all your "echo" statements).


    Also, make sure you're sanitizing the input before you use it in a db query or your script may be vulnerable to SQL injection attacks.

  4. Those backslashes in your RewriteRules don't look right to me. If you're trying to escape the periods, then the backslash should go before them rather than after. Also, you don't need to escape the periods in the second part because you're not matching anything. Try this:


    >RewriteEngine On
    RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
    RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1

  5. Does it work if you just type the address you're redirecting to into the address bar? What URL is it trying to open when it generates the 404? I notice that your redirect refered to "Wall-Sconses_2_4.php " but later you said it redirects to "Wall-Sconces_2_4_1.php". Is that a typo in the redirect maybe? "RewriteRule ^products/Wall-Sconses(.*)\.php /products/Wall-Sconces$1.php? [R=301,NC]" should take care of anything beginning with "Wall-Sconses".

  6. Also, I believe MySQL usernames will be cropped if they're too long, so make sure the info in wp-config.php matches what is shown on the MySQL page in cPanel. Double check the password, too.


    edit: ... and that the user has "ALL PRIVILEGES" for the database.

  7. Except preg_split is a php function and he's using perl.

    hahaha I think that officially makes me a moron! :)


    Sorry, I don't know how I managed to miss that. I guess the $ variables threw me into php mode (I haven't done any significant perl in a while). Maybe there should be some basic IQ test before we're allowed to post. :D I think the Perl split() works pretty much the same as preg_split(), though. Any part of the regex in parenthesis will be included in the result array.


    Anyhow, I'm glad you figured it out.

  8. I attempted to do this and it didn't work. After looking at the expression a little bit more, i noticed I had an extra space after the '-' so it looked like this:

    Was the extra space the reason it was interpreted as defining a range?


    The code seems to be functioning properly now after removing the space.


    Thanks again!:thumbup1: I was stuck for hours!!

    Could have been, I'm not really sure. I just knew it worked with it at the beginning. :)

  • Create New...