Jump to content

meltingpoint

Members
  • Posts

    194
  • Joined

  • Last visited

Everything posted by meltingpoint

  1. Two questions. 1- At what size of a file does it become too cumbersome to uses file() as opposed to something like opening a file and then while !feof etc....? 5mb? 10mb? 2- Does file() open and close automatically? No need for fopen or fclose. Tks
  2. Thanks all- great info. Cheers and enjoy the weekend.
  3. Thanks asmith- will study that page and make appropriate application. I am a little confused when referring to storing sensitive files outside the document root or public html folder. Does that mean that you create a directory inside the document root and store sensitive documents/pages there or place them in a directory behind the document root. For instance; in the example give in the tutorial- would I store sensitive data in the directory "library" or "modules" or "applications"?
  4. I have a flat file database and have a login script that also stores all the users/passwords in flatfile. Once the user has been verified- I load the username, their access level (allows them to view certain pages) and their user group into $_session variables. This all works well- no problems. Passwords are md5 into the database upon registration. My question is security. My site is on a shared hosting server. I feel fairly confident that my script won't get hacked (I have the necessary checks for user input etc...) but I worry about the session being hijacked or worse. So..........what do you all say? Should I capture the IP address and then catch it on each successive page and compare it to the original login IP address? What steps would you take to shore up some security on a shared hosting environment with out the expense of an SSL?
  5. Thanks for that. I was also experimenting and found that using b\ works too. Example; $match = preg_grep("/\b$search_var/i", $my_array); this makes sure that the search string is at the beginning of the word Cheers
  6. I am searching an array for instances of words or partial words. I need to have the regular expression check to make sure that there is a -space- at the beginning. This way- it will not count matches of the string in the middle of words. here is what I have tried; $search_var = "sil"; $match = preg_grep("/$search_var/i", $my_array); //this was the original that led me to have to check for the space at the beginning. // //so I tried; $match = preg_grep("/^([:space:])$search_var/i", $my_array);//DID NOT WORK I know I am making a stupid error- but for the life of me- I cannot figure it out.
  7. Thank you- that did in fact answer my question. I accidentally put "how" in there and thus the confusion over question or statement. That helps me out a ton. Much thanks! Andy
  8. Well...........the project is in it's begiing stages and I can switch both the existing flat file data and the form input to reflect the YYYY/MM/DD format. If I do that, how would it be a simple comparison of if ($a >= $begin_date && $a <= $end_date) { do something }
  9. I have a flat file similar to; 10/20/2009|data|data|data|1500 10/21/2009|data|data|data|1000 10/28/2009|data|data|data|2000 I will have two form entries ($begin_date, $end_date) and wish to loop through and echo those dates that fall between $begin_date and $end_date. I have searched the form and spent much time on google. Need a point in the right direction. Andy
  10. ...............that sounds reasonable. (And easy- LOL). Thanks
  11. \n - that explains the 5th element. I tried the cursor thing and it did not correct it. So I will have to figure out a way to trim the \n off the end in order to get a correct count. Any suggestion?
  12. Yes- but there are only 4 items being called in the file. The element [4]=> is empty. Therefore the count should be 4 not 5. ?
  13. the file (db_file.txt)contains four things: monkey apple orange pear when I use $XX = file("db_file.txt", "r"); and then print_r($XX); it returns- Array([0]=>monkey[1]=>apple[2]=>orange[3]=>pear[4]=> ) using $size = count($XX); it gives - 5 So why is it giving a 5th element to the file?
  14. $username and $password were passed to the script from a form. So set them like so; $username = $_POST['username']; $password = $_POST['password']; Any suggestions as to why the error mentioned in the my previous post occured? Problem with code or easyphp?
  15. Well- here was my error; ? Use a database. Because I do not know MySQL ? Use 2nd method you mentioned. - Well, I am trying to learn to loop through an array and uses/test its components. Additionally- What I hope to do is if the username and password match- I would then like to take use that info later in the script by calling $user and $psw. Hope that makes sense.
  16. This is not working. I need to query a flat file that looks like this; user1|pass1| user2|pass2| and see if it matches for a login. Can some one see what I am doing wrong? Thanks
  17. In the code below I want to query a flat file and put string contents into list. Then check if the username supplied from the form matches $member in the list. It works fine if one person is in the database- but not if there are two or more. What am I doing wrong? I have in the past been able to echo each and every "match" to any string in the list and it works fine even for multiple matches. Thanks in advance.
×
×
  • 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.