Jump to content

Mothy

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Mothy

  1. if you want to avoid the use of a database like SocialCloud has suggested - you could also store the IPs in a JSON format and use json_decode($filename,true) to convert this to an array.
  2. Blocking users by IP isn't always the best way to go as user's easily fake their IP. Having said that if you are dead set on this you would be best to store all blocked IPs in a database and simply searching the database for the user's IP address you could create a MySQL database with a table which stores all IP address then use Php (either mysqli or PDO) to search if the user eg: SELECT ID FROM blocked users where IP=? and if any rows are returned you use the header... The advantage of this is assuming you have a database host that accepts external requests you can use the same code snippet on ALL of your pages. Having said that if they goto (for example the) /about page have you put in the same code or are you using an MVC structure so that the user always goes through the index page? I would recommend forwarding the blocked user to a 403-Forbidden page rather than just cnn.com.. If you dont want to have to edit the database via phpmyadmin you could then make a simple form for inputting IP addresses... There are many tutorials around for connecting a database to php but you should use one of the above functions and NOT the depreciated mysql function.
  3. I'm assuming you want the user to select a the first drop-down and if the user selects "Fruit" they can select different fruit from the second drop-down etc? You can use pure JavaScript if the items are static but if the items are to be pulled from a database you will need to use ajax to achieve Graphnick has a tutorial which gets the drop-downs from a XML document. Ali Hammad Shah has a video tutorial on this as well. The new Boston has some tutorials for AJAX as well that give you some information on how to use this if you want to play about with other ideas..
  4. Mothy

    hey

    Hey All, Currently studying computing and I love coding in php, fully self taught PHP which means I have picked up a few bad habits which I am trying to work out now I am starting to know better! Look forward to working through ideas with all of you Mothy
×
×
  • 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.