Jump to content

phpjim

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by phpjim

  1. Hi everyone - love PHPFreaks.com I have a weird programming question. I've visited websites where even though I've cleared cookies through my browser, I noticed that when I click on a some websites login form, my user name and pw are still present. Is there a way programming with PHP for the user name and password to remain on the client to populate the login form or is this something the browser does when it asks the user if they way to save the password and user name? Some would say why would you want to do this, and my answer is more of how it's done. I like how we can post in this Word type window - does anyone know where the source or class is to this nice interface on PHPFreaks.com?
  2. I have been reading several PHP books and I thought I run something by some of the experts here. Most books show passwords to connect to databases, constants, configuration settings,etc. enclosed in an include.php file that is not in the root directory. I was wondering instead of using an include file, do some of you use a table to store these items to make your site data driven? If yes, what would be an example of how you use a table instead of an include file to control your program? Another question I have is do any users alter system variables, such as a session variable or other system variables to store variable or user data so they can be accessible from any script. If yes, what would be an example of how you would use this strategy? I am just thinking out loud as I am use to programming where a variable or constant set in the main opening program can be used by any other calling program (global). I was thinkng if there is a way to accomplish this by adding information to a session or system variable and then parse out when needed. Thanks
  3. 1 - 10000 - 770117 - int(10000) 2 - 10000 - 770117 - bool(false) 3 - 10000 - 770117 - int(10000) 4 - 10000 - 770117 - int(10000) 5 - 10000 - 770117 - bool(false) 6 - 10000 - 770117 - bool(false) 7 - 1097 - 84586 - int(1097) Done, in 1.56 seconds.;
  4. PFMaBiSmAd - that was amazing. 31,000 records added in less than 2 seconds. Only half the number of records were added so I need to figure out why. Thank-you.
  5. Thanks Christian for the help. Time to go dig in and figure this out
  6. Thanks Christian. This is my first post and will use the in the future. Your time clock says it's almost 1 in the afternoon where you are, which is 6 hours ahead of me. Are you in Europe?
  7. I forgot to say that I did disable the indexes and it improved a little, but not much It was refreshing to hear there was something wrong with my programming and it's not MYSQL. For a moment I was thinking how did super fast Visual Foxpro die with the slow MYSQL speeds I was experiencing. I have not run run this at my hosting website to save on bandwidth and have been working locally on my notebook using XP, which is the same notebook I can do this in Foxpro in 10 seconds. I am not plugging Foxpro - it's what I know and the only db software I can compare my results to. Thanks.
  8. I also tried this way with the same results $lines = file($filename); foreach ($lines as $line_num => $line) { $f_office = substr($line,0,4); $zip_code = substr($line,4,5); $zip_plus = substr($line,9,4); $city_name = substr($line,13,17); $state_code = substr($line,30,2); $county_code = substr($line,32,3); $county_name = substr($line,35,15); $l_option = substr($line,50,1); $query = "INSERT INTO zip (f_office, zip_code, zip_plus, city_name, state_code, county_code, county_name, l_option) VALUES ('$f_office', '$zip_code', '$zip_plus', '$city_name' , '$state_code' , '$county_code' , '$county_name' , '$l_option')"; $db->exec($query); }
  9. sample of text from first few lines of 61000 line file - In file, the positions line up though it doesn't appear that way from the cut and past below. As you will notice, a very small, simply script that is taking forever. Removing the debug lines to the screen made no difference. 0236005010000HOLTSVILLE NY103SUFFOLK N 0446006010000ADJUNTAS PR153YAUCO N 0446006020000AGUADILLA PR005AGUADILLA N 0446006020000AGUADA PR005AGUADILLA N 0446006020000AGUADA PR003AGUADA N 0446006030000AGUADILLA PR005AGUADILLA N 0446006040000AGUADILLA PR005AGUADILLA N <?php $filename = "c:\inetpub\wwwroot\text\zip.txt"; $logfile = fopen($filename, "r"); $hostname = "localhost"; $username = "xxxxxx"; $password = "xxxxxxx"; $dsn = 'mysql:host=localhost;dbname=zipdb $db = new PDO($dsn, $username, $password); print "<p>Login Successful </p>"; $i=0; while(!feof($logfile)) { $line = fgets($logfile); ## every 1000 lines, reset timer (I added this to stop timing out) $i++; if ($i > 1000) { ini_set('max_execution_time', 600); $i=1; } $f_office = substr($line,0,4); $zip_code = substr($line,4,5); $zip_plus = substr($line,9,4); $city_name = substr($line,13,17); $state_code = substr($line,30,2); $county_code = substr($line,32,3); $county_name = substr($line,35,15); $l_option = substr($line,50,1); $query = "INSERT INTO zipdb (f_office, zip_code, zip_plus, city_name, state_code, county_code, county_name, l_option) VALUES ('$f_office', '$zip_code', '$zip_plus', '$city_name' , '$state_code' , '$county_code' , '$county_name' , '$l_option')"; $db->exec($query); ## print "$i"."...<br>"; (below ## for debugging, then commented out) ## print "$line"; ## print "$f_office <br>" ; ## echo "$zip_code <br>" ; ## echo "$zip_plus <br>" ; ## echo "$city_name <br>" ; ## echo "$state_code <br>" ; ## echo "$county_code <br>" ; ## echo "$county_name <br>" ; ## echo "$l_option <br>"; ## echo "<br>"; } ini_set('max_execution_time', '550'); if (fclose($logfile)) print "<br> File closed </br>"; ?>;
  10. I have a text file that I wrote a script to read line by line and each line equals a new record in a table containing only 5 fields and the longest field is 17 character. This a simple take a line, substr it apart and insert a record. I use to be a Visual Foxpro programmer and this would take 2 minutes. This simple task takes 1 1/2 hours or about a 1000 records added per minute. I am running this on my developement laptop using WIndows IIS. Other information I can pass along is the storage engine is InnoDB, the file is about 5 megs, the Collation is utf8_general_ci and the row format is compact. The file has two indexes that are created type Btree. One is on a 5 character zipcode filed and the other index is a 2 char state field and a 3 char code field for a total of 5 characters. Everything about these files are small and I would think the process in MYSQL wouldn't be so long. Any ideas or thoughts would be appreciated? Thanks
×
×
  • 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.