[PHP] UPS / USPS shipping algorithm
I have to be able to calculate shipping charges based on the product(s) ordered. I'm able to communicate with UPS and USPS, parse the XML and all of that. The problem I'm running into is trying to calculate a box size. Has anyone here come up with a good solution? It is no problem at all to get shipping rates for one item. Two of the same item is more difficult, but 2 or more different items, all of different sizes, is causing me some problems. To make things worse, there aren't any standard box sizes I can use to try to fit them in. I've looked at different PHP scripts for calculating UPS and USPS shipping rates, but all of them I've seen so far expect the package size to already be calculated. -- Jason Stechschulte [EMAIL PROTECTED] http://www.enormousplow.com Immortality -- a fate worse than death. -- Edgar A. Shoaff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checkbox = POST = array??
On Sat, Aug 10, 2002 at 02:56:48PM -0400, PeterV wrote: What I have now: input type='checkbox' id='45' name='topic[]' value='45' doesn't return an array $topic?? Probaby due to register_globals. It should exist in $_POST['topic'] -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- I am a bookaholic. If you are a decent person, you will not sell me another book. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: May i?
On Tue, Sep 03, 2002 at 08:27:37PM -0400, ::: Flavio Bastos Amiel:: wrote: i tried to delete that cell (id) and then i recreate it. thinking the id was going to count it all over and make the item id TRUE.but it wasn't like that, the new id was counting since the last id then if the last id was 100, the new id was counting from 100 to 200 do i explain myself?... does anyone have an answer to this problem (PLEASE Dont tell me i have to do i manually!! ) You can use a version of mysql prior to 3.23, which is the version that this behavior was introduced. Many people, myself included, believe the ability to use numbers that were used previously is a bug, so in 3.23, once a number is used in an auto incrementing column it cannot be used again. At least mysql won't auto generate it again. -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- To teach is to learn. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Vote to ban Acer
On Sun, Aug 04, 2002 at 05:52:09AM +0100, Andrew Brampton wrote: so just before I set outlook to block his mails would the mods of this be able to remove him and stop him flaming our gods.. Just set a filter to delete his mail. Banning him is not a good idea. The best thing you can do is just ignore trolls like him. -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- Campus sidewalks never exist as the straightest line between two points. -- M. M. Johnston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail problems
On Fri, Aug 02, 2002 at 09:34:20PM -0400, Bob Lockie wrote: I can't get mail to work on my system. It always tries to send mail as the user 'nobody' which my Apache 1.3.26 runs as. phpinfo() reports I have the correct path to the php.ini file which specifies it is supposed to send as the user 'bob'. I have sendmail 8.12.5 and PHP 4.2.2 on the same RedHat Linux machine? I'm not sure how sendmail works, but I think exim has a setting that you have to set so it will allow you to send email as a different user. Maybe there is something like that you need to set for sendmail also. -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- Do you think that illiterate people get the full effect of alphabet soup? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: My SQL speed.
On Sat, Aug 03, 2002 at 01:49:10AM -0300, Manuel Lemos wrote: Google has 1 billion pages and qurys in a few milliseconds... Real search engines do not use SQL databases. What do search engines use? Is there something out there that explains how they work? -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- We demand rigidly defined areas of doubt and uncertainty! -- Vroomfondel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extra spacing with br in HTML
On Sat, Jul 27, 2002 at 08:08:34PM -0400, Kevin Breit wrote: Lets say I have ul liBlar/li /ul ln2br() will crunch that and put out: ulbr / liBlar/libr / /ulbr / That creates a lot of white space when that HTML is rendered. How do I tell PHP not to put line breaks in a situation like that? There might be an easier way, but you might just have to write your own code for this. Something along the lines of: (completely untested) ?php $line = ereg_replace((^li|^ul|^ol)\n, br /\n, $line); ? -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- The brain is a wonderful organ; it starts working the moment you get up in the morning, and does not stop until you get to school. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Drop Down Box Question
On Sun, Jul 21, 2002 at 11:43:25AM -0400, WANDA HANSEN wrote: Is there a way to handle data gathered from a drop down menu that allows multiple selections using PHP? Yes. The way I normally do this is to use HTML that looks something like: select multiple='multiple' name='test[]' option value='1'Red/option option value='2'Green/option option value='3'Blue/option /select Now in your PHP program, you can access them all with something like: ?php foreach($_POST['test'] as $test) { echo You selected $testbr /\n; } ? -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- History books which contain no lies are extremely dull. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting the day if given a date
On Tue, Jul 23, 2002 at 04:24:37PM -0800, Cirkit Braker wrote: Is there any way to get the day of the week given a date. Check out the date() function. -- Jason Stechschulte [EMAIL PROTECTED] http://www.ypisco.com -- Campus sidewalks never exist as the straightest line between two points. -- M. M. Johnston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] putting the result of PHP code into a string
On Fri, Nov 09, 2001 at 10:33:39PM +0100, Morten Gjetanger wrote: I like to evaluate som PHP code, but I want the result to be putted into a string. example: $var = Test1; $code = td?php echo $var1?/td; $html = someFunction($code); After this i want $html to contain tdTest1/td $var = Test1; $code = td$var/td; $html = someFunction($code); Done. -- Jason Stechschulte [EMAIL PROTECTED] -- You can't have filenames longer than 14 chars. You can't even think about them! -- Larry Wall in Configure from the perl distribution -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] comments
On Fri, Nov 02, 2001 at 12:44:16PM +0100, Nikola Karovi? wrote: on my web site i have an option that user can add their comments about my articles. I have table articles, and table comments. On table comments column unique id (auto increment) and articleid. It displays them and sort coments by unique id. When i delete eg. comment number 4, next comment is eg.comment number 23. That new comment has unique id 23, but it is placed instead id comment 4, so i get: 1 comment 2 comment 3 comment 23 comment 4 comment is this wrong? No, the database can store them internally however it wants. If you want your results to be in a certain order you should use the order by clause in SQL. -- Jason Stechschulte [EMAIL PROTECTED] -- Suppose you're working on an optimizer to render \X unnecessary (or rather, redundant, which isn't the same thing in my book). -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] check if file is already in use before fopen
On Thu, Oct 04, 2001 at 11:10:56AM -0400, Matthew Luchak wrote: Is there a way to verify if a file is in use by another user before fopening it? As far as I know this is something you have to program in yourself. If you are only worried about your programs accessing the file, then it is a good idea to create a lock file. Before you access a file called mydata, check for a file called mydata.lock. If that exists, then the file is in use, so wait and check later. If it does not exist, create a file called mydata.lock, open mydata, do with it as you please, close mydata, and delete mydata.lock. You also have to be prepared to handle a situation where your program stops before removing the lock file. Usually with PHP, it is much easier to just use a database so all this file locking is dealt with by the database and not you. -- Jason Stechschulte [EMAIL PROTECTED] -- Sorry. My testing organization is either too small, or too large, depending on how you look at it. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do I tell the mail function that the message content is HTML?
On Tue, Sep 18, 2001 at 05:24:37PM -0400, Salty Marine wrote: How do I tell the mail function that the message content is HTML? RTFM: http://www.php.net/manual/en/function.mail.php /* If you want to send html mail, uncomment the following line */ $headers .= Content-Type: text/html; charset=iso-8859-1\n; // Mime type -- Jason Stechschulte [EMAIL PROTECTED] -- Perl itself is usually pretty good about telling you what you shouldn't do. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] changing post variable names
On Wed, Sep 19, 2001 at 12:57:07PM +0100, L Melville wrote: Hi, I have a php page that accepts post values (ie; ./page.php?var1=0var4=5). Now there can be posted values between var(1) and var(10) and i want to check if they exist and also utilise them. Is there a way of accessing these values in a loop ie;- for($i=1;$i=10;$i++){ // do things in here that access the vars like this $blah = $var$i; } Something like this should work: ?php $var4 = 'Hello'; for($i=1;$i=10;$i++){ // do things in here that access the vars like this $blah = var$i; if(isset($$blah)) { echo $$blah.br\n; } } ? -- Jason Stechschulte [EMAIL PROTECTED] -- Well, that's more-or-less what I was saying, though obviously addition is a little more cosmic than the bitwise operators. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting variables and functions? Like C#
On Wed, Sep 19, 2001 at 03:24:31PM +0200, Emile Bosch wrote: thanks tim, but do you know wheter they are gonna implement such a feature cuz that's somethgin that the language actually must have to become really professional or somethign. The language is already quite professional. Yes a feature like that would be nice in the eyes of many people, but saying it is a must and is needed to make the language professional is quite a joke. -- Jason Stechschulte [EMAIL PROTECTED] -- 'Course, that doesn't work when 'a' contains parentheses. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP complains when using similar_text() as documented.
On Thu, Sep 06, 2001 at 11:04:09PM -0500, Peter Hutnick wrote: http://www.php.net/manual/en/function.similar-text.php states that the third argument should be a reference. PHP 4.0.6 complains Warning: Call-time pass-by-reference has been deprecated - argument passed by value; etc. But that percentage (double) is only available this way . . . Where am I going wrong? This might have something to do with it. From the php.ini: allow_call_time_pass_reference = Off ; whether to enable the ability to force arguments to be ; passed by reference at function-call time. This method ; is deprecated, and is likely to be unsupported in future ; versions of PHP/Zend. The encouraged method of specifying ; which arguments should be passed by reference is in the ; function declaration. You're encouraged to try and ; turn this option Off, and make sure your scripts work ; properly with it, to ensure they will work with future ; versions of the language (you will receive a warning ; each time you use this feature, and the argument will ; be passed by value instead of by reference). -- Jason Stechschulte [EMAIL PROTECTED] -- If you want to see useful Perl examples, we can certainly arrange to have comp.lang.misc flooded with them, but I don't think that would help the advance of civilization. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql timestamp field
On Thu, Sep 06, 2001 at 05:09:43PM +0300, Mesut Tunga wrote: I need an update on my table. but I have a timestamp field called t_stamp. When I update a field other than t_stamp field, t_stamp field also updates to now(). I need it not to update and saves its value. How should I do this? The easiest way is to change the column type. Timestamp always updates itself whenever the row is updated. You could simply change the column type to datetime. -- Jason Stechschulte [EMAIL PROTECTED] -- The reason I like hitching a ride on strict vars is that it cuts down the number of rarely used pragmas people have to remember, yet provides a way to get to the point where we might, just maybe, someday, make local lexicals the default for everyone, without having useless pragmas wandering around various programs, or using up another bit in $^H. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] include error with no includes
On Wed, Sep 05, 2001 at 09:02:03AM -0400, Chad Cunningham wrote: I've got a few php pages that a while back started giving the following include error: Warning: Failed opening '/home/ccunning/WWW/probability.php3' for inclusion (include_path='.:/web/php/include:/web/php/phplib') in Unknown on line 0 I could be way off, but it sounds like a permissions problem. The user that your webserver runs as probably no longer has access to the page. -- Jason Stechschulte [EMAIL PROTECTED] -- Portability should be the default. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] ereg_replace
On Wed, Jul 25, 2001 at 11:38:41AM -0400, Clayton Dukes wrote: Can someone tell me why this doesn't work? Not really. You should tell us why it isn't working, and we can help you to get it working. What is happening? What is all of the relevant code? $home_street = ereg_replace ( , + , $home_street); The input is 123 happy trail I need the output to be 123+happy+trail -- Jason Stechschulte [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] looking for a class that handles cookies and sessions
On Tue, Jun 26, 2001 at 12:44:15PM -0400, [EMAIL PROTECTED] wrote: I need a class that can quickly help me set cookies and sessions, and check up against them anyone have an idea where i can get one like this? Yes, the University I work at has a class that will teach you this. The University is at http://www.unoh.edu and the class you want is: DP237 - Programming Server-Side Scripts I -- Jason Stechschulte [EMAIL PROTECTED] -- And we can always supply them with a program that makes identical files into links to a single file. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] back from a search form
On Tue, Jun 26, 2001 at 05:17:51PM +0200, Marcos wrote: hi to @ll, after a make a search throw a form it returns me some results (links). if i click to a link and i try to get back to the previous results Internet Explorer shows me a blank page advicing that i should refresh the page in order to get the results. how can i prevent this blank page. Don't use form method=post -- Jason Stechschulte [EMAIL PROTECTED] -- For the run-time caching, I was going to suggest cached (doh!), but perhaps once is more meaningful to ordinary people. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] sending e-mail with variables
On Tue, Jun 26, 2001 at 12:13:28PM -0700, Richard Kurth wrote: I have a function that is for sending an e-mail to the customer This is probably where your problem is. $hostname, $domain, $tld, and $fullname have to be defined in the function. Try echoing them inside of the function. You should either pass them to the function: function($hostname, $domain, $tld, $fullname); or declare them as global inside of the function. function() { global $hostname, $domain, $tld, $fullname); -- Jason Stechschulte [EMAIL PROTECTED] -- Oh yeah. Forgot about those. Getting senile, I guess... -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Filtering out \ when a ' is user entered?
On Tue, Jun 26, 2001 at 09:18:49PM -0700, Marcus James Christian wrote: \' How can I filter out these backslashes so they don't appear on the final public viewable page? Perhaps stripslashes() would be helpful? http://www.php.net/manual/en/function.stripslashes.php -- Jason Stechschulte [EMAIL PROTECTED] -- : How would you disambiguate these situations? By shooting the person who did the latter. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP authenticating and session management
On Fri, Jun 22, 2001 at 08:59:54AM +0430, Arash Dejkam wrote: simply check $username and bring up the user's page ? but this makes it possible for any hacker to send a cookie with username and see that page. I know that PHP stores a unique random number for each session but how can I check that it matches with the number in the cookie. Why not just check for username this way: ?php if(session_is_registered(username)) { // Do stuff } ? Then username has to be registered as a session variable so any hacker (sic) can't just send a username to see that page. -- Jason Stechschulte [EMAIL PROTECTED] -- echo Your stdio isn't very std. -- Larry Wall in Configure from the perl distribution -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Saving to a file
On Wed, Jun 20, 2001 at 11:04:21AM +0300, Rosen wrote: Sorry for the stupid question, but i don't have at me a PHP manual and I want to save some string to file from PHP. Can someone tell me how ( with what function to do this ) ? fopen http://www.php.net/manual/en/function.fopen.php fputs http://www.php.net/manual/en/function.fputs.php fclose http://www.php.net/manual/en/function.fclose.php -- Jason Stechschulte [EMAIL PROTECTED] -- All language designers are arrogant. Goes with the territory... :-) -- Larry Wall in [EMAIL PROTECTED]
Re: [PHP] \nhelp
On Wed, May 16, 2001 at 05:13:16PM -0400, jtjohnston wrote: I am parsing the contents of a text file. Congratualtions. I have certain lines that start with 4; I would like to attach these lines to the previous line as follows. But I don't know how. I figure I have to search and replace for \n4; but ... ? You could try something like this: ?php $file = file(file); for($i = 0, $k = 0; $i sizeof($file); $i++) { if(substr($file[$i], 0, 4) == 4;) { $newfile[$k - 1] .= $file[$i]; } else { $newfile[$k++] = $file[$i]; } } ? -- Jason Stechschulte [EMAIL PROTECTED] -- Perl programming is an *empirical* science! -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] url_rewriter.tags PHPSESSID automaticly added to URLS
On Thu, May 17, 2001 at 04:49:43PM -0700, Chris Cowan wrote: Does anyone know why the $PHPSESSID would be automaticly added to the url on PWS on Win2000 but not on IIS 4 on WinNT 4.0? Is this a feature dependent on the web server of is there something wrong on my server? Most likely they are configured differently. In Linux, you can configure with: --enable-trans-sid There is probably an equivalent way to do it in the .ini file. -- Jason Stechschulte [EMAIL PROTECTED] -- 'Course, I haven't weighed in yet. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Only have one session per user?
On Fri, May 11, 2001 at 10:22:15PM +0200, Christian Marschalek wrote: Can I only have one session per user / internet explorer? Or is it possible to seperate sessions let's say from script to script? Are you asking if you can have more than one session for one user running multiple instances of the same web browser? IIRC, this will only work if you are not using cookies for your sessions. -- Jason Stechschulte [EMAIL PROTECTED] -- I surely do hope that's a syntax error. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Writing to files
On Mon, May 14, 2001 at 03:05:30PM +0100, Tarrant Costelloe wrote: What's the most basic syntax for writing to a text file using PHP. I would like to store some variables in one and then retrieve them a later stage...? This will append This is pretty basic to the end of the file instead of overwriting the file. ?php $basic = fopen(basic.txt, a+); fputs($basic, This is pretty basic\n); fclose($basic); ? It is really easy to read in the entire file into an array. Probably not very efficient, but will get you started quickly. ?php $prettyBasic = file(basic.txt); for($i = 0; $i sizeof($prettyBasic); $i++) { echo $prettyBasic[$i]br; } ? Search the online manual for more information on these functions. Taz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Jason Stechschulte [EMAIL PROTECTED] -- If I don't document something, it's usually either for a good reason, or a bad reason. In this case it's a good reason. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Does the array parameter of ereg actually return strings matched?
On Wed, May 09, 2001 at 06:13:17PM -0700, Dexter wrote: Does the array parameter of ereg actually return strings matched? I tried to read a file looking for a string using ereg and wanted to put the matched strings found in an array. Doesn't seem to be happening with the following. $contents=fread($readfile,10); $pattern=a href.*\; $i=0; while(!feof($readfile)) { $contents=fgets($readfile,4065); if(eregi($pattern,$contents,$regs)) { echo $regs[$i]br; } $i++; } Yes, it actually does return strings matched. I would not expect your code, as you typed it, to do what you expect. I realigned things to make it easier to see what is happening. With what you have, it is very unlikely that you will ever print out a match. You are incrementing your counter for every line of the file, not for every match actually found. Try this code instead: ?php $contents=fread($readfile,10); $pattern=a href.*\; while(!feof($readfile)) { $contents=fgets($readfile,4065); if(eregi($pattern,$contents,$regs)) { for($i = 0; $i sizeof($regs); $i++) { echo $regs[$i]br; } } } ? -- Jason Stechschulte [EMAIL PROTECTED] -- I hope I'm not getting so famous that I can't think out load [sic] anymore. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] array limits????
On Thu, May 10, 2001 at 10:27:55AM -0400, shaun wrote: is there a limit to the number of fields one can put in an array?? heres the code im using to create the array $arrResIDs = explode(,,$RESID,300); now $RESID has at least 100 different values in it but when i print out the array i only get 80 can anyone shed some light on this subject??? Seeing code sure would help. 100 values in a PHP array is nothing. -- Jason Stechschulte [EMAIL PROTECTED] -- Tcl tends to get ported to weird places like routers. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] split string
On Fri, May 11, 2001 at 10:24:02AM -0500, Jacky wrote: I got series of string value like this 1,2,3. And the seires are dynamic dynamaic, which means it is not always 1,2,3 but could be more, but always in this format that is separated by , . How do I pick each of value in the series and assign it into new vairiable, like from: $test = 1,2,3; and assign to be $test =1; $test1=2; $test2 =3; Is theer any function that could help me with that? because I need to update table using those value but I cannot use series of value to update, have to break them down to each variable like that. Use arrays. $test = 1,2,3; $test = explode(,, $test); // $test[0] == 1; // $test[1] == 2; // $test[2] == 3; -- Jason Stechschulte [EMAIL PROTECTED] -- Well, that's more-or-less what I was saying, though obviously addition is a little more cosmic than the bitwise operators. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Upload time vs. script execution time
On Fri, May 11, 2001 at 05:07:57PM -, SED wrote: Before I try it, can anyone tell if the execution-time of the script start when upload finish or when it starts? (I referring to the script that receives the uploaded file and handles it). It its the later one, what can I do when I want to upload files that take longer time to upload (but without editing the php.ini). I'm fairly certain that the execution time of the script does not start counting until the file is uploaded. -- Jason Stechschulte [EMAIL PROTECTED] -- No prisoner's dilemma here. Over the long term, symbiosis is more useful than parasitism. More fun, too. Ask any mitochondria. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable question, yet another
On Tue, May 08, 2001 at 01:20:49PM -0500, King, Justin wrote: So when the line hits type 1, it evals like this echo [a href=myscript.php?username={$userdata[username]}]Goto MyScript.php[/a]; Of course this yields an error because of the 's in the anchor tag. But if I add slashes the evaluated code will be echo [a href=\myscript.php?username={$userdata[\username\]}\]Goto MyScript.php[/a]; Why not just break out of the string to print the username? echo [a href=\myscript.php?username=.$userdata[username].\]Goto Myscript.php[/a]; -- Jason Stechschulte [EMAIL PROTECTED] -- The whole history of computers is rampant with cheerleading at best and bigotry at worst. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Extracting Array value as variable
On Fri, May 04, 2001 at 08:08:11PM -0400, John McConnell wrote: I have an array $veg that is set so $veg[0]=broccoi $veg[1]=tomatotes. I have also assigned values to the variables $broccoli=1 and $tomatoes=2. I want to print the values for those variables ($broccoli and $tomatoes) by only using the $veg array. So, if it worked it would be $$veg[0] would be 1, and $$veg[1] would be 2. Is there anyway to do this? It always amazes me that people are so afraid of simply trying. Yes, there is a way to do this. Simple test code that does work: ?php $broccoli=1; $tomatoes=2; $veg[0] = broccoli; $veg[1] = tomatoes; echo $$veg[0]. .$$veg[1]; // This will print 1 2 ? -- Jason Stechschulte [EMAIL PROTECTED] -- Anyway, my money is still on use strict vars . . . -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing variables + if case
On Fri, May 04, 2001 at 05:08:30PM -0700, Andras Kende wrote: Is this is a correct format ??? If you would tell us what you are trying to accomplish and why you think it doesn't work, we might actually be able to help you. -- Jason Stechschulte [EMAIL PROTECTED] -- Of course, I reserve the right to make wholly stupid changes to Perl if I think they improve the language. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] changing a file on the server using a web form
On Thu, May 03, 2001 at 04:02:32PM -0400, Sherman wrote: I have installed mod_php on my Apache web server and there is something I was curious about. I would like there to be a web page with a form that a user can enter some info into.. and it change a file in say /etc/file.txt when they submit the form .. any tips or advice on how I would get started doing this? Thanks in advance. First of all, I would learn HTML. Then create an HTML form. Next I would learn how to program. Since you have installed mod_php, I would probably learn how to program in php. Once this is accomplished, you will realize just how easy your task really is. If you are looking for a tutorial, check out some links from here: http://www.php.net/links.php -- Jason Stechschulte [EMAIL PROTECTED] -- If this were Ada, I suppose we'd just constant fold 1/0 into die Illegal division by zero -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] slashes \ appearing
On Fri, May 04, 2001 at 12:41:57PM +0200, magnus lawrie wrote: I am using a form to test posting a variable. If my variable looks like this in script post_var.php3 : stringinaaform then it comes out like this in recieve.php3 : \stringinaaform\ why? thanks in advance. Because PHP is configured with: --enable-magic-quotes -- Jason Stechschulte [EMAIL PROTECTED] -- But maybe we don't really need that... -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Array help please
On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote: I'm trying to debug some software that I downloaded from the web. It seems to work fine most of the time however it occasionally crashed with database errors. When I look at the code it has a lot of array references that i don't understand e.g. $Session[clientID] most references at are of the form $arrayname[item] or $arrayname[$item] as I would expect. is the example correct code? if so what does it mean? It either does the same thing as $Sessin[clientID] The quotes are optional but recommended, because clientID could be defined as a constant and that could give unexpected results. -- Jason Stechschulte [EMAIL PROTECTED] -- : How would you disambiguate these situations? By shooting the person who did the latter. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how?
On Thu, May 03, 2001 at 10:12:55AM -0700, elias wrote: hello. i read from a text file a line like: Key=$value so, i do like: $lines = join('', file(myfile.txt)); echo $lines; // output= Key=$value Now how can i replace the values in the $lines variables? i want like: $value = test; echo $lines; and i want ouput like: Key=test any idea? May not be the best way, but it works: ?php $lines = join('', file(myfile.txt)); $value = test; $lines = str_replace(\$value, $value, $lines); echo $lines; ? -- Jason Stechschulte [EMAIL PROTECTED] -- Well, enough clowning around. Perl is, in intent, a cleaned up and summarized version of that wonderful semi-natural language known as Unix. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how?
On Thu, May 03, 2001 at 03:56:55PM -0700, elias wrote: No, ... Actually,... I want it so generic, like myfile.txt can have like: - Welcome $username Enjoy your staying at: $site_name Mail admin. at $admin_mail for any questions... - so bascially, i don't want to do str_replace or else i could have used the sprintf() and with '%s' instead of str_replace... i even tried the eval() which should work, but it didn't, scroll down to message with Subject: $hello I don't think you understand eval(). Either that or I don't. If I understand correctly, eval(); requires a complete PHP statement. Welcome $username is not a complete PHP statement. Why don't you just make myfile.txt a valid php file and then include it? myfile.txt.php: Welcome ?php echo $username;? Enjoy your staying at: ?php echo $site_name;? Mail admin. at ?php echo $admin_mail? for any questions... index.php: ?php $username=eddie; $site_name=stripmall; $admin_mail=[EMAIL PROTECTED]; include(myfile.txt.php); ? I'm not sure if this is what you want, but it will send this to the browser: Welcome eddie Enjoy your staying at stripmall Mail admin. at [EMAIL PROTECTED] -- Jason Stechschulte [EMAIL PROTECTED] -- Think of prototypes as a funny markup language--the interpretation is left up to the rendering engine. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problems after reversing a guestbook
On Sun, Apr 29, 2001 at 01:03:15AM +0200, Mogens Nielsen wrote: Now the problem: If I post a message with a line of text, a newline (as in hitting the return-key), some more text and newlines, these newline-separated text-lines show before the posting itself after reversing because they are independent elements in the array. How can I fix this The short answer is use a database. The long answer is to write your function to reverse the array. You could have the original array passed to the function and your function return a reversed one. In your function, you would have to do some checking. If the index is a new entry into your guestbook, then create a new index in the new array. If not, just prepend the text to the last index of the array. I'm imaging that your text file is delimited by something. You may want to explode each line so you can tell if it belongs together or not. -- Jason Stechschulte [EMAIL PROTECTED] -- double value;/* or your money back! */ short changed; /* so triple your money back! */ -- Larry Wall in cons.c from the perl source code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Content_Type is included in uploaded file!
On Sat, Apr 28, 2001 at 05:58:45PM -0500, Siamak Amirghodsi wrote: When I upload a file with php 4 and apache using the call move_upload_file(-,-); the file gets uploaded, but the file ( which is just a text file ) at the server side contains some extra lines at the top : Content-Type: text/plain blankline blankline Does anybody know how to suppress this? This also happens with images! Sorry if this is wrong info Rasmus, but I was told this is a bug in some version(s) of apache. Someone I know ran into this probelem and said he found it was a bug, so he upgraded apache, reinstalled php and everything works fine. -- Jason Stechschulte [EMAIL PROTECTED] -- Almost nothing in Perl serves a single purpose. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] replace functions add \
On Mon, Apr 30, 2001 at 10:16:13AM -0700, Kasten, Holger wrote: I have a strange problem. I tried ereg_rplace and str_replace: $to_test = 'This is a test'; $to_test = str_replace (test,little test,$to_test); echo $to_test; the result is: This is a \little test Why does this happen? I have no idea. I copied your code and it works as expected. This is a little test is printed out. -- Jason Stechschulte [EMAIL PROTECTED] -- : - cut in regexps I don't think we reached consensus on that. We're still backtracking... -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variables within variables
On Sat, Apr 28, 2001 at 07:12:15PM +0100, Robert Morrissey wrote: I have a form on one page with a text box called 'emailtext'. This gets passed to a php script that gets info from a database (such as $name, $email, etc) and mails selected email addresses; my problem is this: Say, the form passes $emailtext as Hello $name, how're you?, and this is passed to mail() in the php form, rather than emailing Hello Bob, how're you? it prints $name literally. Seeing as $name isn't pulled from the database till the php script is it possible to get it to print the value? or do I have to pull $name from the database in the original form? (which'll is going to be a lot more complicated). Does this make sense? No, not really. What is the value of $name when the form passes $emailtext? That is the value that will be in $name. If it is actually printing $name and not an empty string, then the '$' must be getting escaped somewhere along the line, or you are using ' instead of around the variable. http://www.php.net/manual/en/function.echo.php -- Jason Stechschulte [EMAIL PROTECTED] -- I'll say it again for the logic impaired. -- Larry Wall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] suggestions for binary data in database
On Fri, Apr 27, 2001 at 03:24:36PM +0200, Ray Hilton wrote: However, on the site, i am currently storing images in the database, purely because i can. But i wonder, how much will the server load be affected when pulling binary data out of the database? compared to the file system? i assume its going to be quite a lot higher. DO you reckon it would be better to scrap that and store the images on the file system? Yes, I certainly reckon that. Using the database can make organizing them easier, but I usually find it pretty easy to store images on the file system and only put the directory structure, filename in the database. It is much easier on the database too. -- Jason Stechschulte [EMAIL PROTECTED] -- Unix is like a toll road on which you have to stop every 50 feet to pay another nickel. But hey! You only feel 5 cents poorer each time. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySQL Results NULL Error
On Thu, Apr 12, 2001 at 10:20:28PM -0400, Chris Anderson wrote: If I grab values from fields and they contain nothing, and I retrieve them using mysql_field_array, it will give an index out of range. Is there a way to prevent the error or do I have to keep putting a @ in front of the variable declaration? Why not just check how many rows are returned? mysql_num_rows() -- Jason Stechschulte [EMAIL PROTECTED] -- I wouldn't ever write the full sentence myself, but then, I never use goto either. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] online detection
On Wed, Apr 11, 2001 at 08:00:56AM -0400, [EMAIL PROTECTED] wrote: H I wonder which one ICQ uses :-) ICQ doesn't detect whether or not a person is online. It doesn't detect whether or not a person is browsing the Internet. All it detects is whether or not a person is connected to the Internet AND using their application. Checking if someone is online is much, much more difficult. -- Jason Stechschulte [EMAIL PROTECTED] -- : - cut in regexps I don't think we reached consensus on that. We're still backtracking... -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Row colors
On Mon, Apr 09, 2001 at 12:08:10AM +, Mike P wrote: I can change the column sof a table with the following code but how do I change the row colors instead.With the columns I have "i" to manipulate but not with rows. while ($row = mysql_fetch_row($result)) {{ echo "TR\n"; for ($i =1;$imysql_num_fields($result);$i++) This works for me. echo "td ".($i 1 ? "bgcolor=c0c0c0" : "bgcolor=cc").""; -- Jason Stechschulte [EMAIL PROTECTED] -- Any false value is gonna be fairly boring in Perl, mathematicians notwithstanding. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Ming and flash detection
Hi, I'm having a problem writing a flash detector, and was hoping someone would help. I had one working that I created with Flash 4, but it would fetch another webpage after loading so that it knew where to redirect to. So it looked like: PHP embeds FLASH --- load variables from PHP redirects to correct page. If FLASH wouldn't load, then javascript or a http refresh header would send them elsewhere. I'm trying to use Ming to eliminate the load variables from PHP portion. That way once the FLASH file loads, it will redirect, and you won't have to wait for the program to go to the server and load more variables. Here is the code I'm using: brokencode ?php // $load is a variable that is passed in the embed tag ex: // embed src=detectflash.php?load=?=$PHP_SELF? $thisURL = "$load?hasflash=yes"; Ming_setScale(1.0); // Create a very small movie with a white background. $m = new SWFMovie(); $m-setBackground(0xff, 0xff, 0xff); $m-setDimension(18, 18); // This movie simply redirects to the appropriate page. $m-add(new SWFAction("getURL('$thisURL', ''); stop();")); $m-nextFrame(); $m-add(new SWFAction("play();")); header('Content-type: application/x-shockwave-flash'); $m-output(); ? /brokencode So far I've tested this in 3 browsers all on Windows 2000. IE5 - works just fine. Opera 5 - works just fine. Netscape 4.08 - Never redirects. I added code to write $thisURL to a file so I could see if it is getting passed correctly, and it is. So there must be a problem with the movie somewhere. In the getURL() function, I have tried many different things for the second argument. _self, _parent, _top. None of these makes any difference. Anyone have any ideas I could try?? -- Jason Stechschulte University of Northwestern Ohio [EMAIL PROTECTED] (419)998-3108 -- When it's dark enough you can see the stars. -- Ralph Waldo Emerson, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] rewrite one line in file
On Thu, Mar 29, 2001 at 03:05:09PM +0100, Peter Van Dijck wrote: How do I rewrite 1 line in a file? I got the filename and the linenumber. i was playing around with fwrite but to find the line I had to do all sorts of gymnastics, I'm sure there must be a more elegant way... thanks for any hints! You have to do gymnastics to get a PHP script to work!! I would love to see this. Also, I didn't realize there was anything more elegant that gymnastics, well perhaps ballet I guess. Unless you search the web for a tool that someone else has written to make things easier, you do have to do a few things to rewrite a line in a file. That is one of the reasons people use databases. You could try looking for programs that others have written to make file manipulation easier, or you could post the portions of your code so we can see what you are trying to do, and how you are doing it currently. -- Jason Stechschulte [EMAIL PROTECTED] -- It's appositival, if it's there. And it doesn't have to be there. And it's really obvious that it's there when it's there. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] escape sequences not recognized inside an .html
On Sat, Mar 24, 2001 at 09:06:36PM -0500, Mauricio Junqueira wrote: Hi, I believe I am missing some configuration regarding my apache becouse I can only get php to work inside a file .php. If my page extension is .html, nothing happend with the php script; but just changing from .html to .php everthing works fine. Anyone? Anyhelp? If you ar using a *nix system, you probably need to add: AddType application/x-httpd-php .html to you httpd.conf -- Jason Stechschulte [EMAIL PROTECTED] -- /* we have tried to make this normal case as abnormal as possible */ -- Larry Wall in cmd.c from the perl source code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problems passing data via GET and POST
On Sat, Mar 24, 2001 at 05:05:59PM -0500, Matt Adams wrote: I recently wrote a (yet another) mailing portal which takes a certain action based on the contents of a hidden form field (i.e. if state==deliver then deliver mail to the recipient). Although I am certain the code could be better etc. etc. it works fine. I tested it on a Linux box running Apache-1.3.17 and PHP-4.0.4pl1 (as a module). However, when I transferred the project to another Linux server running Apache-1.3.12 and PHP-4.0.0 (also running as a module), the mailing portal refused to function properly. I discovered that the code that controls what action is taken was not picking up on the form contents passed to it. For a brief example, I have a file named "compose.php" which contains a form that passes a hidden field called "state" with the value "compose" to a file called "control.php" using the POST method. "control.php" is supposed to pick up on the "state" and sends the content of the "compose.php" form to the deliver stage. Unfortunately, it appears that "control.php" is not seeing any of the form data from "compose.php". My question is this: is there a setting in PHP (set either at compile or in the php.ini) that controls whether or not a PHP script will accept data passed to it via POST or GET? I'm not sure but I think register_globals or something like that could be the problem. I'm pretty sure that with this set, you don't have to use the $HTTP_GET_VARS or $HTT_POST_VARS arrays. Without it set, you are forced to use these arrays. register_globals = on: $HTTP_GET_VARS['testme']; // will have form info $testme // will have form info register_globals = off: $HTTP_GET_VARS['testme'] // will have form info $testme // will be empty I could be completely wrong, but I think this is how that works. -- Jason Stechschulte [EMAIL PROTECTED] -- The prayer of serenity applies here. To both of us. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] header redirection
On Tue, Mar 20, 2001 at 10:05:06PM -0800, [EMAIL PROTECTED] wrote: Why wouldn't this redirect? The query works, but the page won't redirect. I have used the same two lines successfully on other pages. I'm very tired, it's probably obvious. ?php // assuming $uid, $itemid, $week, $cur_wk in querystring //connect to db $db = mysql_connect ("localhost","user","password"); mysql_select_db("mydb",$db); //update item - weekX to Taken and record buyer $sql = "update items set week" . $week . " = 'T', buyerID = " . $uid . " where itemID = " . $itemid; $result = mysql_query($sql); $redirurl = "bid.php?uid=" . $uid . "itemid=" . $itemid; header ($redirurl); ? It appears your code is missing the "Location: " part of the header. -- Jason Stechschulte [EMAIL PROTECTED] -- It's getting harder and harder to think out loud. One of these days someone's gonna go off and kill Thomas a'Becket for me... -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Running script on remote server
On Sat, Mar 17, 2001 at 05:27:55PM +1300, Patrick Dunford wrote: The example in the Help shows opening a file at http://www.php.net/ with fopen(). Are they accessing the source code of the script, or the HTML code that is output by the PHP server when it runs the PHP script that it loads from that location? They are only accessing the HTML code that the PHP program outputs. kA What I want to be able to do is, to get around the problem that the server that I am running my site on does not have database, I want to run the database on another server elsewhere on the Web. I want to be able to, by fopen() -ing the page via its URL, to be passing some variables to the script, have the remote PHP server run the script and pass back to me the output as a file, which I can then load into my web page and display. I have done something similar once when dealing with an IMAP server. The website did not have IMAP support compiled in, but the IMAP server did have PHP installed with IMAP support. Rather than adding support to the webserver, I was forced to do some scripting on the remote IMAP server. I just did includes and sent the variables the remote script needed. ?php include("http://www.remoteimapserver.com/remote.php?neededvariable=neededvalue"); ? Anything the remote.php file outputs will be output into the HTML of the calling program. Anyone accessing the website has no idea that the page they are viewing is coming from 2 different servers. -- Jason Stechschulte [EMAIL PROTECTED] -- signal(i, SIG_DFL); /* crunch, crunch, crunch */ -- Larry Wall in doarg.c from the perl source code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Invalid or Valid because the same.
On Sat, Mar 17, 2001 at 02:35:25PM +0800, [EMAIL PROTECTED] wrote: I have attached a php file together with this email. I believe your attachment was stripped somewhere along the line. We will definitely have to see code to help you figure out what is going wrong. Could you at least include a snippet in your message? -- Jason Stechschulte [EMAIL PROTECTED] -- What about WRITING it first and rationalizing it afterwords? :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Repost URGENT: Can't see picture!!!!!!!!
On Sat, Mar 17, 2001 at 01:16:16AM -0700, Mike Yuen wrote: Hi, this is a repost and nothing i've tried is working. Basically, I allow people to upload pictures and they all go to the proper directories but I can't see the picture. I can see the pictures great on my windows server but no one else can see it. Obviously the path to the images is screwed but I can't figure it out. The $picdir i've tried are: $picdir = "./userpics"; $picdir = "c:/phpweb/userpics/" $picdir = "/userpics"; $picdir = "../userpics"; All of the above don't work. I'll post my code below: The directory is probably not viewable from the web. Try putting the folder somewhere in the web tree. -- Jason Stechschulte [EMAIL PROTECTED] -- No, that'd be silly. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Editing Variables from another script.
On Sun, Mar 18, 2001 at 01:06:34PM +0800, [EMAIL PROTECTED] wrote: I'm trying to create a form whereby I can edit the variables with just the form. It will be something like a form for me to change the database details(username,server,password) in a .inc I'm using. Is there anyway for me to pass information into another file's variable and have it saved in there? If anyone have seen Newspro (CGI) before, when you edit some parts in a form, the information will be saved. How can it be done in PHP? There is probably a hundred or more ways this can be done. For me to be able to give you specifics, you will have to be more specific with what you are doing and what you have tried. -- Jason Stechschulte [EMAIL PROTECTED] -- Well, I think Perl should run faster than C. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] pulldown population not getting the last value
On Sun, Mar 18, 2001 at 05:38:36PM -0800, Tom Beidler wrote: I'm trying to create a pulldown menu with distinct names from the found set. For some reason I never get the last name. Here's my code; $contact_query = "SELECT DISTINCT name FROM request" . " WHERE id = '5' OR demo_id = '$demo_id'" . " ORDER BY name"; $contact_result = mysql_query ($contact_query) or die ("Cannot build contact"); while ($contact_row = mysql_fetch_array ($contact_result)) { $name = $contact_row["name"]; $option_contact .= "OPTION value=\"$name\"$name/OPTION\n"; } What gives? I have not seen anything wrong with this portion of code. Have you tried echoing $contact_row["name"] inside the loop to make sure this is the portion of your code that is broken? -- Jason Stechschulte [EMAIL PROTECTED] -- All language designers are arrogant. Goes with the territory... :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to pass SQL TEXT field via a link
1) The mySQL text data ($description) won't populate my form. I'm using textarea input, and it just won't accept and display the value of $description. It's empty, and when the form is re-submitted after editing, it empties the $description variable. How are you printing the value? With textarea you need to do: textarea?php echo $description;?/textarea instead of: textarea value="?php echo $description;?/textarea 2) I also have image uploads in my form, and the type=file inputs will not accept values, either. Same problem as above .. the empty input areas cause the image names to be deleted from my database when the form is edited and re-submitted. You can't assign a value to a type=file field. If you could, you would be able to upload whatever file you wanted from a user. If you have to pass the value, try a hidden field and then have it reassign if no file was uploaded. -- Jason Stechschulte [EMAIL PROTECTED] -- Let's say the docs present a simplified view of reality...:-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] upload file problems
On Mon, Mar 12, 2001 at 10:08:57AM -0800, Jerry Lake wrote: copy($userfile, "/www/workbox/htdocs/audio"); I keep getting the following error. the directory exists and is chmoded to 777, what am I doing wrong ? Warning: Unable to create '/www/workbox/htdocs/audio': Is a directory in /www/workbox/htdocs/upload.php on line 4 I'm no expert, but I would try adding a trailing slash. copy($userfile, "/www/workbox/htdocs/audio/"); -- Jason Stechschulte [EMAIL PROTECTED] -- if (instr(buf,sys_errlist[errno])) /* you don't see this */ -- Larry Wall in eval.c from the perl source code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable variables
On Tue, Mar 13, 2001 at 06:36:10AM -0700, John Meyer wrote: Okay, I read about this feature in the php manual. What I can't figure out is why in the world would anybody want to use this feature? Not to start a flame war, just would like an explanation of why this feature is useful. I've really only used them once, but they were handy for that situation. I had a column in a mysql table that was a set column of user privileges, and I wanted to register every value in the set as a session variable. horridcode for($i = 0; $i sizeof($privs); $i++) { $$privs[$i] = 1; session_register($privs[$i]); } /horridcode -- Jason Stechschulte [EMAIL PROTECTED] -- I surely do hope that's a syntax error. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] displaying information
On Thu, Mar 08, 2001 at 09:32:25PM -, george wrote: I am building a site which pulls FAQ's out of the database onto a page,but having just finished reading the FAQ's I realise that they will have to be spread over a few pages, how to I get the new page to take over where the old page finished. I would try programming, that usually works for me. You will have to let the program know where you left off, you could pass it in the url, set a cookie, or put it to the session. Either way, just do a little programming and voila. -- Jason Stechschulte [EMAIL PROTECTED] -- Well, you can implement a Perl peek() with unpack('P',...). Once you have that, there's only security through obscurity. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help on select
On Tue, Feb 27, 2001 at 03:12:17PM +0700, Yamin Prabudy wrote: Hi there I had a problem here I got a database in mysql that contains the date format like this "Mar 12 2001" now i try to sort the database and find out how many data in my MySQL that had a date "Mar 12 2001" how can i change that kind of format so i can compare the data in unix time stamp format Try this: ?php $date = mktime(0, 0, 0, 3, 12, 2001); $sql = "select * from table_name where unix_timestamp(date_column) " . " $date"; ? -- Jason Stechschulte [EMAIL PROTECTED] -- Interestingly enough, since subroutine declarations can come anywhere, you wouldn't have to put BEGIN {} at the beginning, nor END {} at the end. Interesting, no? I wonder if Henry would like it. :-) --lwall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Undefinded Index on Mysql Result under Win98/PWS
On Fri, Feb 23, 2001 at 11:47:12AM -0700, [EMAIL PROTECTED] wrote: That might be good for a temporary solution, but not having quotes there ia a potential bug waiting to happen. That is why it there is a warning about it. I agree. Since he didn't use the quotes on the live system though, I took it to mean that he wasn't using many if any constants. So it should not be a problem to change the error reporting level. -- Jason Stechschulte [EMAIL PROTECTED] -- There's some entertainment value in watching people juggle nitroglycerin. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variable sent using pots is cat!
On Thu, Feb 22, 2001 at 06:36:06PM -, kaab kaoutar wrote: i have a problem! i send a variable from one page to another page using post method! but when a variable is like composed of two words , the other page receives only the first word ! can u please help?! Look at the form that you are posting from. Then put quotes around the form variables. -- Jason Stechschulte [EMAIL PROTECTED] -- If you remove stricture from a large Perl program currently, you're just installing delayed bugs, whereas with this feature, you're installing an instant bug that's easily fixed. Whoopee. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] array headaches
while($db-next_record()) { $menu[]["name"] = $db-f("name"); $menu[]["url"] = $db-f("topic_id"); } Why not use a for loop instead? for($i = 0; $db-next_record(); $i++) { $menu[$i]["name"] = $db-f("name"); $menu[$i]["url"] = $db-f("topic_id"); } Then you can access them through another loop. -- Jason Stechschulte [EMAIL PROTECTED] -- Reserve your abuse for your true friends. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Tough one?
On Wed, Feb 21, 2001 at 01:34:10PM -0500, Mike wrote: $keys = array_keys($HTTP_POST_VARS); for($x = 2; $x count($keys); $x++) { $updateString=$updateString.$keys[$x]."='".$HTTP_POST_VARS[$keys[$x]]."',"; } $updateString = ereg_replace(",$", "", $updateString); That should take care of the trailing comma. -- Jason Stechschulte [EMAIL PROTECTED] -- One of the reasons Perl is faster than certain other unnamed interpreted languages is that it binds variable names to a particular package (or scope) at compile time rather than at run time. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP authentication
On Wed, Feb 14, 2001 at 11:07:46PM -0800, Thomas Edison Jr. wrote: The code I'm entering is: ?php if(!isset($PHP_AUTH_USER)) { Header("WWW-Authenticate: Basic realm=\"My Realm\""); Header("HTTP/1.0 401 Unauthorized"); echo "Text to send if user hits Cancel button\n"; exit; } else { echo "Hello $PHP_AUTH_USER.P"; echo "You entered $PHP_AUTH_PW as your password.P"; } ? I'm not sure what is wrong. I copied and pasted this onto my system and it works just fine. -- Jason Stechschulte [EMAIL PROTECTED] -- Soitainly. I was assuming that came with the OO-ness of it. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Get a variable from a variable.
On Thu, Feb 15, 2001 at 03:57:58AM -0600, Fabian Fabela wrote: $a="myarray"; myFunction($myarray); if I try myArray($a); the string "myarray" is sent, and I want to send $myarray that is the text in $a. You were pretty close. I think you want to try this: myFunction($$a); It is a variable variable. http://www.php.net/manual/en/language.variables.variable.php -- Jason Stechschulte [EMAIL PROTECTED] -- Just don't create a file called -rf. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Netscape not resolving $PHPSELF ??
Thanks that fixed it. I didn't realize there were two version of this variable. Why? Hmm, strange that the other one worked fine with IE but not Netscape. I thought all thi was done server side, so what the heck does the browser have to do with it? As far as I know, $PHP_SELF is the variable and NOT $PHPSELF. It works in IE because if no page is printed in the tag, it just reloads the same page anyway. If you look at your html source while using $PHPSELF, you will probably see something like this: a href=This is the link/a Netscape realizes this is invalid html and complains, IE simply reloads the current page. -- Jason Stechschulte [EMAIL PROTECTED] -- But you have to allow a little for the desire to evangelize when you think you have good news. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regex help needed...
On Mon, Feb 12, 2001 at 12:15:04PM -0500, Jesse Swensen wrote: This should be a quick one, but I can't seem to wrap my brain around it. All I need to do is replace leading or trailing spaces with underscores. If there is spaces in between words, leave them alone. $fix = ereg_replace("(^ )|( $)", "_", $checkme); -- Jason Stechschulte [EMAIL PROTECTED] -- /* This bit of chicanery makes a unary function followed by a parenthesis into a function with one argument, highest precedence. */ -- Larry Wall in toke.c from the perl source code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regex help needed...
This is very close. If the string, " Testing ", had multiple spaces, but I wanted to convert each space to a "_", then what? I tried: There may be a better way, but here is a lengthy one that works. $checkme = " this is it "; if(ereg("^( )+", $checkme, $match)) { for($i = 0; $i strlen($match[0]); $i++) { $start .= "_"; } } if(ereg("( )+$", $checkme, $match)) { for($i = 0; $i strlen($match[0]); $i++) { $end .= "_"; } } $fix = ereg_replace("^( )+", $start, $checkme); $fix = ereg_replace("( )+$", $end, $fix); echo "$fix"; -- Jason Stechschulte [EMAIL PROTECTED] -- How do Crays and Alphas handle the POSIX problem? -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql not reporting errors
On Fri, Feb 09, 2001 at 12:48:46PM -0200, Christian Dechery wrote: yeah, I know that... but it used to report automatically... and this is kinda stupid don't u think? Yes, I do agree that it was kind of stupid to report automatically. It is much better to allow the user to trap the error and decide what to do. -- Jason Stechschulte [EMAIL PROTECTED] -- : I used to think that this was just another demonstration of Larry's : enormous skill at pulling off what other people would fail or balk at. Well, everyone else knew it was impossible, so they didn't try. :-) -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fread() a remote file
On Fri, Feb 09, 2001 at 09:02:04AM -0600, Tyler Longren wrote: Could you perform fread() on a remote file? Yes I could, and so can you, so why not try it? An example: $handle = fopen("http://www.php.net/manual/en/function.fread.php", "r"); while($line = fread($handle, 255)) { echo "$line"; } fclose($handle); -- Jason Stechschulte [EMAIL PROTECTED] -- One of the reasons Perl is faster than certain other unnamed interpreted languages is that it binds variable names to a particular package (or scope) at compile time rather than at run time. -- Larry Wall in [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]