RE: [PHP] Re: Automatically send auth info
Are you using a web form? You can just grab the values from the form if that's the case. But I suppose that you are not doing that, so you could just add some variables for username / password as part of the query string. Just realize, you're now sending login info in plain text! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php No, it's not a web form. I'm trying to include an IP addressed video camera into my webpage. The problem is that the video camera is password protected using htaccess. I don't have the option to remove the password. I tried looking through the PEAR auth libraries but I didn't find anything that *passed* authentication info, but only prompted for it, etc. I thought there would be a class that would allow me to send the username and password to a website and then include it, something like the following pseudo-code: ?php $crap = new get_website(); $crap-website_address(http://127.0.0.1;); $crap-website_username(joe); $crap-website_password(shmoe); $crap-retune_website(); ? The camera used to be accessible with: http://joe:[EMAIL PROTECTED] But it is no longer available via Internet Explorer since the new MS security updates on most windows boxes. Thanks again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Automatically send auth info
Hi all, Some of my webpages are no longer working with the IE browser after MS implemented some security patches which disable sending authentication info through the URL: http://user:[EMAIL PROTECTED] This no longer works with IE, but is fine with most other browsers. Does anybody know of a workaround using PHP to send the user pass in the background, i.e. without user interaction? Thanks for your help! -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing variables from Flash to PHP
O'Reilly's Flash Remoting discusses php examples fairly well although not all the source files are available on their website like they claim. www.flash-remoting.com -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED] Sent: Friday, April 02, 2004 11:14 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Passing variables from Flash to PHP At 10:44 AM 4/2/2004 -0800, [EMAIL PROTECTED] wrote: On Thu, 1 Apr 2004, Edward Tilley wrote: Hi - I am an IIS, PHP 4.3 new user running on Win2k server. I need to pass a variable ( $flash = 1 ) back out to my PHP script and can't find any examples of this working after 2 days of looking. I can't get a urldecode to work and I don't want a WDDX because I don't see pertinent WinOS examples on the .org website. Other methods I've tried included running a getURL(change_flash_value.php) script in Flash - the PHP script didn't execute and the value of $flash didn't change in keeping. It think you will want getURL(change_flash_value.php?flash=1) and then grab the flash variable from the $_REQUEST array. There is a great book called Macromedia Flash MX Professional 2004 for Server Geeks by Nate Weiss (ISBN: 0735713820) that, while it doesn't have PHP examples, does a great job of discussing Flash/server communication. -- David G. Risner Software Engineer -- California State University, Los Angeles http://www.risner.org/david/ Use SendandLoad as was done here to pass vars to a php login script: varSender = new LoadVars(); varReceiver = new LoadVars(); varSender.first_name = first_txt.text; varSender.last_name = last_txt.text; varSender.password = pass_txt.text; varSender.action = 'login'; varSender.sendAndLoad(http://+ host + user_logon.php, varReceiver, 'GET'); A copy of ActionScript for Flash MX, The Definitive Guide is really helpful. I don't know if Colin Moock has a MX2004 version out yet. Hope this has been helpful - Miles -- 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] Passing variables from Flash to PHP
-Original Message- From: Edward Tilley [mailto:[EMAIL PROTECTED] Sent: Thursday, April 01, 2004 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] Passing variables from Flash to PHP Hi - I am an IIS, PHP 4.3 new user running on Win2k server. I need to pass a variable ( $flash = 1 ) back out to my PHP script and can't find any examples of this working after 2 days of looking. I can't get a urldecode to work and I don't want a WDDX because I don't see pertinent WinOS examples on the .org website. Other methods I've tried included running a getURL(change_flash_value.php) script in Flash - the PHP script didn't execute and the value of $flash didn't change in keeping. Has anyone got a working example they can share with me? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Have you looked into Flash Remoting? http://www.amfphp.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multi-dimentional array from db results
I'm trying to re-create the following multi-dimentional array from a database query, where the indices 5, 7 and 21 are order_id and my table is food_orders(order_id, food, cooked): ?php $food_array = array( 5=array('steak','rare'), 7=array('burger','medium'), 21=array('lamb_chops','well'), ); $query = select * from food_orders where date = NOW(); $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $food_array[$row['order_id']] .= array($row['food'], $row['cooked']); } ? This looks fine to me, but when I do a: print_r($food_array) All I get is Array ( [5] = Array [7] = Array [21] = Array ) That is, I don't see the output of each order. Any suggestions would be greatly appreciated! -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: multi-dimentional array from db results
-Original Message- From: Jason Barnett [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 11:41 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: multi-dimentional array from db results Motorpsychkill wrote: I'm trying to re-create the following multi-dimentional array from a database query, where the indices 5, 7 and 21 are order_id and my table is food_orders(order_id, food, cooked): ?php $food_array = array( 5=array('steak','rare'), 7=array('burger','medium'), 21=array('lamb_chops','well'), ); $query = select * from food_orders where date = NOW(); $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $food_array[$row['order_id']] .= array($row['food'], $row['cooked']); The .= operator is for concatenating strings. The above code block adds the result of array($row['food'], $row['cooked']) to a blank string. If you are trying to assign array variables you want to use $food_array[$row['order_id']] = array($row['food'], $row['cooked']); Thanks dude, I've wasted a couple of hours on that :) -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] something like __URL__ (analogous to __FILE__)
This is tricky to explain, so bear with me please. I have a file like: c:\htdocs\project_bunny\includes\config.php In my browser address bar, this would look like: http://localhost/project_bunny/includes/config.php If within this document (i.e. config.php), I had: ?php //config.php define(CONFIG_FILE, __FILE__); echo CONFIG_FILE; //this will return c:\htdocs\project_bunny\includes\config.php ? Now, if I have another file (e.g. rabbits.php): ?php //rabbits.php include(config.php); echo CONFIG_FILE; //this will also return c:\htdocs\project_bunny\includes\config.php ? This is all great up to this point. What I'm trying to do is: ?php //config.php define(CONFIG_FILE_URL, __URL__); echo CONFIG_FILE_URL; //would return http://localhost/project_bunny/includes/config.php; ? So no matter what file I use (like rabbits.php) and I include config.php, CONFIG_FILE_URL will always return the url for the config file and NOT the file doing the calling (rabbits.php). Sorry for the longwinded explanation. I hope someone can help! Thank you. -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] something like __URL__ (analogous to __FILE__)
-Original Message- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 5:03 PM To: Evan Nemerson; motorpsychkill; Php General List Subject: RE: [PHP] something like __URL__ (analogous to __FILE__) Evan Nemerson mailto:[EMAIL PROTECTED] on Tuesday, March 23, 2004 5:00 PM said: Take a look at $_SERVER['REQUEST_URI'] the problem with that is that the value REQUEST_URI will contain is that of the page in the address bar (i think) and not the location of an included file (which is what i took the op to want). for example, config.php is likely not a file someone access directly, yet the op still wants that files URI. chris. You've interpreted my question correctly Chris, thanks for the suggestion. -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to do this (sub selects?)
I have a query that returns a result set like the following: TOPIC QUESTIONANSWER 1 A B 1 C D 1 E F 2 G H 1 I J 2 K L 3 M N Presentation-wise in PHP, how would I go about making a table to display results like (i.e. grouped by topic): 1 A B C D E F I J 2 G H K L 3 M N I've done this with two queries, the first selecting distinct topics and then running a subquery on all question/answers pertaining to that topic. I was just curious if anybody was handing these situations differently. Thank you! -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need help with references
Hi, I'm having trouble with the code below. Basically, I'm trying to set up $message to inherit one of two forms depending on if there is a $_GET request. The script works IF there is a $_GET request. It fails if there isn't (i.e. parse error). Is there a way to get $message to refer to include multiple references like below? Thank you! -m ? if ($_GET['id']){ $query = select * from bc_help where help_id = ' . $_GET['id'] . ' ; $message = $body; } else { $query = select * from bc_help; $message = ol . $links . /ol . $body; // This is where the trouble is. } $results = db_query($query); while ($row = db_fetch_array($results)){ $links .= lia class=internal href=# . $row['help_id'] . . $row['help_topic'] . /a/li\n; $body .= a name= . $row['help_id'] . b . $row['help_topic'] . /bbrbr . $row['help_text'] . /abrbrbr; } echo $message; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Size of session?
I'm not sure if this has been covered (I searched the archives) but does anyone know if there is a size limit on what a session can store? What is this dependant on? Thanks! -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: passing arrays?
Thank you Al for the pointers. This has been very helpful! -m -Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:28 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: passing arrays? $level = '$level_' . $_SESSION['user']['level']; //Where $_SESSION['user']['level'] can equal 1 or 2 $level_1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST, CP, OAFS, LO); $level_2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO); I can see two problems with your code: 1) The syntax for assigning to $level is wrong. Rather than: $level = '$level_' . $_SESSION['user']['level']; your code should read: $level = ${'level_' . $_SESSION['user']['level']}; For more information on this syntax, see: http://us2.php.net/manual/en/language.variables.variable.php 2) You are assigning $level_1 or $level_2 (depending on the value of $_SESSION['user']['level']) to $level *before* you have assigned $level_1 or $level_2 any values. There's no point making $level = $level_1 if $level_1 hasn't been defined yet. Working code would be: $level_1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST, CP, OAFS, LO); $level_2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO); $level = ${'level_' . $_SESSION['user']['level']}; Hope it helps, Al -- 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] passing arrays?
Thank you Mike for your recommendations as well. I've certainly learned a few tricks from this thread. Thanks to all those concerned! -m -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 2:41 AM To: 'motorpsychkill'; Php General List Subject: RE: [PHP] passing arrays? On 12 December 2003 06:07, motorpsychkill wrote: Thanks Tom, that worked! I knew that $$level had something to do with it, just wasn't sure what exactly. Thanks again. -m -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:34 PM To: motorpsychkill Subject: Re: [PHP] passing arrays? Always use isset() to check if something exists before trying to use it if originates externally to the running script. you probabley need something like this $level_0 = array('NONE'); $level_1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST,CP, OAFS, LO); $level_2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO); if(isset($_SESSION['user']['level'])){ $level = 'level_'.$_SESSION['user']['level']; }else{ $level = 'level_0'; //catchall value } foreach($$level as $value){ echo $value.'br'; } Actually, I'd like to suggest that a variable variable is the wrong tool for this, and an array should be used instead -- something like: $level = array(1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST,CP, OAFS, LO), 2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO) ); if (isset($_SESSION['user']['level']) isset($level[$_SESSION['user']['level']])): foreach ($level[$_SESSION['user']['level']] as $value): echo $value.'br'; endforeach; else: // invalid level endif; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- 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] passing arrays?
code ?php $level = '$level_' . $_SESSION['user']['level']; //Where $_SESSION['user']['level'] can equal 1 or 2 $level_1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST, CP, OAFS, LO); $level_2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO); while (list ($key, $val) = each ($level)) { print tr; print td width=\30%\img src=./images/icons/ . $icon_array[$val] . /td; print td . constant($val) . /td; print /tr; } ? /code error Warning: Variable passed to each() is not an array or object in D:\projects\kf10\test65.php on line 43 /error Line 43 in the error output refers to the while control structure. I can not seem to define $level as the array $level_1 or $level_2, depending on the $_SESSION['user']['level'] value (which can also be 1 or 2). Any thoughts on how to do this? I tried using a switch statement like: switch ($_SESSION['user']['level']) { case 1: $level = $level_1; break; case 2: $level = $level_2; } But this didn't work either. Any help would be greatly appreciated. -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing arrays?
Thanks Tom, that worked! I knew that $$level had something to do with it, just wasn't sure what exactly. Thanks again. -m -Original Message- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 9:34 PM To: motorpsychkill Subject: Re: [PHP] passing arrays? Always use isset() to check if something exists before trying to use it if originates externally to the running script. you probabley need something like this $level_0 = array('NONE'); $level_1 = array(PN, GALUP, VP, PUBUP, STATS, MCI, CONLIST,CP, OAFS, LO); $level_2 = array(PN, GALUP, VP, PUBUP, MCI, CONLIST, CP, OAFS, LO); if(isset($_SESSION['user']['level'])){ $level = 'level_'.$_SESSION['user']['level']; }else{ $level = 'level_0'; //catchall value } foreach($$level as $value){ echo $value.'br'; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] jpeg photo file upload problem
You may want to try getimagesize(), as this is more consistent in determining mime types. That is what I wound up doing as it appears to override the browser/platform idiosyncracies. -m -Original Message- From: John T. Beresford [mailto:[EMAIL PROTECTED] Sent: Thursday, July 17, 2003 5:51 PM To: motorpsychkill; [EMAIL PROTECTED] Subject: RE: [PHP] jpeg photo file upload problem You're exactly right. I did a test on a win box and it reported image/pjpeg I ran tests on other browsers/platforms, and for a .jpg image, only a handful of win boxes reported the 'pjpeg' thing. I also did tests using 'regular jpegs' and 'progressive jpegs' and that had no effect. Apparently the ms browser on a win box calls a 'jpeg a 'pjpeg' Anyway, to all, thanks for all the help, it's all working now. John At 5:43 PM -0700 7/17/03, motorpsychkill wrote: I suspect this may be a browser/platform issue. I've recently run some tests and below are the most interesting results (mime types): IE 6 on PC: something.jpg- image/pjpeg something.tif (pc format) - application/octet-stream something.tif (mac format) -image/tiff IE 5 on Mac: something.bmp - application/octet-stream something.jpg - image/jpeg NS 4.7 on Mac: something.bmp- image/x-MS-bmp Opera 7 on PC: something.bmp- image/x-windows-bmp I suspect if you want to validate jpgs, use image/jpeg and image/pjpeg or validate by examining the extention (ie .jpg). I don't know how safe the latter is. HTH, m -Original Message- From: John T. Beresford [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 7:49 PM To: [EMAIL PROTECTED] Subject: [PHP] jpeg photo file upload problem Hi All, I have a system that allows a person to upload photos to the server via an admin web form. I have been using the code for about a year with no problem. I designed it specifically for a client of mine that has just started cruising on a sailboat for a few years. They tryed uploading a photo from a public library via the web form and they got the error message that it was not a jpeg file. The relevent PHP code from my system for the checking is: if ($type != image/jpeg) { $ReturnSaying = !! The file is not a JPEG picture. Please try again; include(photo_error.php); exit; Anyway, this system has been tested and tested again on multiple platforms and conditions, except a public library. Question: Is it possible that the library is using some proxy system that is messing with the file so it comes out bad? Also, I have confirmed that the file is a jpeg file. Any ideas are greatly appreciated, John -- === John T. Beresford, Owner Digital Studio Design Edmond, OK http://www.digitalstudiodesign.com/ 405.760.0794 -- 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 -- === John T. Beresford, Owner Digital Studio Design Edmond, OK http://www.digitalstudiodesign.com/ 405.760.0794 -- 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] jpeg photo file upload problem
I suspect this may be a browser/platform issue. I've recently run some tests and below are the most interesting results (mime types): IE 6 on PC: something.jpg - image/pjpeg something.tif (pc format) -application/octet-stream something.tif (mac format) - image/tiff IE 5 on Mac: something.bmp -application/octet-stream something.jpg -image/jpeg NS 4.7 on Mac: something.bmp - image/x-MS-bmp Opera 7 on PC: something.bmp - image/x-windows-bmp I suspect if you want to validate jpgs, use image/jpeg and image/pjpeg or validate by examining the extention (ie .jpg). I don't know how safe the latter is. HTH, m -Original Message- From: John T. Beresford [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 7:49 PM To: [EMAIL PROTECTED] Subject: [PHP] jpeg photo file upload problem Hi All, I have a system that allows a person to upload photos to the server via an admin web form. I have been using the code for about a year with no problem. I designed it specifically for a client of mine that has just started cruising on a sailboat for a few years. They tryed uploading a photo from a public library via the web form and they got the error message that it was not a jpeg file. The relevent PHP code from my system for the checking is: if ($type != image/jpeg) { $ReturnSaying = !! The file is not a JPEG picture. Please try again; include(photo_error.php); exit; Anyway, this system has been tested and tested again on multiple platforms and conditions, except a public library. Question: Is it possible that the library is using some proxy system that is messing with the file so it comes out bad? Also, I have confirmed that the file is a jpeg file. Any ideas are greatly appreciated, John -- === John T. Beresford, Owner Digital Studio Design Edmond, OK http://www.digitalstudiodesign.com/ 405.760.0794 -- 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 weirdness with files named tos.php
I'm running PHP 4.3.1 with Apache 2.0 on Windows XP. Everything works great except if I name a file tos.php, Apache won't serve it. I'm not really sure if this is an Apache or PHP thing. Can anyone else replicate this error on their machines? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best Practices in Directory Layout?
I've wanted to get some input on this for a while... I've recently been designing PHP applications using the following directory architecture: main/ master php files (e.g. addphoto.php) includes/ forms/ validation/ process/ So, using the addphoto.php example, there would be a file in the forms directory that read: addphoto_form.inc In the validation directory, there would be: addphoto_validation.inc And in the process directory, addphoto_process.inc The master php file (addphoto.php) would simply pull the form, validate it and process it. Now the problem is, as I add more master files (currently around 50), the forms, validation and process directories get equally large. Would it make more sense to simply allocate each master file its own directory like this: addphoto/ addphoto_form.inc addphoto_validate.inc addphoto_process.inc And so, with each new master file (for a task or module), there would be a new directory. I'm not sure which is better form, but I find that using the first method is easier when adding new tasks for the application to execute. I've looked at the layout of a couple big php applications and they all seem to do things differently. Any thoughts are welcome!! -m -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bad form...
hello everyone, is it 'bad form' (no pun intended) to have a form point to itself for processing, rather than forward the form variables to another page? Anybody have any input on this? I try to have 1 page that is the form and handles all the processing as well in order to keep the page count on my site low and for easier editing, blah blah blah thank you for you help!
[PHP] fargin sessions...
If anybody is remotely interested, this is how I got php 4.0.4 to do sessions without cookies and with register_globals=OFF. Tested on IE 4.something (I'm not really coherent right now ;) and Netscape 4.5. This took me a while to figure out and thought it might help save someone else the trouble. Let me know if you can improve upon this... //-sess01.php ?php session_start(); session_register('varA'); session_register('varB'); ? form action=sess02.php first name:input type=text name=varA br last name:input type=text name=varB input type=submit value=send /form //-sess02.php ?php session_start(); $varA=$HTTP_GET_VARS['varA']; $varB=$HTTP_GET_VARS['varB']; $GLOBALS['HTTP_SESSION_VARS']['varA'] = $varA; $GLOBALS['HTTP_SESSION_VARS']['varB'] = $varB; echo $HTTP_SESSION_VARS['varA']; echo $HTTP_SESSION_VARS['varB']; ? -- 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]