RE: [PHP] inspirational
Why don't you try something like this...do a system call to pwd and strip out the portion of the url that you know is the upper directory. Then you can exchange that for the http://www.site.com/ and then add the additional directories to the end and call the script name...there might not be a function that does all this, however, you can try to work around it Thanks, Ray Hunter -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 25, 2002 11:39 PM To: [EMAIL PROTECTED] Subject: [PHP] inspirational I want to detect the url my .php lies in. This is over kill and BS: $myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME); How do I get http://foo.com/dir1/dir2/dir3/;. There seems to be nothing in phpinfo() that will give me a full url to play with. Flame me if you will, but I browsed TFM and found nothing inspirational. Looked at phpinfo() too and got discouraged. I need a full url. John -- 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-general Digest 26 May 2002 07:23:25 -0000 Issue 1367
php-general Digest 26 May 2002 07:23:25 - Issue 1367 Topics (messages 99255 through 99285): 4.2.1 Vars 99255 by: Kurth Bemis (List Monkey) 99258 by: Jeff Lewis 99260 by: 1LT John W. Holmes 99261 by: Kurth Bemis (List Monkey) 99263 by: 1LT John W. Holmes Re: Newbie Questionabout variables 99256 by: Al pconnect 99257 by: Boaz Yahav Re: PHP script 99259 by: Paul Roberts NewBie-UPLOADING IMAGE 99262 by: Dani 99264 by: 1LT John W. Holmes 99266 by: Kevin Stone 99272 by: Neil Highley Re: unexpected T_IF 99265 by: Steve Buehler UPLOADING IMAGE 99267 by: Dani 99268 by: 1LT John W. Holmes 99269 by: Dani 99270 by: 1LT John W. Holmes 99271 by: Dani 99279 by: Liam MacKenzie Incompatibility with file-input items 99273 by: Felix Natter bulletin board question... 99274 by: Anthony Ritter 99276 by: Richard Baskett 99282 by: 1LT John W. Holmes 99283 by: SP Re: Function Switch($pid) - NEED HELP 99275 by: David Freeman Extract ZIP archives 99277 by: Kevin Stone Include (Newbie question) 99278 by: r 99280 by: Kevin Stone 99281 by: 1LT John W. Holmes inspirational 99284 by: jtjohnston 99285 by: Ray Hunter Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- After moving to php 4.2.1 my scripts that use xxx.php?blah=4 fail to work. I know that i need to turn register_globals on in my config, however I know that there are security problems with this. So bascially I need to know how to make 500+ scripts work without editing a bunch of files to make it so that all my get and post vars start with $_POST and $_GET any ideas? ~kurth Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone Computer Security is like an arms race; the best attackers will continue to search for more complicated exploits, so we will too. Quoted from http://www.openbsd.org/security.html [EMAIL PROTECTED] | http://kurth.hardcrypto.com PGP key available - http://kurth.hardcrypto.com/pgp Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net (http://www.distributed.net) ---End Message--- ---BeginMessage--- For now you can add this to the top of your scripts: $types_to_register = array('GET','POST','COOKIE','SESSION','SERVER'); foreach ($types_to_register as $type) { $arr = @${'HTTP_' . $type . '_VARS'}; if (@count($arr) 0) { extract($arr, EXTR_OVERWRITE); } } Somebody else posted this a few weeks back and it has worked for me until I can convert everything over... Jeff - Original Message - From: Kurth Bemis (List Monkey) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 25, 2002 3:23 PM Subject: [PHP] 4.2.1 Vars After moving to php 4.2.1 my scripts that use xxx.php?blah=4 fail to work. I know that i need to turn register_globals on in my config, however I know that there are security problems with this. So bascially I need to know how to make 500+ scripts work without editing a bunch of files to make it so that all my get and post vars start with $_POST and $_GET any ideas? ~kurth Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone Computer Security is like an arms race; the best attackers will continue to search for more complicated exploits, so we will too. Quoted from http://www.openbsd.org/security.html [EMAIL PROTECTED] | http://kurth.hardcrypto.com PGP key available - http://kurth.hardcrypto.com/pgp Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net (http://www.distributed.net) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Do you know what the security problems are? Do you realise that having register_globals on or off isn't the security problem, it's how you write your code? If you're not going to change any of your code, just turn on register_globals. Changing your code to _POST or _GET and doing nothing else isn't making it any more secure that using it the way it is with register_globals on. ---John Holmes... - Original Message - From: Kurth Bemis (List Monkey) [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 25, 2002 3:23 PM Subject: [PHP] 4.2.1 Vars After moving to php 4.2.1 my scripts that use xxx.php?blah=4 fail to work. I know that i need to turn register_globals on in my config, however I know that there are security problems with this. So bascially I need to know how to make 500+ scripts work without editing a bunch of files to make it so that all my get and
[PHP] PHP and JavaScript
Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and JavaScript
It worked for me, what error are you getting? In the other.html, did you have this? html head title/title script language=JavaScript src=script.php/script /head body /body /html -Original Message- From: mp [mailto:[EMAIL PROTECTED]] Sent: May 26, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP and JavaScript Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- 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[2]: [PHP] please help!!
Hello Jolly, Sunday, May 26, 2002, 10:58:45 AM, you wrote: JN Olexandr, JN ?PHP JN /* I can get the values from these */ JN foreach ($HTTP_POST_VARS as $var = $value) { JN echo $var = $valuebr\n; JN } JN /**/ JN /*however empty for this sentence*/ JN echo equals .($t1+$t2); JN /**/ JN echo form action='$PHP_SELF' METHOD='POST'\n; JN echo input type='text' name='t1'\n; JN echo input type='text' name='t2'\n; JN echo input type='submit' name='Submit' value='Submit'\n; JN echo /form/p\n; ? JN P.S. I have set register_globals = On, but still not work JN The attached files are my config files of php and apache! I looked through your configuration files and didn't notice any serious differences between them and my ones. I have PHP 4.2.1/Apache 2.0.36 on WinXP Pro. My register_globals was off. When I made it On your scipt worked properly. I don't know what the reason. What PHP you have? I attached my php.ini. Maybe you can find some important things. Another one question: does $PHP_SELF give proper value? It must not be set if register_globals=off. So if $PHP_SELF is set to some value, then global variables are registered. And the last question: why do you use global variables? It's much easier to use superglobal arrays $_POST, $_SERVER, etc. They guarantee that any values passed to your script won't be mixed. -- Best regards, Olexandrmailto:[EMAIL PROTECTED] php.ini.zip Description: Zip compressed data -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some advice concerning forms (multi select pulldown) and arrays
Hello and thanks for your fast answer! I'ld like to know if there is any possibility to distinguish the selects if I've multiple multiple selects, that is, more than one on the same page? What I'm loooking for is the possibility to have an unknown number of multiple selects on the same page Is it possible? Anyone who can describe how to do this or provide a link to some tutorial? And also, where in the manual can I read about this? Sincerely, Victor On lördag, maj 25, 2002, at 08:59 , Miguel Cruz wrote: Have a play with this little program - it should demonstrate all of the things you'd want to do with getting data in and out of mult selects. If it doesn't work, you may have an older version of PHP - in that case, change $_REQUEST to $HTTP_POST_VARS and $_SERVER['PHP_SELF'] to $PHP_SELF. --- ? $choices = array(1 = 'dog', 2 = 'cat', 3 = 'mouse', 4 = 'frog'); if (is_array($_REQUEST['animals'])) { print 'pYou chose:/pul'; foreach ($_REQUEST['animals'] as $animal_id) print li{$choices[$animal_id]}/li; print '/ulhr'; } ?form method=post action=?= $_SERVER['PHP_SELF'] ? select multiple name=animals[]? foreach ($choices as $id = $name) print 'option ' . (in_array($id, $_REQUEST['animals']) ? 'selected ' : '') . value='$id'$name/option; ?/selectinput type=submit/form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
try: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael Jtjohnston [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to detect the url my .php lies in. This is over kill and BS: $myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME); How do I get http://foo.com/dir1/dir2/dir3/;. There seems to be nothing in phpinfo() that will give me a full url to play with. Flame me if you will, but I browsed TFM and found nothing inspirational. Looked at phpinfo() too and got discouraged. I need a full url. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
typo: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$/', '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael Michael Virnstein [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael Jtjohnston [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to detect the url my .php lies in. This is over kill and BS: $myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME); How do I get http://foo.com/dir1/dir2/dir3/;. There seems to be nothing in phpinfo() that will give me a full url to play with. Flame me if you will, but I browsed TFM and found nothing inspirational. Looked at phpinfo() too and got discouraged. I need a full url. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
but the scriptname itself will be included there. Try this, if you don't want the scriptname to be included.: $url = preg_replace('/^(http:\/\/)[^\/]+((\/[^\/])*\/)([^\/]+)$/', '\\1$SERVER_NAME\\2', $SCRIPT_URI); Haven't tested them, but should work. Michael Michael Virnstein [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... typo: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$/', '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael Michael Virnstein [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael Jtjohnston [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I want to detect the url my .php lies in. This is over kill and BS: $myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME); How do I get http://foo.com/dir1/dir2/dir3/;. There seems to be nothing in phpinfo() that will give me a full url to play with. Flame me if you will, but I browsed TFM and found nothing inspirational. Looked at phpinfo() too and got discouraged. I need a full url. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and JavaScript
You need to define the type of file you are creating. Like when you create wml pages with php. Header(Content-Type: text/javascript); or summing to that effect. have a look at www.weberdev.com Mp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Need some advice concerning forms (multi select pulldown) and arrays
Just give each select its own name. Or name them all the same followed by an [] and you'll end up with a multi-dimensional array if things go right... select name='one' ... select name='two' ---John Holmes... -Original Message- From: Victor Spång Arthursson [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 5:49 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Need some advice concerning forms (multi select pulldown) and arrays Hello and thanks for your fast answer! I'ld like to know if there is any possibility to distinguish the selects if I've multiple multiple selects, that is, more than one on the same page? What I'm loooking for is the possibility to have an unknown number of multiple selects on the same page Is it possible? Anyone who can describe how to do this or provide a link to some tutorial? And also, where in the manual can I read about this? Sincerely, Victor On lördag, maj 25, 2002, at 08:59 , Miguel Cruz wrote: Have a play with this little program - it should demonstrate all of the things you'd want to do with getting data in and out of mult selects. If it doesn't work, you may have an older version of PHP - in that case, change $_REQUEST to $HTTP_POST_VARS and $_SERVER['PHP_SELF'] to $PHP_SELF. --- ? $choices = array(1 = 'dog', 2 = 'cat', 3 = 'mouse', 4 = 'frog'); if (is_array($_REQUEST['animals'])) { print 'pYou chose:/pul'; foreach ($_REQUEST['animals'] as $animal_id) print li{$choices[$animal_id]}/li; print '/ulhr'; } ?form method=post action=?= $_SERVER['PHP_SELF'] ? select multiple name=animals[]? foreach ($choices as $id = $name) print 'option ' . (in_array($id, $_REQUEST['animals']) ? 'selected ' : '') . value='$id'$name/option; ?/selectinput type=submit/form -- 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] inspirational
If you're getting this discouraged over creating a URL, then maybe you should give this stuff up. There's no variable that gives you the full URL of your script, deal with it. What is this parse() function you're using? What does it do? Why is this over kill and BS? Try this: $myurlvar = http:// . $SERVER_NAME . dirname($SCRIPT_NAME); ---John Holmes... -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 1:39 AM To: [EMAIL PROTECTED] Subject: [PHP] inspirational I want to detect the url my .php lies in. This is over kill and BS: $myurlvar = http://.$SERVER_NAME.parse($SCRIPT_NAME); How do I get http://foo.com/dir1/dir2/dir3/;. There seems to be nothing in phpinfo() that will give me a full url to play with. Flame me if you will, but I browsed TFM and found nothing inspirational. Looked at phpinfo() too and got discouraged. I need a full url. John -- 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] Need some advice concerning forms (multi select pulldown) and arrays
On Sunday, May 26, 2002, at 01:14 PM, John Holmes wrote: Just give each select its own name. Can't do that, don't know from time to time how many there'll be And I've to have some case which iterates on the following page... Or name them all the same followed by an [] and you'll end up with a multi-dimensional array if things go right... Sounds better - but I've a lot of items and I'ld like to know which of the arrays that go to which item... Can I just write name=array[whateverid] and then in some way reveal the whateverid's? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] arrays
A couple of simple ones here ... the usual references don't appear to give a straightforward answer on these: Can arrays be passed to functions just like a simple variable? Can arrays be passed as values in hidden form fields just like a simple variable? I've been playing around with these and getting inconsistent results. I've been trying things like serialize and urlencode, but still haven't worked out a straightforward 'rule' or policy. Can someone throw some light on this? TIA Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] E-mail via WAP
Hi, can someone tell me is there a script for sending and receiving a mail via WAP ? Thanks, Rosen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: arrays
Can arrays be passed to functions just like a simple variable? yes, no difference. You can pass every variable to a function, you can pass constants or your values directly. You have to use a variable if a function requires passing by reference or if you want to pass by refernce, because only variables can take the value back. Can arrays be passed as values in hidden form fields just like a simple variable? yes, but differently. either you serialize the array, send it urlencoded to the page and unserialze it there: //page1.php: ?php $array = array(1,2,3,4,5); $array = urlencode(serialize($array)); ? a href=page2.php?array=?php echo $array; ?Page2/a //or input field: input type=hidden name=array value=?php echo $array; ? //page2.php ?php $array = unserialize($array); print_r($array); ? or you can appen urls like this, no serialization or sth needed then both pages: numerical indexed arrays: a href=page2.php?array[]=1array[]=2array[]=3array[]=4array[]=5Page2/a or a href=page2.php?array[0]=1array[1]=2array[2]=3array[3]=4array[4]=5Page 2/a string indexed arrays: a href=page2.php?array[test1]=1array[test2]=2array[test3]=3array[test4]=4 array[test5]=5Page2/a or with forms: numerical indexed arrays: input type=hidden name=array[] value=1 input type=hidden name=array[] value=2 input type=hidden name=array[] value=3 input type=hidden name=array[] value=4 input type=hidden name=array[] value=5 or input type=hidden name=array[0] value=1 input type=hidden name=array[2] value=2 input type=hidden name=array[3] value=3 input type=hidden name=array[4] value=4 input type=hidden name=array[5] value=5 string indexed arrays: input type=hidden name=array[test1] value=1 input type=hidden name=array[test2] value=2 input type=hidden name=array[test3] value=3 input type=hidden name=array[test4] value=4 input type=hidden name=array[test5] value=5 Michael Michael Hall [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... A couple of simple ones here ... the usual references don't appear to give a straightforward answer on these: Can arrays be passed to functions just like a simple variable? Can arrays be passed as values in hidden form fields just like a simple variable? I've been playing around with these and getting inconsistent results. I've been trying things like serialize and urlencode, but still haven't worked out a straightforward 'rule' or policy. Can someone throw some light on this? TIA Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: NewBie-UPLOADING IMAGE
This works for me (WinXPpro, IIS, PHP 4.1.2): ?php if (isset($HTTP_POST_VARS[MAX_FILE_SIZE])) if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { copy($HTTP_POST_FILES['userfile']['tmp_name'], upload/.$HTTP_POST_FILES['userfile']['name']); move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], upload/.$HTTP_POST_FILES['userfile']['name']); } else { echo Possible file upload attack. Filename: . $HTTP_POST_FILES['userfile']['name']; } ? Hope it will help bye, evan Dani [EMAIL PROTECTED] ha scritto nel messaggio [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I want to upload image file into a folder in webserver using HTML form. What function do I use fo this purpose? Thank you, Dani -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some advice concerning forms (multi select pulldown) and arrays
Ok, I can't get this right... Have the following code: ? $choices = array(1 = 'dog', 2 = 'cat', 3 = 'mouse', 4 = 'frog'); if (is_array($_REQUEST['animals'])) { // get the number of selectcases echo get the number of selectcases: . count($animals) . br; // get the number of provided selects from select with name 2 echo get the number of provided selects from select with name \2\: . count($animals[2]) . br; // test to print some data echo $animals[2][0]. br; echo $animals[2][1]. br; echo $animals[2][2]. br; echo $animals[2][3]. br; } ? form method=post action=?= $_SERVER['PHP_SELF'] ? select multiple name=animals[2] option value='1'dog/option option value='2'cat/option option value='3'mouse/option option value='4'frog/option /select select multiple name=animals[4] option value='1'dog/option option value='2'cat/option option value='3'mouse/option option value='4'frog/option /select input type=submit/form Why does it not work? // get the number of selectcases echo get the number of selectcases: . count($animals) . br; This works great // get the number of provided selects from select with name 2 echo get the number of provided selects from select with name \2\: . count($animals[2]) . br; But this doesn't... Thankful for any help, /Victor On Sunday, May 26, 2002, at 05:35 PM, John Holmes wrote: You can supply an whateverID for the select if you want to. select name=select[] option ... /select select name=select[] option ... /select etc... That will give you an array $select[] on the processing page. If the selects are multi-selects, you'll have a multidimensional array. The first chosen element in the first select box can be referenced like this $select[0][0] You can get a count of how many select boxes there are by doing count($select); You can get a count of how many elements were selected within a select you can do this: count($select[x]); Where x is the number of the select box you want to know about. Confusing, eh? ---John Holmes... -Original Message- From: Victor Spång Arthursson [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 7:44 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Need some advice concerning forms (multi select pulldown) and arrays On Sunday, May 26, 2002, at 01:14 PM, John Holmes wrote: Just give each select its own name. Can't do that, don't know from time to time how many there'll be And I've to have some case which iterates on the following page... Or name them all the same followed by an [] and you'll end up with a multi-dimensional array if things go right... Sounds better - but I've a lot of items and I'ld like to know which of the arrays that go to which item... Can I just write name=array[whateverid] and then in some way reveal the whateverid's? Sincerely Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extract ZIP archives
On Sat, May 25, 2002 at 05:41:24PM -0600, Kevin Stone wrote: If so what would the unix command be to expand and create ZIP archives? How would I tie that into my PHP script using the system() function? system(unzip $filename); or exec(unzip $filename); or passthru(unzip $filename); or `unzip $filename`; --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need some advice concerning forms (multi select pulldown)and arrays
On Sun, 26 May 2002, Victor Spång Arthursson wrote: select multiple name=animals[2] change this to: select multiple name=animals[2][] select multiple name=animals[4] and this to: select multiple name=animals[4][] because you want animals[2] and animals[4] to be arrays, not scalar values. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.2.1 Vars
With register_globals OFF in your php.ini file, all of the user input is present in the _GET, _POST, _REQUEST, or _COOKIE array. With register_globals ON, then the variables are registered as regular variables. If you have a URL like page.php?id=1, then with them OFF, you have to use $_GET[id] to get the value of one, with them ON, you can just use $id. Just to be clear, $_GET['id'] will work fine with register_globals on or off. In otherwords, these php predefined variables will exist either way. Just like the older non-super ones, such as $HTTP_GET_VARS. Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex help
This is not really specific to PHP (although the information might be useful for all that form validation we all do), and for that I apologize in advance (does anyone know of a regex mailing list?), but maybe someone here can help with the following: I find no good regex for checking valid domain names. None that I have seen take into account the fact that, although dashes (-) and dots (.) are allowed in a domain name, the domain name can neither begin with nor end with a dash or dot, and additionally, two dashes or two dots in a row are not allowed and a dash followed by a dot or a dot followed by a dash are not allowed. So, I've come up with two regex's for checking domain names. The first one checks that the name contains alphanumerics, the dash and the dot, and neither begins with or ends with a dash or dot: ^[a-z0-9]$|^[a-z0-9]+[a-z0-9.-]*[a-z0-9]+$ The second one checks that two dashes and two dots are not together and that a dash followed by a dot or a dot followed by a dash are not together: --|\.\.|-\.|\.- Putting it all together, the way I check for a valid domain name is with the following: if (eregi(^[a-z0-9]$|^[a-z0-9]+[a-z0-9.-]*[a-z0-9]+$, $domain_name) != true OR eregi(--|\.\.|-\.|\.-, $domain_name) == true { error; } So, my question (finally!) is this: Is there any way to combine both expressions (basically, one part that checks for false and one part that checks for true) into one regex that just returns true or false? I haven't been able to find any documentation that shows me how to do that, basically a like this but not like this syntax. BTW, anticipating someone mentioning the fact that the above regex's don't check for a domain name ending with a dot followed by three characters max (as in .com, .net, etc.), it's because that long-held truth is no longer true. We now have .info and .museum, and who know what the future will bring. About the only truth left is that domain names end in a dot followed by two characters minimum (there are the country code domains like .us, .de. etc. but there are no one character TLD's at present and I would expect perhaps not for a long long time, but you never know). Perhaps someone would expand on the regex above to include checking for a name ending with a dot followed by two characters minimum, I just haven't been into regex's long enough to know how). Of course, you could get really anal about all this and check for domain names that only end in the current ICANN root server TLD's (about 260 or so, I believe), but that wouldn't account for TLD's that operate within other root servers (there's always sumthin'). Anyways, Any help with the above is certainly appreciated! Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex help
I use this, but it's a preg rather than ereg pattern: '/([a-z0-9]+[a-z0-9\-]*\.)+[a-z0-9]+[a-z0-9\-]*[a-z0-9]+$/i' Two problems (which in practice are so slight that I've foregone my usual standards-analness to ignore them) 1) It will allow a domain name component (except the final one) to end with a dash (e.g., test-.example.com). 2) It will not allow a one-character final component. miguel On Sun, 26 May 2002, Jeff Field wrote: This is not really specific to PHP (although the information might be useful for all that form validation we all do), and for that I apologize in advance (does anyone know of a regex mailing list?), but maybe someone here can help with the following: I find no good regex for checking valid domain names. None that I have seen take into account the fact that, although dashes (-) and dots (.) are allowed in a domain name, the domain name can neither begin with nor end with a dash or dot, and additionally, two dashes or two dots in a row are not allowed and a dash followed by a dot or a dot followed by a dash are not allowed. So, I've come up with two regex's for checking domain names. The first one checks that the name contains alphanumerics, the dash and the dot, and neither begins with or ends with a dash or dot: ^[a-z0-9]$|^[a-z0-9]+[a-z0-9.-]*[a-z0-9]+$ The second one checks that two dashes and two dots are not together and that a dash followed by a dot or a dot followed by a dash are not together: --|\.\.|-\.|\.- Putting it all together, the way I check for a valid domain name is with the following: if (eregi(^[a-z0-9]$|^[a-z0-9]+[a-z0-9.-]*[a-z0-9]+$, $domain_name) != true OR eregi(--|\.\.|-\.|\.-, $domain_name) == true { error; } So, my question (finally!) is this: Is there any way to combine both expressions (basically, one part that checks for false and one part that checks for true) into one regex that just returns true or false? I haven't been able to find any documentation that shows me how to do that, basically a like this but not like this syntax. BTW, anticipating someone mentioning the fact that the above regex's don't check for a domain name ending with a dot followed by three characters max (as in .com, .net, etc.), it's because that long-held truth is no longer true. We now have .info and .museum, and who know what the future will bring. About the only truth left is that domain names end in a dot followed by two characters minimum (there are the country code domains like .us, .de. etc. but there are no one character TLD's at present and I would expect perhaps not for a long long time, but you never know). Perhaps someone would expand on the regex above to include checking for a name ending with a dot followed by two characters minimum, I just haven't been into regex's long enough to know how). Of course, you could get really anal about all this and check for domain names that only end in the current ICANN root server TLD's (about 260 or so, I believe), but that wouldn't account for TLD's that operate within other root servers (there's always sumthin'). Anyways, Any help with the above is certainly appreciated! Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays
Can arrays be passed to functions just like a simple variable? Yes. Can arrays be passed as values in hidden form fields just like a simple variable? Yes, with a little work. I've been playing around with these and getting inconsistent results. I've been trying things like serialize and urlencode, but still haven't worked out a straightforward 'rule' or policy. For example: $arr = array('color' = 'red', 'fruit' = 'apple'); $str_arr = urlencode(serialize($arr)); input type=hidden name=foo value=?php echo $str_arr ? And in the action script, do: $arr = unserialize(stripslashes($_REQUEST['foo'])); Notes: a) stripslashes may be needed, in case magical quotes get in the way (magic_quotes_gpc). b) am using $_REQUEST, you may use $_GET or $_POST or whatever contains the form value. c) hidden, text, textarea ... doesn't matter. d) a way to test if what _should_ be an array is really an array is with print_r() and/or is_array(). print_r($arr); e) we don't need urldecode() because that'll happen automatically when going through the form. f) you could use implode() instead of serialize too. Can someone throw some light on this? I hope so :) Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing PHP output
Dear folks, Has anyone ever been able to get a CGI to produce valid PHP output?? Whatever I do, my browser ALWAYS wants to open or save the non-parsed PHP text produced by the CGI file. And yes, I have set the proper ExecCGI and PHP entries in my vhosts.conf; and yes, I restarted the server. Basically, I open an existing php file (in a Perl CGI), and output its contents again to the Apache server. The CGI starts with sending this header: print Content-type: application/x-httpd-php\n\n; Then I output the text. But, no matter what I do, it will not parse the PHP code. I do not understand this. Regular PHP files in that dir work fine. There is, as far as I can see, no reason why this should not work. And the PHP file really needs to be generated from the CGI, as it needs to run as a specific user. Anyway, any help would be much appreciated, - Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parsing PHP output
The problem is that you are sending this output to the browser and not the server. You can do this with XML because IE and Netscape have XML parsers built-in. You should create a form that will catch the data from CGI then handle it on the server. There might be other work arounds as well...however, I have only played with the XML stuff... Thanks, Ray Hunter -Original Message- From: Mark [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 26, 2002 12:07 PM To: [EMAIL PROTECTED] Subject: [PHP] Parsing PHP output Dear folks, Has anyone ever been able to get a CGI to produce valid PHP output?? Whatever I do, my browser ALWAYS wants to open or save the non-parsed PHP text produced by the CGI file. And yes, I have set the proper ExecCGI and PHP entries in my vhosts.conf; and yes, I restarted the server. Basically, I open an existing php file (in a Perl CGI), and output its contents again to the Apache server. The CGI starts with sending this header: print Content-type: application/x-httpd-php\n\n; Then I output the text. But, no matter what I do, it will not parse the PHP code. I do not understand this. Regular PHP files in that dir work fine. There is, as far as I can see, no reason why this should not work. And the PHP file really needs to be generated from the CGI, as it needs to run as a specific user. Anyway, any help would be much appreciated, - Mark -- 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] ini_set('register_globals',0) doesn't work
I tested ini_set('register_globals',0) and ini_set('register_globals','Off') for turning register_globals off. It doesn't work and it doesn't produce any notice, warning or error. Here's a quick example: ?php ini_set('register_globals',0); if(isset($test)) echo h2$test/h2; ? form action=ini_set.php method=get input type=text name=test / input type=submit / /form This prints out $test, what it shouldn't do with register_globals turned off. I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is supposed to work according to the documentation. Can anyone tell me what I've done wrong? For some strange reason if I do echo ini_set('register_globals',0); it will print 10. For echo ini_set('register_globals','Off'); it will print 1Off. Jens PS: ini_set works fine with include_path and error_reporting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar
Can somone take a look at this? I found this on sourceforge, but cannot reach author. http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php This month won't display properly. It's missing /trtr somewhere. Every other month seems to work. Can someone help please? Here is the code: http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps The problem should be in here, but I can't see it: // Plancing day i on calendar if ($shift==0 $today_ts==$day_i_ts) { echo td bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td; } else { echo td bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n; if ($day_i==7 $i$daysInMonth) { echo /trtr\n; } else if ($day_i==7 $i==$daysInMonth) { echo /tr\n; } else if ($i==$daysInMonth) { for ($h=$dayMonth_end; $h7; $h++) { echo tdnbsp;/td\n; } echo /tr\n; } } //end else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar
Can somone take a look at this? I found this on sourceforge, but cannot reach author. http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php This month won't display properly. It's missing /trtr somewhere. Every other month seems to work. Can someone help please? Here is the code: http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps The problem should be in here, but I can't see it: // Plancing day i on calendar if ($shift==0 $today_ts==$day_i_ts) { echo td bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td; } else { echo td bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n; if ($day_i==7 $i$daysInMonth) { echo /trtr\n; } else if ($day_i==7 $i==$daysInMonth) { echo /tr\n; } else if ($i==$daysInMonth) { for ($h=$dayMonth_end; $h7; $h++) { echo tdnbsp;/td\n; } echo /tr\n; } } //end else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar
Can somone take a look at this? I found this on sourceforge, but cannot reach author. http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php This month won't display properly. It's missing /trtr somewhere. Every other month seems to work. Can someone help please? Here is the code: http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps The problem should be in here, but I can't see it: // Plancing day i on calendar if ($shift==0 $today_ts==$day_i_ts) { echo td bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td; } else { echo td bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n; if ($day_i==7 $i$daysInMonth) { echo /trtr\n; } else if ($day_i==7 $i==$daysInMonth) { echo /tr\n; } else if ($i==$daysInMonth) { for ($h=$dayMonth_end; $h7; $h++) { echo tdnbsp;/td\n; } echo /tr\n; } } //end else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar
Can somone take a look at this? I found this on sourceforge, but cannot reach author. http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php This month won't display properly. It's missing /trtr somewhere. Every other month seems to work. Can someone help please? Here is the code: http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.php http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/example.phps http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc http://www.collegesherbrooke.qc.ca/languesmodernes/calendar/BaseCalendar.inc.phps The problem should be in here, but I can't see it: // Plancing day i on calendar if ($shift==0 $today_ts==$day_i_ts) { echo td bgcolor=.($this-calBGCellToday).strongcenter.$link_i./center/strong/td; } else { echo td bgcolor=.($this-calBGCellColor).center.$link_i./center/td\n; if ($day_i==7 $i$daysInMonth) { echo /trtr\n; } else if ($day_i==7 $i==$daysInMonth) { echo /tr\n; } else if ($i==$daysInMonth) { for ($h=$dayMonth_end; $h7; $h++) { echo tdnbsp;/td\n; } echo /tr\n; } } //end else -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simulating a FORM POST thing (HELP!)
Rite, when you see a web form, you know you can simulate the submit by filling in the values in the address field, just like a GET method, and it usually works the exact same. But how do you do it when one of the fields in the form is a file upload?!?!?! For the record, its a GIF file you've to upload. Is there any way to do this in PHP?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simulating a FORM POST thing (HELP!)
?PHP $im = createfrombmp(image); print FORM METHOD=\post\ ACTION=\actionpage.php\; print INPUT TYPE=\hidden\ NAME=\image\ VALUE=\$im\; ? you get the idea I think PHP does have other funtions for file uplading though. Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rite, when you see a web form, you know you can simulate the submit by filling in the values in the address field, just like a GET method, and it usually works the exact same. But how do you do it when one of the fields in the form is a file upload?!?!?! For the record, its a GIF file you've to upload. Is there any way to do this in PHP?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 26 May 2002 20:04:59 -0000 Issue 1368
php-general Digest 26 May 2002 20:04:59 - Issue 1368 Topics (messages 99286 through 99317): PHP and JavaScript 99286 by: mp 99287 by: SP 99293 by: Vincent Kruger Re: please help!! 99288 by: Olexandr Vynnychenko Re: Need some advice concerning forms (multi select pulldown) and arrays 99289 by: Victor Spång Arthursson 99294 by: John Holmes 99296 by: Victor Spång Arthursson 99301 by: Victor Spång Arthursson 99303 by: Miguel Cruz Re: inspirational 99290 by: Michael Virnstein 99291 by: Michael Virnstein 99292 by: Michael Virnstein 99295 by: John Holmes arrays 99297 by: Michael Hall 99299 by: Michael Virnstein 99307 by: Philip Olson E-mail via WAP 99298 by: Rosen Re: NewBie-UPLOADING IMAGE 99300 by: Evan Re: Extract ZIP archives 99302 by: Analysis Solutions Re: 4.2.1 Vars 99304 by: Philip Olson regex help 99305 by: Jeff Field 99306 by: Miguel Cruz Parsing PHP output 99308 by: Mark 99309 by: Ray Hunter ini_set('register_globals',0) doesn't work 99310 by: Jens Lehmann Calendar 99311 by: jtjohnston 99312 by: jtjohnston 99313 by: jtjohnston 99314 by: jtjohnston Simulating a FORM POST thing (HELP!) 99315 by: Georgie Casey 99316 by: Peter 99317 by: Georgie Casey Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... ---End Message--- ---BeginMessage--- It worked for me, what error are you getting? In the other.html, did you have this? html head title/title script language=JavaScript src=script.php/script /head body /body /html -Original Message- From: mp [mailto:[EMAIL PROTECTED]] Sent: May 26, 2002 3:05 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP and JavaScript Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- You need to define the type of file you are creating. Like when you create wml pages with php. Header(Content-Type: text/javascript); or summing to that effect. have a look at www.weberdev.com Mp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... ---End Message--- ---BeginMessage--- Hello Jolly, Sunday, May 26, 2002, 10:58:45 AM, you wrote: JN Olexandr, JN ?PHP JN /* I can get the values from these */ JN foreach ($HTTP_POST_VARS as $var = $value) { JN echo $var = $valuebr\n; JN } JN /**/ JN /*however empty for this sentence*/ JN echo equals .($t1+$t2); JN /**/ JN echo form action='$PHP_SELF' METHOD='POST'\n; JN echo input type='text' name='t1'\n; JN echo input type='text' name='t2'\n; JN echo input type='submit' name='Submit' value='Submit'\n; JN echo /form/p\n; ? JN P.S. I have set register_globals = On, but still not work JN The attached files are my config files of php and apache! I looked through your configuration files and didn't notice any serious differences between them and my ones. I have PHP 4.2.1/Apache 2.0.36 on WinXP Pro. My register_globals was off. When I made it On your scipt worked properly. I don't know what the reason. What PHP you have? I attached my php.ini. Maybe you can find some important things. Another one question: does $PHP_SELF give proper value? It must not be set if register_globals=off. So if $PHP_SELF is set to some value, then global variables are registered. And the last question: why do you use global variables? It's much easier to use superglobal arrays $_POST, $_SERVER, etc. They guarantee that any values passed to your script won't be mixed. -- Best
[PHP] Re: Simulating a FORM POST thing (HELP!)
i'm getting an error message saying my BMP file i'm trying to convert isnt a valid WBMP file? is dere a difference between BMP and WBMP? I just opened my GIF file into PSP7 and and saved as a windows bmp. why isnt it working? Peter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ?PHP $im = createfrombmp(image); print FORM METHOD=\post\ ACTION=\actionpage.php\; print INPUT TYPE=\hidden\ NAME=\image\ VALUE=\$im\; ? you get the idea I think PHP does have other funtions for file uplading though. Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rite, when you see a web form, you know you can simulate the submit by filling in the values in the address field, just like a GET method, and it usually works the exact same. But how do you do it when one of the fields in the form is a file upload?!?!?! For the record, its a GIF file you've to upload. Is there any way to do this in PHP?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simulating a FORM POST thing (HELP!)
Windows Bitmap = BMP file a WBMP is a wireless bitmap image and is designed for display on mobile phones. A lot of software doesn't understand the format. You need to use createfrombmp() not createfromwbmp() Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i'm getting an error message saying my BMP file i'm trying to convert isnt a valid WBMP file? is dere a difference between BMP and WBMP? I just opened my GIF file into PSP7 and and saved as a windows bmp. why isnt it working? Peter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ?PHP $im = createfrombmp(image); print FORM METHOD=\post\ ACTION=\actionpage.php\; print INPUT TYPE=\hidden\ NAME=\image\ VALUE=\$im\; ? you get the idea I think PHP does have other funtions for file uplading though. Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rite, when you see a web form, you know you can simulate the submit by filling in the values in the address field, just like a GET method, and it usually works the exact same. But how do you do it when one of the fields in the form is a file upload?!?!?! For the record, its a GIF file you've to upload. Is there any way to do this in PHP?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Simulating a FORM POST thing (HELP!)
that function doest exist! Peter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Windows Bitmap = BMP file a WBMP is a wireless bitmap image and is designed for display on mobile phones. A lot of software doesn't understand the format. You need to use createfrombmp() not createfromwbmp() Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i'm getting an error message saying my BMP file i'm trying to convert isnt a valid WBMP file? is dere a difference between BMP and WBMP? I just opened my GIF file into PSP7 and and saved as a windows bmp. why isnt it working? Peter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ?PHP $im = createfrombmp(image); print FORM METHOD=\post\ ACTION=\actionpage.php\; print INPUT TYPE=\hidden\ NAME=\image\ VALUE=\$im\; ? you get the idea I think PHP does have other funtions for file uplading though. Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rite, when you see a web form, you know you can simulate the submit by filling in the values in the address field, just like a GET method, and it usually works the exact same. But how do you do it when one of the fields in the form is a file upload?!?!?! For the record, its a GIF file you've to upload. Is there any way to do this in PHP?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with Includes and Variables
Hey, im running Apache 2.0.36, and PHP 4.2.1, and im having problems with my site, which relies alot on includes. On each site page, it includes a file called global.php which contains the path's to the include folder, and various other directories needed. After that, it includes files for the site layout, which use variables from the global.php file. They all load fine, and in each included file, it is correctly processed by php, but for some reason, the variables that worked for including the files from global.php, aren't seen in the includes. Kinda get what im saying? I cant figure out how to have all the files first included, and then processed as one big file, instead of smaller files. Thanks! --Pete
[PHP] --NEWBIE-- T_String parse error ??
Hello all, I am new to PhP, and I just bought the Beginning PhP 4 book, and i got my first parse error, and I have no idea what it is i done wrong, cause its not covered in this book!!! this is the message i get: Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\example1.php on line 1 What does this mean? and how can i fix it? Thank you! Kevin J -- http://www.wishpocket.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] --NEWBIE-- T_String parse error ??
You probably missed a quote or something. Show us line 1. On Sun, 26 May 2002, Kevin J wrote: Hello all, I am new to PhP, and I just bought the Beginning PhP 4 book, and i got my first parse error, and I have no idea what it is i done wrong, cause its not covered in this book!!! this is the message i get: Parse error: parse error, unexpected T_STRING in c:\inetpub\wwwroot\example1.php on line 1 What does this mean? and how can i fix it? Thank you! Kevin J -- http://www.wishpocket.com -- 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] ini_set('register_globals',0) doesn't work
register_globals affects things that happen before PHP parsing begins, so by the time you get to your ini_set() it is too late. So no, that won't work. You need to set it in your php.ini, httpd.conf or .htaccess. -Rasmus On Sun, 26 May 2002, Jens Lehmann wrote: I tested ini_set('register_globals',0) and ini_set('register_globals','Off') for turning register_globals off. It doesn't work and it doesn't produce any notice, warning or error. Here's a quick example: ?php ini_set('register_globals',0); if(isset($test)) echo h2$test/h2; ? form action=ini_set.php method=get input type=text name=test / input type=submit / /form This prints out $test, what it shouldn't do with register_globals turned off. I tested this with PHP 4.1.2 and 4.2.1. Even if I start to doubt it is supposed to work according to the documentation. Can anyone tell me what I've done wrong? For some strange reason if I do echo ini_set('register_globals',0); it will print 10. For echo ini_set('register_globals','Off'); it will print 1Off. Jens PS: ini_set works fine with include_path and error_reporting -- 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] PHP and JavaScript
On Sun, 26 May 2002 10:05:03 +0300, mp wrote: Hi, php-general, I make this kind of PHP script(script.php): script.php ? $variable = Some some long long Text Blah blah; echo document.write(\.$variable.\); ? And in HTML (other.html) file I write: script language=JavaScript src=script.php/script But there is some mistake. Does anybody can help me? Thanks... make sure $variable doesn't have any newlines. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Pulling one record from a db(newbie)
In article 034501c2052b$0b8abed0$0100a8c0@JohnH, [EMAIL PROTECTED] says... Hi, I know how to use limit to pull 2 or more records out of a database. What I wish to do is only pull one record from a database. I am using the following query: $query = select * from news limit LIMIT $id, ++id; I get all sorts of parse errors and stuff. Please Help. Also is there a function to return only one record? JJ Harrison www.tececo.com [EMAIL PROTECTED] $query = select * from news LIMIT 1; and if you want a particular order you need to add ORDER BY (ASC or DESC) depending on your exact need. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variable to anti spam mailto script
Hello All, What is the best way (or opinions rather) to pass variables to a anti spam script. This is used in place of mailto links in webpages, but am looking for any simple way to pass information so more than one address can easily be used in the script, I could use mysql or other, however want to have something easier than this. Suggestions ? (please CC me if mailing to the list) , any examples ? ?PHP $mailto = 'mailto:[EMAIL PROTECTED]'; header(Location: $mailto); ? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Validating forms and showing errors
Hi everybody, This might be a RTFM or STFW-question, but I haven't found it. I want to validate a form (in page1.php) to check if the user has entered a correct email-adress and more, and if he needs to correct some fields, I'd like to display the form again with all correct values filled in and the incorrect fields hightlighted. To make it a bit more difficult I've decided to POST to another file (post.php) which validates the information and redirects the user (with Header - Location) to page1.php if he has to correct the errors. If the form is correctly filled in then he will be redirected to page2.php. This is to prevent the browser for asking him if he wants to repost data if he hits 'Refresh'. Now I want to know how to pass information from post.php to page1.php since the form page (page1) needs to know what was incorrect and what was correct so that it can hightlight the bad fields. I don't want to stick it in the URL since it would be too ugly, but I do have session variables I can stick them in. Is this the way to go? Or is there a better solution? I guess many of you have fought with this before so I know you can help me ;) Thanks in advance, Victor -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating forms and showing errors
These are the five methods I know of getting the data back to the original form. 1. Client side cookies 2. Server side cookies/session variables 3. URL 4. hidden form 5. submit back on yourself Take your pick Martin -Original Message- From: Victor Boivie [mailto:[EMAIL PROTECTED]] Sent: Monday, May 27, 2002 3:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Validating forms and showing errors Hi everybody, This might be a RTFM or STFW-question, but I haven't found it. I want to validate a form (in page1.php) to check if the user has entered a correct email-adress and more, and if he needs to correct some fields, I'd like to display the form again with all correct values filled in and the incorrect fields hightlighted. To make it a bit more difficult I've decided to POST to another file (post.php) which validates the information and redirects the user (with Header - Location) to page1.php if he has to correct the errors. If the form is correctly filled in then he will be redirected to page2.php. This is to prevent the browser for asking him if he wants to repost data if he hits 'Refresh'. Now I want to know how to pass information from post.php to page1.php since the form page (page1) needs to know what was incorrect and what was correct so that it can hightlight the bad fields. I don't want to stick it in the URL since it would be too ugly, but I do have session variables I can stick them in. Is this the way to go? Or is there a better solution? I guess many of you have fought with this before so I know you can help me ;) Thanks in advance, Victor -- 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] Parse Error(Newbie)
I know it is probably something obvious but the following gives me a parse error and as a newbie I am having trouble locating it. $query = "select * from news WHERE id = "$_get['id']""; JJ Harrison[EMAIL PROTECTED]www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error(Newbie)
$query = select * from news WHERE id = $_get['id']; you've got quotes within quotes - either change the inner quotes to single quotes, or escape them $query = select * from news WHERE id = '$_get[id]'; or $query = select * from news WHERE id = \$_get['id']\; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, May 27, 2002 3:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Parse Error(Newbie) I know it is probably something obvious but the following gives me a parse error and as a newbie I am having trouble locating it. $query = select * from news WHERE id = $_get['id']; JJ Harrison [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] www.tececo.com http://www.tececo.com
RE: [PHP] Parse Error(Newbie)
can you show us the lines above that line? say the previous 2 lines?.. also depending on what server your on you might want to try $query = SELECT * FROM news WHERE id = $_get['id']; but that line is ok ... with parse errors it's often, well i've found this any way, that it's the line above the line the message says it is.. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, 27 May 2002 3:47 PM To: [EMAIL PROTECTED] Subject: [PHP] Parse Error(Newbie) I know it is probably something obvious but the following gives me a parse error and as a newbie I am having trouble locating it. $query = select * from news WHERE id = $_get['id']; JJ Harrison [EMAIL PROTECTED] www.tececo.com
[PHP] Re: Parse Error(Newbie)
In article 003601c20541$fdc31970$0100a8c0@JohnH, [EMAIL PROTECTED] says... I know it is probably something obvious but the following gives me a parse error and as a newbie I am having trouble locating it. $query = select * from news WHERE id = $_get['id']; JJ Harrison [EMAIL PROTECTED] www.tececo.com $query = select * from news WHERE id = .$_get['id']; -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ora_Fetch_Into function problem
Hi to all; Finally i've set-up my AIX server with PHP and oracle support. Thanks for all who helps me for the configure setup. Now I have a problem in oracle function regarding the retrieval of entries in the oracle table. The Ora_Fetch_Into function doesnt work properly to me or i have an error in which i dont know. I've written below the code that i used to test, it doesnt echo the value of $name and $email. My query works if i've enter it manually with my Oracle server. I really dont know why im just a newbie with this database(oracle) statement. Please help us here. Thanks in advance. ?PutEnv(ORACLE_SID=PROD); PutEnv(ORACLE_HOME=/u01/app/oracle/product/7.3.3_prod); $connection = Ora_Logon(apps,apps); $cursor= Ora_Open($connection); $query = select * from mikecarel; $result = Ora_Parse($cursor,$query); $result=Ora_Exec($cursor); echotable border=1; echotrtdbFull Name/b/tdtdbEmail Address/b/td/tr; while(Ora_Fetch_Into($cursor,$values)){ $name = $values[0]; $email = $values[1]; echo trtd$name/tdtd$email/td/tr; } ora_close($cursor); ora_logoff($connection); ? Regards, mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Parse Error(Newbie)
-Original Message- I know it is probably something obvious but the following gives me a parse error and as a newbie I am having trouble locating it. $query = select * from news WHERE id = $_get['id']; -Original Message- Any time you end up with two characters together is a pretty good indication of where you problem is. You might try this: $query = SELECT * FROM news WHERE ID = ' . $_get['id'] . '; Alternately, and depending on what you're doing and why, it might be more effective to do this: $idstring = $_get['id']; $query = SELECT * FROM news WHERE ID = '$idstring'; Your choice... CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Validating forms and showing errors
I want to validate a form (in page1.php) to check if the user has entered a correct email-adress and more, and if he needs to correct some fields, I'd like to display the form again with all correct values filled in and the incorrect fields hightlighted. I tend to do this sort of thing using includes and a single page. If it's the first time being loaded (no post data) then just display the form. If it's been submitted then process the data and decide what to do from there. If there are errors, redisplay the form showing errors that need to be corrected. If there's no errors, move along to the next stage in the process. To make it a bit more difficult I've decided to POST to another file (post.php) which validates the information and redirects the user (with Header - Location) to page1.php if he has to correct the errors. If the form is correctly filled in then he will be redirected to page2.php. This is to prevent the browser for asking him if he wants to repost data if he hits 'Refresh'. That's a browser decision based on the existence of post data - in other words, just because the form posts to a different file doesn't mean that if you hit reload it won't re-post the data. hightlight the bad fields. I don't want to stick it in the URL since it would be too ugly, but I do have session variables I can stick them in. Is this the way to go? Or is there a better solution? There are ways to do it - cookies or hidden forms spring to mind - but first it's worth working out if the effort is worth it. It won't prevent a page refresh from re-posting data (although you could test for that in your php and deal with it accordingly). CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php