[PHP] Problem with INSERT Query
Hi all: Well, when i bring out the page with the drop down list it was able to display all tutors' names from "tutor_name" column. Anyway here's a review of my code (snip) again before i continue: --- $sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time')"; " .$row ["tutor_name"]. " "; } $result = $db-> query($sql); ?> --- so when i submit the form, i am suppose to echo the values i have entered into the field and then INSERT the values into DB (Queries stated above). However i was able to echo all other values eg. class_code, edu_level, etc...but not "tutor_name"same thing happen when i do an INSERT, all other values are inserted into DB but not $tutor_namewhy is this so???Really need some help here...Anyway i have already specify a name to be reference : and then I also did an echo of "tutor_name" being selected: while($selected_tutor_name == $tutor_name) echo $_POST["tutor_name"]; All help are greatly appreciated =) Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SV: [PHP-DB] Selecting between using letters
How about Select LastName from sometable where LastName >= 'A' and LastName <'F' Hth Henrik Hornemann -Oprindelig meddelelse- Fra: Doug Parker [mailto:[EMAIL PROTECTED] Sendt: 29. december 2003 23:18 Til: [EMAIL PROTECTED]; [EMAIL PROTECTED] Emne: [PHP-DB] Selecting between using letters How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is a while loop the most efficient way to send out multiple emails?
PHP Gurus, I currently run a few newsletters that go out to small groups of 50 to 100 people. I use a while loop to send out the emails. I chose a while loop as opposed to just taking all the emails and putting them in the CC field because I wanted to personalize each email with a greeting that included the recipients name and other personalized information. It looks like: while ($member = mysql_fetch_array($sqlQueryResult) { $content = "Hi, {$member[name]}. Your email address is {$member[email]}"; mail ($member[email], $subject, $content) } When I execute my script, it takes a little time to go through about 50 people. I'm not sure exactly, but maybe ten seconds, possibly as high as twenty. Soon I will be creating a script to send out an email to 500 people, with the possibility that it will grow to 1000. I'm concerned that the while loop will take ten times as long, and not only be a drain on the server, but also run the risk of my browser timing out waiting for a response to confirm all mails were sent. So my question is, is there a way more efficient than while loops to send out multiple emails with personalized information? Is it the mail() command that takes time, or the mysql_fetch_array(), or both? Any suggestions would be greatly appreciated. -- Yoroshiku! Dave G [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a while loop the most efficient way to send out multiple emails?
At 05:37 PM 12/30/2003 +0900, Dave G wrote: PHP Gurus, I currently run a few newsletters that go out to small groups of 50 to 100 people. I use a while loop to send out the emails. I chose a while loop as opposed to just taking all the emails and putting them in the CC field because I wanted to personalize each email with a greeting that included the recipients name and other personalized information. It looks like: while ($member = mysql_fetch_array($sqlQueryResult) { $content = "Hi, {$member[name]}. Your email address is {$member[email]}"; mail ($member[email], $subject, $content) } When I execute my script, it takes a little time to go through about 50 people. I'm not sure exactly, but maybe ten seconds, possibly as high as twenty. Soon I will be creating a script to send out an email to 500 people, with the possibility that it will grow to 1000. I'm concerned that the while loop will take ten times as long, and not only be a drain on the server, but also run the risk of my browser timing out waiting for a response to confirm all mails were sent. So my question is, is there a way more efficient than while loops to send out multiple emails with personalized information? Is it the mail() command that takes time, or the mysql_fetch_array(), or both? Any suggestions would be greatly appreciated. -- Yoroshiku! Dave G [EMAIL PROTECTED] Dave, This goes out to 900 people every night, I just bought myself some time by adding this at the bottom of the while loop: // give ourselves more time set_time_limit( 20 ); I also echo the recipient's email & an OK/Fail, depending on what mail() returns, to the browser so that I can see the progress. HTH - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a while loop the most efficient way to send out multiple emails?
Dave G wrote: So my question is, is there a way more efficient than while loops to send out multiple emails with personalized information? Is it the mail() command that takes time, or the mysql_fetch_array(), or both? Any suggestions would be greatly appreciated. It's the mail() function. I've seen a class that connects to smtp server and sends all emails in one connection, author claimed it was faster than the built-in mail() function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with INSERT Query
Do you understand the request - response process? User requests a page, php buids the page and sends it to the user, user's browser displays the page, users views it and takes some action (follows a link, submits a form) and the whole process repeats. [EMAIL PROTECTED] wrote: Hi all: Well, when i bring out the page with the drop down list it was able to display all tutors' names from "tutor_name" column. Anyway here's a review of my code (snip) again before i continue: --- $sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time')"; Where are the variables coming from? | This is illegal -+ $sql = mysql_query("SELECT DISTINCT tutor_name FROM tutor "); while ($row = mysql_fetch_array($sql)) { print " " .$row ["tutor_name"]. " "; Only one option can be selected unless the is multiple } $result = $db-> query($sql); ?> while($selected_tutor_name == $tutor_name) echo $_POST["tutor_name"]; $_POST["tutor_name"] is printed out only if $selected_tutor_name == $tutor_name, in that case the while loop would be infinite however. ?> --- so when i submit the form, i am suppose to echo the values i have entered into the field and then INSERT the values into DB (Queries stated above). However i was able to echo all other values eg. class_code, edu_level, etc...but not "tutor_name"same thing happen when i do an INSERT, all other values are inserted into DB but not $tutor_namewhy is this so???Really need some help here...Anyway i have already specify a name to be reference : and then I also did an echo of "tutor_name" being selected: while($selected_tutor_name == $tutor_name) echo $_POST["tutor_name"]; All help are greatly appreciated =) Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Testing for Well-Formed XML
Hi I'm trying to build a validator in PHP, to check that XML documents are well-formed. Does anyone have an algorithm for doing this? KR ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a while loop the most efficient way to send out multiple emails?
Dave -- ...and then Dave G said... % % PHP Gurus, % I currently run a few newsletters that go out to small groups of % 50 to 100 people. I use a while loop to send out the emails. I chose a ... % about 50 people. I'm not sure exactly, but maybe ten seconds, possibly % as high as twenty. % Soon I will be creating a script to send out an email to 500 ... % So my question is, is there a way more efficient than while % loops to send out multiple emails with personalized information? Is it % the mail() command that takes time, or the mysql_fetch_array(), or both? % Any suggestions would be greatly appreciated. 0) That really should be $member['name'] and $member['email'] instead of bare indices, you know :-) 1) It's definitely the mail() command, and that's dependent on the underlying mail system. 2) Driving this from the browser is probably a bad way to go because you will always be fighting timeout issues *and* what about a broken connection not because of a timeout? 3) If you want full personalization, you're stuck with individual emails, but lots of mailing list software out there can handle VERPing and, say, footers and save you a whopping lot of work. 4) I did some work this summer on a mass mail script; with a little script tweaking and some (but not onerous) qmail tweaking, I got our times down to around 100ms per email. That puts us sending about 30k [personalized] emails per hour, which is an order of magnitude faster than the speed of the guys who lost the contract to us :-) It's discussed on the list a bit; check the archives. HTH & HAND & Happy Holidays :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
php-general Digest 30 Dec 2003 11:32:19 -0000 Issue 2502
php-general Digest 30 Dec 2003 11:32:19 - Issue 2502 Topics (messages 173454 through 173477): Re: Selecting between using letters 173454 by: Vail, Warren Has anyone installed AWF 1.10?? I need some help 173455 by: Student HTML via echo or not 173456 by: Robin Kopetzky 173457 by: Larry Brown 173458 by: Jordan S. Jones 173459 by: Robert Cummings 173460 by: Robert Cummings 173466 by: David T-G Re: PHP and SSL Path Reference 173461 by: Manuel Lemos Re: Can't upload files > then 400K to MySQL 173462 by: Jeremy Johnstone Re: Migrating from SSI and Perl 173463 by: Philip Pawley Re: Can somebody convert this short Perl Script to PHP? 173464 by: Tom Rogers PHP cart & Credit Card processing 173465 by: Cesar Aracena Re: Can't upload file greater than 11kb 173467 by: David T-G curl tutorial 173468 by: Binay 173469 by: Manuel Lemos Problem with INSERT Query 173470 by: irinchiang.justeducation.com 173475 by: Marek Kilimajer Re: [PHP-DB] Selecting between using letters 173471 by: Henrik Hornemann Is a while loop the most efficient way to send out multiple emails? 173472 by: Dave G 173473 by: Miles Thompson 173474 by: Marek Kilimajer 173477 by: David T-G Testing for Well-Formed XML 173476 by: Ian Williams Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- If the database is really large, some databases will attempt to use an index if you use "between" as in select * from table where lastname between "A" and "F" or > and < compares. not sure about MySQL, and notice I had to use the letter "F" to get all names beginning with "E" I seem to recall Sybase would use a table scan (read every row in the table) if an imbedded function was used in the where clause, and it would use an index with between. Haven't done any internals work with MySQL so not sure if this would speed things up or not. Warren Vail -Original Message- From: Lowell Allen [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 2:25 PM To: PHP Subject: Re: [PHP] Selecting between using letters > How would I create a select statement in MySQL that would return a range of > records from the LastName field where the value starts with a designated > letter - for example, returning the range where the first letter of LastName > is between A and E... > > Any help would be greatly appreciated. $sql = "SELECT * FROM table WHERE LastName REGEXP '^[A-E]'"; HTH -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- --- Begin Message --- Has anyone installed AWF 1.10?? I need some help... -- --- End Message --- --- Begin Message --- Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, '', CR, ' ', CR, ' etc...'; I like the look. It's more readable, gives me a better view of variables as they are all single-quoted and stand out nicely in my editor. No messy jumping into and out of php. I have looked at a bunch of php code written by others and HEREDOC looks stupid with everything jammed against the left side of the screen, php tags within HTML breaks up the flow of properly formatted HTML, which I firmly require for all of my code, and just doesn't look right. 'print' makes you add \" to all of the HTML attributes but the 'echo' method makes everything look like php! Since all your doing is dumping text to the output subsystem, there shouldn't be any speed decrease in the code. Yes, I know, there are advocates for every kind of method to display HTML code but just wanting to get others opinions on the subject. If you wish, email me off-list @ sparkyk-AT-blackmesa-isp.net. Cheers! Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM 87020 --- End Message --- --- Begin Message --- I agree. I think embedding the tags is messy and harder to follow. I do however, treat echo like print. ie echo "The thought would \"have\" to be clear."; I've not use CR,. I'll have to look at that. Thanks -Original Message- From: Robin Kopetzky [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 8:02 PM To: PHP General Subject: [PHP] HTML via echo or not Good evening. I'm probably going to stir up a hornet's nest but have a question. Does using echo for ALL html pages mean I have a sick mind? Example: echo CR, '', CR, ' ', CR, ' etc...'; I like the lo
[PHP] Problem with fmod() function
Hello, My understanding from the documentation is that the fmod() function should work with floating point numbers however the following snippet of code: "; echo "y: $y "; echo "fmod: " . fmod($x, $y) . ""; ?> outputs the following: x: 1.05 y: 0.05 fmod: 0.05 I would have expected to get an answer of 0 i.e. no remainder. It works fine for whole numbers. Can any one shed any light on this please? Thank you. Regards, Andy P.S. I tried using the following function but I get the same results: function fmodAddOn($x,$y) { $i = floor($x/$y); // r = x - i * y return $x - $i*$y; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Evaluating Variables at the correct time
Hi There, I'm a bit of a newbie here I'm afraid so I'm sorry if this is an obvious question. I have a script which read includes an html file. The html makes a call so a function in the main script. This call passes a string which includes variables i.e. : $title$name in the function that gets called the variables $title and $name get populated with values and then the script echos the html string to the client. The problem is that the variables in the html string get evaluated at the point it is passed into the function not as the point it is echoed. Can anyone help? Thanks Ben Wrigley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is a while loop the most efficient way to send out multiple emails?
> I currently run a few newsletters that go out to small groups of > % 50 to 100 people. I use a while loop to send out the emails. I chose I have a module that does about about 100 emails (10Kb of data per email, which is a decent sized email) in 8 - 10 seconds. (Does around 610 - 625 emails per minute). This is accomplished by skipping PHP's internal mail functionality entirely and making a direct socket connection to the SMTP server. Another benefit of this is that any MySQL delay can be removed from the actual mail functionality by adding all the recipients to the class, and closing the MySQL query - before sending the emails. Ultimately, the speed really depends on the SMTP server. I'm sure with a little hacking, I may be able to get 650 - 675 emails per minute. One faster method of sending bulk emails requires A) having direct access to the filesystem of the mail server, and B) hacking sendmail configuration - which both mean "root" access. I've gotten up to 850 emails per minute with this method. The class is easy to use - basically: $_Mailer = &new mod_sendmail(); $_Mail->setSubject( strText ); $_Mail->setBody( strText ); $_Mail->addRecipient( strName, strEmail ); $_log = $_Mail->sendAll(); The $_log var is an array in the format of: $_log[ strEmail ] = strData strEmail is the intended recipient, and and strData will either be A) the MsgID returned by the SMTP server on success or B) a "0" if failed. This makes it possible to add a function to re-send failed emails later. If you want the socket-based code, just send me a private email to [EMAIL PROTECTED] I'm working on getting a code repository going, but for now, just have to send it to you directly. -- James [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best way to specify path to a file in a $variable?
Hola, PHP folk- I am using $page_title="some page title here"; require('header.inc'); to include a common header for all my pages. I am using $page_title so I can have unique names for the different pages. //---header.inc ... I want to be able to also define the path to the CSS file. For instance, some pages will have the CSS in the same directory, so that part would read "./my.css" If the page is located in a subdirectory, the path would then be "../my.css" I would like to use a php variable where I can define the path the same way as the $page_title works. I have tried some experiments with a $path_to_css variable, but I have not had much success. I think part of the problem is that I might be stumbling over escaping everything properly. Is there a better way to do what I am trying to do? Thanks, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to specify path to a file in a $variable?
I personally link my css files using the root dir... eg: host/myaccount/mywebsite/mycssfile.css That way, it's always pointing to the correct file... hope it helps/// Danny Anderson <[EMAIL PROTECTED]> 30/12/2003 14:15 To [EMAIL PROTECTED] cc Subject [PHP] best way to specify path to a file in a $variable? Hola, PHP folk- I am using $page_title="some page title here"; require('header.inc'); to include a common header for all my pages. I am using $page_title so I can have unique names for the different pages. //---header.inc ... I want to be able to also define the path to the CSS file. For instance, some pages will have the CSS in the same directory, so that part would read "./my.css" If the page is located in a subdirectory, the path would then be "../my.css" I would like to use a php variable where I can define the path the same way as the $page_title works. I have tried some experiments with a $path_to_css variable, but I have not had much success. I think part of the problem is that I might be stumbling over escaping everything properly. Is there a better way to do what I am trying to do? Thanks, Danny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***
Re: [PHP] best way to specify path to a file in a $variable?
The way my server is setup it depends on your web root dir. If your css dir and file are located in: /userid/public_html/css/css1.css My web root is: /userid/public_html/ So the path I would use to get to the css file is: /css/css1.css -Blake Danny Anderson wrote: Hola, PHP folk- I am using $page_title="some page title here"; require('header.inc'); to include a common header for all my pages. I am using $page_title so I can have unique names for the different pages. //---header.inc ... I want to be able to also define the path to the CSS file. For instance, some pages will have the CSS in the same directory, so that part would read "./my.css" If the page is located in a subdirectory, the path would then be "../my.css" I would like to use a php variable where I can define the path the same way as the $page_title works. I have tried some experiments with a $path_to_css variable, but I have not had much success. I think part of the problem is that I might be stumbling over escaping everything properly. Is there a better way to do what I am trying to do? Thanks, Danny -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still Racking My Brain
Okay, I got my pathname straightened out, but I'm still showing the "unexpected $" message. But that's after doing $[var name] = $_POST['var name']; for everything with a $ in front of it. Can someone please let me know what I'm not understanding here? The code is, again, below. Thank you very much. Steve Tiano --- // image index // generates an index file containing all images in a particular directory //point to whatever directory you wish to index. //index will be written to this directory as imageIndex.html $dirName = "c:/csci/mm"; $dp = opendir($dirName); chdir($dirName); //add all files in directory to $theFiles array while ($currentFile !== false){ $currentFile = readDir($dp); $theFiles[] = $currentFile; } // end while //extract gif and jpg images $imageFiles = preg_grep("/jpg$|gif$/", $theFiles); $output = ""; foreach ($imageFiles as $currentFile){ $output .= << HERE; } // end foreach //save the index to the local file system $fp = fopen("imageIndex.html", "w"); fputs ($fp, $output); fclose($fp); //readFile("imageIndex.html"); print "image index\n"; ?> mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Migrating from SSI and Perl
Have I got this right? I am doing "$BRPHP" ); exec (' ../cgi-bin/browser.pl', $arr ); echo $arr[2]; echo $arr[3]; echo $arr[4]; echo $arr[5]; echo $arr[6]; ?> 1. Am I passing $arr[1] to the perl script? 2. If no, what should I do instead? 3. If yes, how can I access it from the perl script? (Yes, I know the last question is a perl question, so I'll be happy to just get an answer to the first two). Thanks, Philip Pawley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still Racking My Brain
Hello stiano, Tuesday, December 30, 2003, 3:24:04 PM, you wrote: son> Okay, I got my pathname straightened out, but I'm still showing the son> "unexpected $" message. The following works fine for me (on a Windows XP box + PHP4 + Apache) Image List Images in: $dirName "; foreach ($imageFiles as $currentFile) { $output .= "\n"; } $output .= " "; $fp = fopen("imageIndex.html", "w"); fputs ($fp, $output); fclose($fp); // The following works, except that all the image links are broken because the directory is wrong readFile("$dirName\imageIndex.html"); ?> -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating a very simple cms with one login and one mySQL database
I'm new to php and am trying to create a very basic content management system to let my client update a popup on their homepage. I'm using mySQL and have a good idea of how to do the login and set & read cookies, as well as accessing the database during the admin process. The part I'm not too clear on is how to implement the front end for the general users. When someone visits the site and the popup pops up, what happens on that page? Does it access the database at the time it loads to load the information? If so, is this possible without hardcoding the username/password information (to access the database) in the popup page code? Is there a tutorial or article on stuff like this somewhere? -- Charlie Fiskeaux II Media Designer Cre8tive Group cre8tivegroup.com 859/858-9054x29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a very simple cms with one login and one mySQL database
[snip] Is there a tutorial or article on stuff like this somewhere? [/snip] Search for an article on evolt.org called the ABC's of CMS, it is a fair starting point. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] looping problem?
Problem with looping over a CSV file (3 results for each line)? Here is the CSV file contents... MTPC-01,00:02:B3:A2:9D:ED,155.97.15.11 MTPC-02,00:02:B3:A2:B6:F4,155.97.15.12 MTPC-03,00:02:B3:A2:A1:A7,155.97.15.13 MTPC-04,00:02:B3:A2:07:F2,155.97.15.14 MTPC-05,00:02:B3:A2:B8:4D,155.97.15.15 Here is the script... $row = 1; $file = "fa.csv"; $id = fopen("$file","r"); while($data = fgetcsv($id,100,",")) { $num = count($data); $row++; for($c = 0; $c < $num; $c++) { echo "host $data[0] {\nhardware ethernet $data[1];\nfixed-address $data[2];\n}\n"; } } fclose($id); ?> And this is the output... (notice 3 results for the first line in the CSV file) host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } Any help is appreciated... Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping problem?
>Problem with looping over a CSV file (3 results for each line)? > >Here is the script... >$row = 1; >$file = "fa.csv"; >$id = fopen("$file","r"); > while($data = fgetcsv($id,100,",")) { > $num = count($data); > $row++; > for($c = 0; $c < $num; $c++) { >echo "host $data[0] {\nhardware ethernet $data[1];/>\nfixed-address $data[2];\n}\n"; } > } >fclose($id); >?> Remove the for-loop on the 8th line. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with INSERT Query
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > Hi all: > > Well, when i bring out the page with the drop down list it was able to display > all tutors' names from "tutor_name" column. Anyway here's a review of my code > (snip) again before i continue: > -- - > > $sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, > timetable_time) > VALUES > ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time' )"; > > > > > > > $sqltutor = mysql_query("SELECT DISTINCT tutor_name FROM tutor "); while ($row = mysql_fetch_array($sqltutor)) { print " " .$row ["tutor_name"]. " "; > } > $result = $db-> query($sql); > > ?> > > > > while($selected_tutor_name == $tutor_name) > echo $_POST["tutor_name"]; > How about if ($tutor_name ){ echo $_POST["tutor_name"]; $sql = "INSERT INTO class (class_code, tutor_name, edu_level, timetable_day, timetable_time) VALUES ('$class_code','$tutor_name','$edu_level','$timetable_day','$timetable_time' )";} is it working? Hadi > ?> > > > > -- - > > so when i submit the form, i am suppose to echo the values i have entered into > the field and then INSERT the values into DB (Queries stated above). However i > was able to echo all other values eg. class_code, edu_level, etc...but > not "tutor_name"same thing happen when i do an INSERT, all other values > are inserted into DB but not $tutor_namewhy is this so???Really need some > help here...Anyway i have already specify a name to be reference : > > > > and then I also did an echo of "tutor_name" being selected: > > while($selected_tutor_name == $tutor_name) > echo $_POST["tutor_name"]; > > All help are greatly appreciated =) > > Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A new PHP/JAVA module
Hi, attached is a php/java bridge which uses sockets to communicate with java instead of creating a new JVM for each request. The protocol that is used is very simple but efficient and the Apache/PHP/JAVA solution should be as efficient as Apache/Tomcat/Java for example. This module is based on Sam Ruby's original java code, but it is easier to install. Jost java.tar.gz Description: GNU Zip compressed data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function problem?
Not sure why the last section won't work... /* Function to search for hosts */ function search_dhcp() { if ((empty($_POST['search'])) && (empty($_POST['hosts01'])) && (empty($_POST['hn'])) && (empty($_POST['ma'])) && (empty($_POST['i'])) && (empty($_POST['v']))) { unset($_SESSION['search']); $_SESSION['search'] = "Search for individual computers to edit**This feature will search all VLAN's for individual machines to make host configuration changes to.ex. 10.10.0.255 or dhcp-client Wildcards are marked as a '%'."; } elseif ((!empty($_POST['search_name'])) && (empty($_POST['hosts01'])) && (empty($_POST['hn'])) && (empty($_POST['ma'])) && (empty($_POST['i'])) && (empty($_POST['v']))) { unset($_SESSION['search']); require 'dbase.inc.php'; $table = "hosts"; $x = @mysql_query("SELECT * FROM $table WHERE hostname LIKE '$_POST[search_name]'")or die(mysql_error()); $num = mysql_num_rows($x); if($num == "0") { $_SESSION['search'] = "Search for individual computers to edit by hostname**This feature will search all VLAN's for individual machines to make host configuration changes to.(ex. dhcp_client_003) Wildcards are marked as a '%'. No hosts matched your search for $_POST[search_name]."; } elseif ($num != 0) { $_SESSION['search'] .= "Here are your search results.**Please select the machine you wish to make changes to."; while($v = mysql_fetch_array($x)) { list($_SESSION['id'],$_SESSION['hn'],$_SESSION['ma'],$_SESSION['i'],$_SESSION['v']) = $v; $_SESSION['search'] .= "$_SESSION[hn] | $_SESSION[i] | $_SESSION[v]"; } $_SESSION['search'] .= ""; } else { $_SESSION['search'] = "Search for individual computers to edit by hostname(ex. dhcp_client_003)**This feature will search all VLAN's for individual machines to make host configuration changes to. No hosts matched your search for $_POST[search_name]."; } unset($_SESSION['id'],$_SESSION['hn'],$_SESSION['ma'],$_SESSION['i'],$_SESSION['v']); } elseif ((!empty($_POST['hosts01'])) && (empty($_POST['search'])) && (empty($_POST['hn'])) && (empty($_POST['ma'])) && (empty($_POST['i'])) && (empty($_POST['v']))) { unset($_SESSION['search']); require 'dbase.inc.php'; $table = "hosts"; $x = mysql_query("SELECT * FROM $table WHERE hostname = '$_POST[hosts01]' OR ip = '$_POST[hosts01]' OR mac = '$_POST[hosts01]'")or die(mysql_error()); $num = mysql_num_rows($x); if($num == "0") { unset($_SESSION['search']); $_SESSION['search'] = "Search for individual computers to edit by hostname(ex. dhcp_client_003)**This feature will search all VLAN's for individual machines to make host configuration changes to. You did not select a host to edit."; } elseif ($num != 0) { while($a = mysql_fetch_array($x)) { list($_SESSION['id01'],$hn,$ma,$i,$v) = $a; } $_SESSION['search'] = " You are about to make changes to $hn | $i** Please fill out all fields and be carefull when entering the MAC address. The proper format is as such XX:XX:XX:XX:XX Hostname MAC-Address IP-Address VLAN / Subnet: "; } elseif ((empty($_POST['hosts01'])) && (empty($_POST['search'])) && (!empty($_POST['hn'])) && (!empty($_POST['ma'])) && (!empty($_POST['i'])) && (!empty($_POST['v']))) { unset($_SESSION['search']); // Will not get to this point! $_SESSION['search'] = " Your changes to $_POST[hosts01] were successfull** To make your changes active you must use the \"UPDATE DHCP\" link on the left Hostname $_POST[hn] MAC-Address $_POST[ma] IP-Address $_POST[i] VLAN / Subnet: $_POST[v] "; } else { unset($_SESSION['search']); $_SESSION['search'] = " Something broke, please try again."; } } else { unset($_SESSION['search']); header("Location: login.hosts.php"); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] function problem?
[snip] Not sure why the last section won't work... ...so much code it made my head hurt [/snip] Not sure either. Did you have a question? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looping problem?
Shorter version of the script: $line = file("fa.csv"); for($i=0;$i $data = explode(",", $line[$i]); echo "host $data[0] {\nhardware ethernet $data[1];\nfixed-address $data[2];\n}\n"; } ?> At 08:10 AM 12/30/2003, Jas wrote: Problem with looping over a CSV file (3 results for each line)? Here is the CSV file contents... MTPC-01,00:02:B3:A2:9D:ED,155.97.15.11 MTPC-02,00:02:B3:A2:B6:F4,155.97.15.12 MTPC-03,00:02:B3:A2:A1:A7,155.97.15.13 MTPC-04,00:02:B3:A2:07:F2,155.97.15.14 MTPC-05,00:02:B3:A2:B8:4D,155.97.15.15 Here is the script... $row = 1; $file = "fa.csv"; $id = fopen("$file","r"); while($data = fgetcsv($id,100,",")) { $num = count($data); $row++; for($c = 0; $c < $num; $c++) { echo "host $data[0] {\nhardware ethernet $data[1];\nfixed-address $data[2];\n}\n"; } } fclose($id); ?> And this is the output... (notice 3 results for the first line in the CSV file) host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } host MTPC-01 { hardware ethernet 00:02:B3:A2:9D:ED; fixed-address 155.97.15.11; } Any help is appreciated... Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I protect downloadable files?
Hello, I have wrtten a PHP based web site with a MySql backend and now I want to password protect downloadable files. I have logon and session handling taken care of but I can't figure out how to only allowed those who are currently logged in and above a certain security level to access the downloadable content and prevent bookmarking of the file location for redownloading. Currently I have a .htaccess file to protect the files but then you need to enter a User ID and password a second time. I would prefer a single signon solution. I have considered copying the files to a temporary area each time someone wants to download it and then erase it when the session is killed but these files can be large (20-100 mb) and I would rather not do all of that copying if possible. Creating unique symlinks would be easier but my development machine is Windows and my server is FreeBSD and I can't create file links under Windows. Plus, my FreeBSD server is not near me so remote development is difficult. Thanks to anyone with any ideas, Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
On Tue, 30 Dec 2003, news.php.net wrote: > Creating unique symlinks would be easier but my development machine is > Windows and my server is FreeBSD and I can't create file links under > Windows. Plus, my FreeBSD server is not near me so remote development is > difficult. 1) windows has symlinks since win2000, however they are named Junctions. I would recommend visiting sysinternals.com and getting junctions tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! 2) another way is to make a redirect, so you do: getFile.php?file=something.zip and in your code you do: 3) final way is to pass through the file yourself. Safest way, but potentially more resource hungry than the two above in your code you do: recommended reads: http://www.php.net/manual/en/function.header.php further recommended things to checkout: freshmeat , and search for anti leecher scripts. /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] saving variables and including files.
I used to program in Miva some because it was fairly easy. I got used to using some things and was wondering if there is a PHP equivalent. ")> The first MvEXPORT would at a the new data to the top of the list. The the MvIMPORT with the nested MvEXPORT would add the rest of the data to the list of data. I've been looking through my PHP book and only see how to use databases in it. I was wondering if there is a way to save something like this without the use of a database. I plan on making a few form mages that are going to save some data, but like 3 or 4 entries each. Since my webspace limits the number of databases, i'd rather do it without the use of that. My second question is about including pages. would | include the file the same way a SSI include would? Thanks. -Joe | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] saving variables and including files.
[snip] Since my webspace limits the number of databases, i'd rather do it without the use of that. [/snip] see file functions in the manual like fopen, fwrite, etc. [snip] My second question is about including pages. would | include the file the same way a SSI include would? [/snip] Like this -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A hint...
Hello list.. I was needing a small hint on how to make a sort of status page... What I have is a function that takes a few minutes to complete... It send an snmp signal out then waits a bit and then gets the status via snmp. I would like to have some sort of graphic or page for the status, e.g. Percent done, a flashing waiting or something. How might I do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] A hint...
[snip] I was needing a small hint on how to make a sort of status page... What I have is a function that takes a few minutes to complete... It send an snmp signal out then waits a bit and then gets the status via snmp. I would like to have some sort of graphic or page for the status, e.g. Percent done, a flashing waiting or something. How might I do this? [/snip] A quick thought would be to use flush() http://www.php.net/flush to send output to the browser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] "Secure programmer: Keep an eye on inputs"
This was posted to Slashdot not too long ago, and seems applicable to php-general given the frequent mentions of register_globals and usage of the get and post arrays. It's a detailed explanation of many common ways that software which is overly trusting of its input can be exploited, and underscores the point that input from the open internet is particularly risky. http://www-106.ibm.com/developerworks/linux/library/l-sp3.html A lot of the article deals specifically with writing applications in a Unix environment, but the general take-home points for PHP programmers boil down to: - In a client/server system, the server should never trust the client. - Ruthlessly check untrusted inputs. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] connecting to progress db
Hi, I am not sure how to go about this. =( I think my problems are twofold. problem 1. I have to connect to a progress database, for which there is no built-in php support. I have been looking at the unified ODBC functions, but progress isn't one of the supported dbs there either. problem 2. the db is not specifically a web db. It is the clients' production db that is located on their facility and it is behind a firewall. I know I will get a performance hit with this setup, but I can live with this. question 1: do I need a progress driver, or do the ODBC functions take care of that? question 2: is it possible for the db connection to get thru a firewall, and then connect to a db? TIA, Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use anchor with php post string to jump to a page???
Sorry! Here's a better example to what I meant from the last posting when I said something about color=red#RowNum3. --snip-- //Example #1 http://www.yourserver.com/yourpage.htm#RowNum3"; target="doc">Jump //Example #2 http://www.yourserver.com/yourpage.htm?color=red&color1=blue"; target="doc">Jump //Example #3 http://www.yourserver.com/yourpage.htm?color=red#RowNum3"; target="doc">Jump --snip-- As in example #3, PHP seem to be able to distingush the difference when there is a pound symbol, or "#" in it and know that '#RowNum3' is not part of the post string to the variable, color. So we get this --snip-- color --> red --snip-- And not this... --snip-- Color --> red#RowNum3 --snip-- Cheer, Scott "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It does work now. Going the other way around does the trick. Surprisely, > PHP doesn't treat it as if two seperate thing are combined into one post > data, like color for example that would be displayed as 'redRowNum3'. > > Thanks, > Scott > > "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Whoop! I think I found the problem, let me fix it and see if that work.. > > > > > > "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > That would have been nice but it doesn't seem to work. Alright, I guess > > > I'll redo the script to make it work differently... > > > > > > Thanks, > > > Scott > > > "Stuart" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > Scott Fletcher wrote: > > > > > Sample script I have here is this... > > > > > > > > > > --snip-- > > > > > http://www.yourserver.com/yourpage.htm#RowNum3"; > > > > > target="doc">Jump > > > > > > > > > > > > > > src="http://www.yourserver.com/yourpage.htm";> > > > > > --snip-- > > > > > > > > > > Where yourpage.htm have this "blah > > > blah" > > > > > > > > > > So, question here is how do I pass the post string to the Iframe, > like > > > > > "&color=red" in this example, this example doesn't work... The > iframe > > > is > > > > > the target method > > > > > > > > > > --snip-- > > > > > http://www.yourserver.com/yourpage.htm#RowNum3&color=red > > > > > target="doc">Jump > > > > > --snip-- > > > > > > > > The anchor goes after the query string, like so... > > > > > > > > http://www.yourserver.com/yourpage.htm?color=red#RowNum3 > > > > target="doc">Jump > > > > > > > > -- > > > > Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Flag Options before Compiling PHP...
Hi! I'm encountering an interesting situation. I can do with one file path in a flag for the compiler without a problem, but with 2 file paths in one flag. What is needed to combine those two paths into one flags? --snip-- LDFLAGS='-L/usr/local/ssl/lib' LDFLAGS="CUSTOMER_ODBC_LIBS='-L/usr/local/lib -lodbc' " --snip-- Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Sub search - Is there such a thing?
Some one is asking me to create a sub search on a search that has already been done. For instance, the database has 50,000 records, a user does a search for two keywords which yielded 1700 records. They want to now filter that list with other keywords. The logic is that searching 1700 records has got to be faster than searching 50,000 records. The only way I know how to do this is to save the results of the pervious search to hidden fields and allow the user to add more keywords, which in essence isn't doing other than adding more keywords to the search doing the same exact thing they did before with new keywords. Is this logic correct or is there a way to save that queries results and search only that? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is the Basic function to encode the password upon the authentication..
Hi! What is the function exactly for encoding the user's typed password in PHP after the HTTP Authentication pop-up window by Apache was submitted? I tried the base64_encode() but it is not the right function. The authentication header here is .. --snip-- header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); --snip-- Thanks, FletchSOD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mysql management programme for windows?
Hi. Do you know any mysql management programme as phpmyadmin but not works on the server. i want to install on my PC. then i connect my database on server from my PC at home. Do you know it? _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
I would go for the 3rd alternative. There are several ways to "stream" the file with the use of headers. This way you can validate the user securely with your logon system, and you can place the files outside the viewable web content. Typically oputside your www / public_html folder. I use this myself in an application I use, streaming files at 50MB does not use alot of resources at all, atleast not the way I use. My use for the script is to serve high resolution images to several customers, often TIF images up to 50MB and larger. Heres the code I use : $distribution= "filepathonserver"; if ($fd = fopen ($distribution, "r")){ $size=filesize($distribution); $fname = basename ($distribution); header("Pragma: "); header("Cache-Control: "); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"".$fname."\""); header("Content-length: $size"); while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Apz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Tue, 30 Dec 2003, news.php.net wrote: > > Creating unique symlinks would be easier but my development machine is > > Windows and my server is FreeBSD and I can't create file links under > > Windows. Plus, my FreeBSD server is not near me so remote development is > > difficult. > > 1) windows has symlinks since win2000, however they are named Junctions. >I would recommend visiting sysinternals.com and getting junctions >tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > 2) another way is to make a redirect, so you do: >getFile.php?file=something.zip > >and in your code you do: > include "_mylibs.php" > if (userLoggedIn()) > header "Location: ".$_REQUEST["file"]; > else > echo "Only Valid People Can Login"; >?> > > 3) final way is to pass through the file yourself. Safest way, but >potentially more resource hungry than the two above >in your code you do: > > > include "_mylibs.php" > if (userLoggedIn()) > { > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; ". >"filename=".$_REQUEST["file"]); > readfile($_REQUEST["file"]); > } > else > echo "Only Valid People Can Login"; >?> > > > > recommended reads: > http://www.php.net/manual/en/function.header.php > > further recommended things to checkout: > freshmeat , and search for anti leecher scripts. > > > > /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I protect downloadable files?
You could have your authorization info in the mysql db including file locations that are stored along with the authorization level necessary to download them. If the person is authenticated to download the file, the php script uses the file location info from the db to open the file and generate the headers necessary to start the download. This way the end user never has to have direct access to the download directory and you don't have to copy the file into a temporary directory. Larry -Original Message- From: news.php.net [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 2:13 PM To: [EMAIL PROTECTED] Subject: [PHP] How do I protect downloadable files? Hello, I have wrtten a PHP based web site with a MySql backend and now I want to password protect downloadable files. I have logon and session handling taken care of but I can't figure out how to only allowed those who are currently logged in and above a certain security level to access the downloadable content and prevent bookmarking of the file location for redownloading. Currently I have a .htaccess file to protect the files but then you need to enter a User ID and password a second time. I would prefer a single signon solution. I have considered copying the files to a temporary area each time someone wants to download it and then erase it when the session is killed but these files can be large (20-100 mb) and I would rather not do all of that copying if possible. Creating unique symlinks would be easier but my development machine is Windows and my server is FreeBSD and I can't create file links under Windows. Plus, my FreeBSD server is not near me so remote development is difficult. Thanks to anyone with any ideas, Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mysql management programme for windows?
pehepe php wrote: Do you know any mysql management programme as phpmyadmin but not works on the server. i want to install on my PC. then i connect my database on server from my PC at home. Do you know it? Well, you could just run PHPMyAdmin on your own computer and just have it connect to the remote host. Otherwise, there are a host of programs you could run: MySQL Command Center (MySQL CC), MySQLFront, Mascon, EMS MySQL Manager 2, fabForce DB Designer 4, Navicat PremiumSoft MySQL Studio, SQLYog... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the Basic function to encode the password upon the authentication..
Scott Fletcher wrote: What is the function exactly for encoding the user's typed password in PHP after the HTTP Authentication pop-up window by Apache was submitted? I tried the base64_encode() but it is not the right function. The authentication header here is .. --snip-- header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); --snip-- Encoding it for what? It comes into PHP as a $_SERVER variable in plain text. If you want to compare it to an .htaccess type password, then I think crypt() is what you need. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Sub search - Is there such a thing?
Vernon wrote: Some one is asking me to create a sub search on a search that has already been done. For instance, the database has 50,000 records, a user does a search for two keywords which yielded 1700 records. They want to now filter that list with other keywords. The logic is that searching 1700 records has got to be faster than searching 50,000 records. The only way I know how to do this is to save the results of the pervious search to hidden fields and allow the user to add more keywords, which in essence isn't doing other than adding more keywords to the search doing the same exact thing they did before with new keywords. Is this logic correct or is there a way to save that queries results and search only that? You could store the results of the first search into a temporary table and then "sub-search" from that table... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to use anchor with php post string to jump to a page???
>Here's a better example to what I meant from the last posting when I said >something about color=red#RowNum3. >--snip-- >As in example #3, PHP seem to be able to distingush the difference when >there is a pound symbol, or "#" in it and know that '#RowNum3' is not part >of the post string to the variable, color. This is because PHP never sees the pound symbol - the target is recognized client-side and stripped prior to sending the request to the server. If you check your server logs, you'll see that it isn't there. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Sub search - Is there such a thing?
Vernon wrote: The logic is that searching 1700 records has got to be faster than searching 50,000 records. No. Not according to theory. If you want to discuss theory it will have to be in database news group this is php. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
Hi, Larry has made a good suggestion. This is something that works because i have also used something simiar. If you really want to get a sophisticated you can use a a simple shopping cart. In our site when we give free downloads for selected users we just inject a zero valued order into the database. Larry Brown wrote: You could have your authorization info in the mysql db including file locations that are stored along with the authorization level necessary to download them. If the person is authenticated to download the file, the php script uses the file location info from the db to open the file and generate the headers necessary to start the download. This way the end user never has to have direct access to the download directory and you don't have to copy the file into a temporary directory. Larry -Original Message- From: news.php.net [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 2:13 PM To: [EMAIL PROTECTED] Subject: [PHP] How do I protect downloadable files? Hello, I have wrtten a PHP based web site with a MySql backend and now I want to password protect downloadable files. I have logon and session handling taken care of but I can't figure out how to only allowed those who are currently logged in and above a certain security level to access the downloadable content and prevent bookmarking of the file location for redownloading. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
However I forgot to mention, all theese header tricks are real swell indeed, but you should get hold of a friend on a macintosh. The method I use doesnt work on the macintosh, so for the mac users we just serve the files "as is", meaning they accually dont get protected... The other methods aswell should be tested on macintosh systems just to be sure. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would go for the 3rd alternative. There are several ways to > "stream" the file with the use of headers. > > This way you can validate the user securely with your logon system, > and you can place the files outside the viewable web content. > Typically oputside your www / public_html folder. > > I use this myself in an application I use, streaming files at 50MB > does not use alot of resources at all, atleast not the way I use. > My use for the script is to serve high resolution images to several > customers, often TIF images up to 50MB and larger. > > Heres the code I use : > > $distribution= "filepathonserver"; > if ($fd = fopen ($distribution, "r")){ > $size=filesize($distribution); > $fname = basename ($distribution); > > header("Pragma: "); > header("Cache-Control: "); > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=\"".$fname."\""); > header("Content-length: $size"); > > while(!feof($fd)) { > $buffer = fread($fd, 2048); > print $buffer; > } > fclose ($fd); > exit; > } > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Apz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, 30 Dec 2003, news.php.net wrote: > > > Creating unique symlinks would be easier but my development machine is > > > Windows and my server is FreeBSD and I can't create file links under > > > Windows. Plus, my FreeBSD server is not near me so remote development > is > > > difficult. > > > > 1) windows has symlinks since win2000, however they are named Junctions. > >I would recommend visiting sysinternals.com and getting junctions > >tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > > > 2) another way is to make a redirect, so you do: > >getFile.php?file=something.zip > > > >and in your code you do: > > > include "_mylibs.php" > > if (userLoggedIn()) > > header "Location: ".$_REQUEST["file"]; > > else > > echo "Only Valid People Can Login"; > >?> > > > > 3) final way is to pass through the file yourself. Safest way, but > >potentially more resource hungry than the two above > >in your code you do: > > > > > > > include "_mylibs.php" > > if (userLoggedIn()) > > { > > header("Content-type: application/octet-stream"); > > header("Content-Disposition: attachment; ". > >"filename=".$_REQUEST["file"]); > > readfile($_REQUEST["file"]); > > } > > else > > echo "Only Valid People Can Login"; > >?> > > > > > > > > recommended reads: > > http://www.php.net/manual/en/function.header.php > > > > further recommended things to checkout: > > freshmeat , and search for anti leecher scripts. > > > > > > > > /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Testing for Well-Formed XML
"Ian Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > I'm trying to build a validator in PHP, to check that XML documents are > well-formed. As a starting point I'd check out the excellent, open-source PEAR modules available for XML manipulation at http://pear.php.net/packages.php?catpid=22&catname=XML, and in particular the XML parser module at http://pear.php.net/package/XML_Parser. Hope that helps, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I protect downloadable files?
Time for them to upgrade to OSX... I've not tried to crack that nut. Is there anyone here who has successfully managed headers for Mac users? It's hard to believe it hasn't been done. -Original Message- From: Kim Steinhaug [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How do I protect downloadable files? However I forgot to mention, all theese header tricks are real swell indeed, but you should get hold of a friend on a macintosh. The method I use doesnt work on the macintosh, so for the mac users we just serve the files "as is", meaning they accually dont get protected... The other methods aswell should be tested on macintosh systems just to be sure. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Kim Steinhaug" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would go for the 3rd alternative. There are several ways to > "stream" the file with the use of headers. > > This way you can validate the user securely with your logon system, > and you can place the files outside the viewable web content. > Typically oputside your www / public_html folder. > > I use this myself in an application I use, streaming files at 50MB > does not use alot of resources at all, atleast not the way I use. > My use for the script is to serve high resolution images to several > customers, often TIF images up to 50MB and larger. > > Heres the code I use : > > $distribution= "filepathonserver"; > if ($fd = fopen ($distribution, "r")){ > $size=filesize($distribution); > $fname = basename ($distribution); > > header("Pragma: "); > header("Cache-Control: "); > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=\"".$fname."\""); > header("Content-length: $size"); > > while(!feof($fd)) { > $buffer = fread($fd, 2048); > print $buffer; > } > fclose ($fd); > exit; > } > > -- > Kim Steinhaug > --- > There are 10 types of people when it comes to binary numbers: > those who understand them, and those who don't. > --- > > > "Apz" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, 30 Dec 2003, news.php.net wrote: > > > Creating unique symlinks would be easier but my development machine is > > > Windows and my server is FreeBSD and I can't create file links under > > > Windows. Plus, my FreeBSD server is not near me so remote development > is > > > difficult. > > > > 1) windows has symlinks since win2000, however they are named Junctions. > >I would recommend visiting sysinternals.com and getting junctions > >tool (win2k/xp/2k3 -> miscalenous). Hey, it even comes with source! > > > > 2) another way is to make a redirect, so you do: > >getFile.php?file=something.zip > > > >and in your code you do: > > > include "_mylibs.php" > > if (userLoggedIn()) > > header "Location: ".$_REQUEST["file"]; > > else > > echo "Only Valid People Can Login"; > >?> > > > > 3) final way is to pass through the file yourself. Safest way, but > >potentially more resource hungry than the two above > >in your code you do: > > > > > > > include "_mylibs.php" > > if (userLoggedIn()) > > { > > header("Content-type: application/octet-stream"); > > header("Content-Disposition: attachment; ". > >"filename=".$_REQUEST["file"]); > > readfile($_REQUEST["file"]); > > } > > else > > echo "Only Valid People Can Login"; > >?> > > > > > > > > recommended reads: > > http://www.php.net/manual/en/function.header.php > > > > further recommended things to checkout: > > freshmeat , and search for anti leecher scripts. > > > > > > > > /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP forms that are valid XHTML
Hello, I'm *very* new to PHP. I am working through the 'Professional PHP Programming' book by Worx. In their forms they use the name attribute (ie. name="example") instead of XHTML's id attribute (ie. id="example"). If I use 'name' my results display on the next page after the submit button is pressed, but if I change it 'id' the results do not display. How can I fix this? Thanks Tim Burgan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP forms that are valid XHTML
Hi, Wednesday, December 31, 2003, 11:45:37 AM, you wrote: TB> Hello, TB> I'm *very* new to PHP. I am working through the 'Professional PHP TB> Programming' book by Worx. TB> In their forms they use the name attribute (ie. name="example") instead of TB> XHTML's id attribute (ie. id="example"). TB> If I use 'name' my results display on the next page after the submit TB> button is pressed, but if I change it 'id' the results do not display. TB> How can I fix this? TB> Thanks TB> Tim Burgan id is used locally on the client and not passed when you press submit, there is nothing wrong with using both if id is needed like -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP forms that are valid XHTML
Tim Burgan wrote: In their forms they use the name attribute (ie. name="example") instead of XHTML's id attribute (ie. id="example"). How can I fix this? (X)HTML still requires name to be used for forms. It's usually best to use both name and ID for forms. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP forms that are valid XHTML
Thanks for your replies. The name attribute is depreciated in XHTML for use with the input tag and has been replaced with the id attribute. The name element can still be used in the form tag though. What I'm looking for is something similar to ASP's GetElementByID("example"); Thanks Tim Burgan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do I protect downloadable files?
I have not tested with mac but I had problems with certain versions of IE in a similar script where it would basicaly show the binary content within IE rather then initiate a download. What I saw was when I verified the headers returned, the headers were repeated. Therefore I had something like: -- Content-Type: text/html X-Powered-By: php... Content-Type: immage/gif -- What worked for me and might help you is if you used header($header, TRUE) to force a replacement of all Content- headers that might have been set by php (like Content-Type: text/html) I would simply suggest comparing the headers you get when you download the file directly compared to when you get the headers from your PHP script. For this a variety of tools are at your disposition, proxomitron's log window being one of my favorites. Once you have an identical set of headers, well... I can't think of any reason for it to fail on mac (unless the original download would fail as well ;) ). Hope it helps, Andrew > Time for them to upgrade to OSX... > > I've not tried to crack that nut. Is there anyone here who has > successfully > managed headers for Mac users? It's hard to believe it hasn't been done. > ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
Quite true. I typed away from memory my sample headers, the actual script was done about 3 months ago and is on a protected intranet server I don't have access to quite at the moment ;). My apologies for the mistake, Thank you for pointing that out :) Andrew. > In a message dated 12/30/2003 9:33:49 PM Eastern Standard Time, > [EMAIL PROTECTED] writes: > > Content-Type: immage/gif > > it should Content-Type: image/gif > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selecting between using letters
Im on my way to bed so short do it yourself answer, but you should look up the regex part of mySQL. I think you can match the beginning and end of a coloumns entry. And using the power of the regex function you could make a WHERE statement for somethink like [a-e] if it was a-e you were looking for. Remember ofcourse that you wuld need to use the regex syntax. The page on mySQL covering the topic has a lot of examples. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- "Doug Parker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How would I create a select statement in MySQL that would return a range of > records from the LastName field where the value starts with a designated > letter - for example, returning the range where the first letter of LastName > is between A and E... > > Any help would be greatly appreciated. > > > > > http://www.phreshdesign.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: connecting to progress db
Hi, "Php" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > I am not sure how to go about this. =( I think my problems are twofold. > > problem 1. I have to connect to a progress database, for which there is > no built-in php > support. I have been looking at the unified ODBC functions, but progress > isn't > one of the supported dbs there either. I've never heard of this sort of database, but I'd be checking with them for any drivers, and then google. > problem 2. the db is not specifically a web db. It is the clients' > production db that > is located on their facility and it is behind a firewall. I know I will > get a performance > hit with this setup, but I can live with this. No database is a "web db". If the database 'progress' has a server, then you can probably connect to it somehow via the web. If it doesn't have a server (ie Filemaker pro, etc), then you cannot connect via the web. > question 1: do I need a progress driver, or do the ODBC functions take > care of that? Check the ODBC documentation. > question 2: is it possible for the db connection to get thru a firewall, > and then connect > to a db? No, a firewall blocks all incoming connections unless specifically told not to do so. You'll have to arrange to allow connections from your IP/Port through the firewall. > > TIA, > Craig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 XML functions
I wish, I'm interested as well :/ <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I've just gotten PHP5 B3 working using the precompiled binaries under Win XP, > but the dom xml functions of PHP4 don't seem to be immediately available. > Does anyone have suggestions on how to learn to use the new XML functionality? > The source code? > > Greg Steffenson > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Failed error_log directive
I still have not found a solution to this problem. What are some debugging steps I could take? "Aidan Lister" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > I am trying to log all php script errors from a virtualhost to a file. > A callback function is not the solution I am looking for. > > I have tried to the following settings in my httpd.conf (apache) to no > avail. > > php_admin_flag display_errors off > php_admin_flag log_errors on > php_admin_flag error_log /tmp/phplog > > When an erroneous file is viewed, errors are not displayed (as expected), > however the file /tmp/phplog is not created. > > I'd be grateful for any help. > > Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP5 XML functions
Make sure that in your php.ini file that you have uncommented that the php_dom extensions and any other extensions that you want to use. Also make sure that php and your web server have access to the extensions. I usually place my extensions in the system path where they can be accessed. Also, I am not sure if the php installer contains all the extensions. I usually download the zip file and it contains all the extensions. -- Ray On Tue, 2003-12-30 at 21:38, Aidan Lister wrote: > I wish, I'm interested as well :/ > > <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I've just gotten PHP5 B3 working using the precompiled binaries under Win > XP, > > but the dom xml functions of PHP4 don't seem to be immediately available. > > Does anyone have suggestions on how to learn to use the new XML > functionality? > > The source code? > > > > Greg Steffenson > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Securing Free Scripts
If I am putting out a couple free scripts to the public, is there any way I can make sure people dont remove the copyright? Any ideas welcome - Ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Securing Free Scripts
Ian wrote: If I am putting out a couple free scripts to the public, is there any way I can make sure people dont remove the copyright? No. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Securing Free Scripts
> -Message d'origine- > De : Ian [mailto:[EMAIL PROTECTED] > Envoyé : Wednesday, December 31, 2003 12:21 AM > À : [EMAIL PROTECTED] > Objet : [PHP] Securing Free Scripts > > > If I am putting out a couple free scripts to the public, is there any > way I can make sure people dont remove the copyright? You own the copyright even if the copyright notice is not there, so you can enforce it legally. You could also licence it under something like the BSD licence that stipulates that the user must leave the copyright notice. However, you can't force them technically, I think. > > Any ideas welcome > > - Ian > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Securing Free Scripts
> -Original Message- > From: John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 31, 2003 12:39 AM > To: Ian > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Securing Free Scripts > > > Ian wrote: > > > If I am putting out a couple free scripts to the public, is > there any > > way I can make sure people dont remove the copyright? > > No. > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals - www.phparch.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Encrypt the source code. I've been looking heavily into this recently. There were some great posts on here a while back. Search the archives. Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php