Jump to content

Salis

Members
  • Posts

    130
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Salis's Achievements

Member

Member (2/5)

0

Reputation

  1. Wow, that's simple. Thanks effigy
  2. I'm writing a new pagination script. The idea is to have blocks based on 5s. For an example: << Prev :: Page 2 of 8 :: Next >> 1 - [2] - 3 - 4 - 5 Then once you hit page 6 to 10 a new block is generated like so: << Prev :: Page 8 of 8 :: Next >> 6 - 7 - [8] This is for an new kind of image gallery that I'm currently working on. 35 images are show at a time and at the bottom on the page there is the pagination. But How would I tell if a number is a multiple of 5? Cheers
  3. I agree. The ban list will be pulled from a database once i finalize the script. But even then I cannot think why any one would take the time to ban 5,000 domains... let alone 20 even.
  4. Thanks much drewjoh. I modified the if statement to check if there is a match, removed the echo, added a boolean and the break. Works great!. I do have a question about the speed though. I highly doubt that some one will ban 100 domains but just in case, how much of a slow down would be expected? Well.. given the banned domain is at the end of the array. Would I be safe using this method?
  5. I've been working on a multimedia web site for a while and one feature that I'd like to add is the ability to "ban" specific domains. I do have this working... kinda <?php $myDNS_Bans = explode(',', "siteA.com,siteB.com,siteC.com"); // This will be pulled from the DB later - Testing for now $ReqFrom = $_SERVER[HTTP_REFERER]; // Let's say the referer is siteB.com foreach( $myDNS_Bans as $Banned ) { preg_match('@(.*?)('. $Banned .'?)(.*?)@is', $ReqFrom, $Match); if( $Match[2] ) { echo "This site is on our ban list!<br />\n"; } else { echo "This site is NOT on our ban list!<br />\n"; } } ?> All right so let's just say a file was requested from siteB.com well in the out put, you'd get: This site is NOT on our ban list! This site is on our ban list! This site is NOT on our ban list! I like to my code to be fast and right to the point. My problem is that if the site is on the ban list I need to stop the loop and move on to a function that redirects the request. How can I stop the loop? Or is there a better way this can be done. Little background about this idea: The idea is to give control to the person who uploaded the file. So let's say there is a site that they really don't want their image hot linked to. They'd simply enter 'what_ever_site_it_is.com' and it'd be saved to the database. Then when the file is called it checks the ban list against the referer. ( I DO NOT want to modify my htaccess file ). Thanks guys.
  6. Thank you so much. This helps a lot! I started working with a for statement to match keys and values then go through an if else statement..... Your code works much better! Thanks jesirose and everyone.
  7. People can to this very easily. If we look at 0 - Blue 1 - Red 2 - White 3 - Yellow 4 - Black And want to move Yellow before Black we know that the list will look like 0 - Blue 1 - Yellow 2 - Red 3 - White 4 - Black But to do this in an array, I'd have to list all colors as a key, then their integer as a value. Then add 1 to the array_value up to the Yellows old value.. if that makes any since.... so array('balck'=>0, 'red'=>1, 'white'=>2, 'yellow'=>3, 'black'=>4)... I don't really know, thinking out loud here. Maybe one of you can come up with something Or what if I assign the colors a number and list the values like so. array(0=>0, 1=>2, 2=>3, 3=>2, 4=>4) the keys are the original order and the values are the new number... But I still need a way to add 1... I hope I'm not confusing any one.
  8. No, ordered. I've been working in VB lately, Keys to index... Any way, Yellow is #3 in the array and Red is #1. I want to "move" Yellow before Red.
  9. I'm having a little trouble writing a script that reorders an array. For an example, let's say I have the following array: Blue Red White Yellow Black Now, what I want to do is move "Yellow" before "Red" I know that "Yellow" will now take the place of "Red" and 1 should be subtracted to the index of each color until the value "Yellow" used to hold. 0 = Blue 1 = Red 2 = White 3 = Yellow 4 = Black I'm guessing any way, the process would be like this: 0 + 0 1 = 3 2 - 1 3 - 1 4 - 0 This should shift the array to look like: Blue Yellow Red White Black or is there an easier way? Thanks
  10. Jeez, I think I need to hit myself! That does make sense. I kinda hate it when it's something so simple like that! Thanks guys.
  11. I was thinking about using it. But what I can't figure out is how. I mean would I have to create a new table for the timestamps? This is what I know so far: When a member makes a post it's added to the "comments" table in the database, then the board timestamp is updated. Not too hard. But then how would I compare it to the members? Would they need a table with their last active time stamp to match the boards? This is what I can't figure out.
  12. I'd use stripslashes() to go from \\ to \
  13. Yeah it's a little hard to find but here ya go http://www.php.net/manual/en/language.operators.errorcontrol.php
  14. If you don't want to display the mktime() error just add the @ symbol in from like so: @mktime()
  15. You have to remember there is a difference between a quote " and a tick ' Also if you use a single / you're actually saying "look in my main home directory". In other words if you have /jen.jpg the script will look for the file in www.example.com/jen.jpg when you may be trying to look in www.example.com/gallery/images/jen.jpg But I'm glad to hear you got it to work. Happy to help.
×
×
  • 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.