Jump to content

K_N

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

K_N's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't see anything there about using htaccess with a PHP login script, but thanks, maybe I can figure something out with this and google.`
  2. Basically, I want to secure a directory so that it requires a login via HTML form in a PHP script using an SQL database for user data, but I would like to be able to make it work with htaccess for the entire directory, rather than having to wrap each page in a login authenticating script. If this is possible, can someone link me to a tutorial or provide me with appropriate resources?
  3. D'oh. I'm doing the same thing 3 other times in this script. Can't believe I missed that. Well, on my other issue, can you inform me on how to strip the index out of the array, so it only shows up as [watched] => 0 [watched] => 1 [watched] => 2 etc? Or should I take that to the PHP forum?
  4. I have a very small table right now, looks just like this: I'm using the following code $watchQuery = "SELECT `watched` FROM `watch` WHERE `watcher` = '1'"; $watching = mysql_fetch_array(mysql_query($watchQuery)); And the array $watching comes out like this: [0] => 0 [watched] => 0 What obvious mistake am I looking over that is causing this query to not select every row with a 'watcher' value of 1 (i.e. All of them)?
  5. Ok, that makes much more sense, thank you. I have another problem now, though I think I can figure this one out on my own.
  6. I'm sorry, I'm not really getting where I'm supposed to put the IN parameter. And do I still need the foreach?
  7. How would I use that with the array specifically? Something like SELECT * FROM `status` WHERE uid IN $array ?
  8. For further consultation, I attempted some array functions that I think I did wrong. The array $watching looks like this: And here's the code I'm using: $searchQuery = "SELECT * FROM `status` WHERE "; foreach($watching as $section){ $watching['watched'] = "uid = $section"; } $searchQuery .= implode(' OR uid = ', $watching); $searchQuery .= " ORDER BY id desc"; Here's the output I get: SELECT * FROM `status` WHERE 1 OR uid = 1 OR uid = 1 OR uid = 1 OR uid = 0 OR uid = uid = 0 ORDER BY id desc The output I would like to receive from this is more like: SELECT * FROM `status` WHERE uid = 0 OR uid = 1 ORDER BY id desc MySQL Version 5.1.41
  9. Lets say I have an array called $array1 This array contains the values value1, value2, value3 Right now, I have a query that says something like SELECT * FROM table WHERE value = $array1['value1'] OR value = $array1['value2'] OR value = $array1['value3'] I want to be able to make this query work dynamically, so I can have any number of values in the array, and they would all be compared like the above, without having to modify the query each time a new value is added to the array. What would be the proper syntax for this?
  10. Well, you can't change the URL once the page has been loaded... the point of a url is to access a page. Nope, you don't have to rename it. RewriteEngine On RewriteRule ^/stream/([A-Za-z0-9-]+)$ pop.php?Play=$1 [L] Will do that.
  11. That wouldn't be too hard, you just need to use this: RewriteEngine On RewriteRule ^/play/([A-Za-z0-9-]+)$ pop.php?Play=$1 [L] And then have a php function to take $_GET['Play'] (which would contain shows-title) and search your database for the correct thing to play. Unless I'm misunderstanding and you want it to retrieve the title from the database and insert it in the url?
  12. It's all right there in the sticky at the top of this forum, but for quick reference... If your server does have mod_rewrite enabled, add the following to your .htaccess file in the same directory as pop.php: RewriteEngine On RewriteRule ^([0-9-]+)$ pop.php?Play=$1 [L] This will make it so any request for "http://mydomain.com/179" loads "http://mydomain.com/pop.php?Play=179" Alternatively you could make it look like "http://mydomain.com/play/179" like this: RewriteEngine On RewriteRule ^/play/([0-9-]+)$ pop.php?Play=$1 [L] If you want to do anything more advanced, I suggest checking out the cheat sheet in the sticky.
  13. Right now I'm using the simple RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?nav=$1 [L] to remove query strings from my URLs, but I'd like it to be case insensitive, for example, http://domain.com/foobar/ or http://domain.com/FOOBAR/ would point to the actual url http://domain.com/index.php?nav=fooBar Rather than having to use the exact case.
  14. Thanks! Though I realized that data was also stored in the associate table, so I didn't even need it. /facepalm
  15. What exactly is your script doing? If you don't mind posting the source, or a reasonable stripped-down facsimile, some of us may be able to help you optimize it. (Though if you do, I would post it in the PHP Help forum, not this one)
×
×
  • 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.