Re: [PHP] Still executing afte die()?
As I understand it, your situation is this: a) all your pages are named in lowercase b) if someone tries to access a non-existent page on your site (eg using a URI which is not fully lowercase) they'll hit your 404.php Correct. But if the page was all lowercase they wouldn't be hitting your 404.php page in the first place? Or am I missing something? They can still go to nonexistantpage.php. It cannot continue after a die(), unless there's a bug in PHP. If you still think that it does then post your full code and the circumstances under which it happens. Hmm, odd. When I try to duplicate it, I can't. Either this bug doesn't always happen, or I made a really dumb mistake, or something... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Avoiding Repeat Posts
Hi all, It seems that there might be some basic solution on this that I never received a memo on... Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? I've thought about using a unique visit id or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? I just don't know where to begin...any input is greatly appreciated. Thanks! Lewis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec() not exec-ing?
Jason Wong wrote... Try specifying the full path to the python binary and possibly the full path to ncMailer.py as well. Good suggestion! I switched everything over to absolute paths, as I should have done in the first place. Unfortunately, this didn't solve the problem. Still searching, gilrain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hello and help
Or to make it easy, here's the line you need: $info = mysql_fetch_array( $result ); Put that line right after the query. So, here's sample: $Link=mysql_pconnect($Host, $User, $Password); $db=mysql_select_db($DBname, $Link); $query=mysql_query(SELECT * from calendar, $Link); $result = mysql_fetch_array( $query ); print $result[meeting]; You can also use Objects: $result = mysql_fetch_object( $query ); print $result-meeting; If you're getting more than one line, you need to fetch each row. For example: $query = mysql_query( select * from capitals ); while ( $a_row = mysql_fetch_array( $query ) ) { print $a_row[capital] is the capital of $a_row[country]br\n; } Hope this helps! Lewis Todd Barr [EMAIL PROTECTED] wrote in message 00df01c2b388$b6e48930$6e20280a@ff">news:00df01c2b388$b6e48930$6e20280a@ff... I am a PHP newbie, and I am having difficulty in getting my records to display here is my code ?php $Host=localhost; $User=us34992a; $Password=*; $DBname=db34992a; $Tablename=calendar; $Link=mysql_pconnect($Host, $User, $Password) or die (YOu suck1); $db=mysql_select_db($DBname, $Link) or die (ISUCKEGGS); $result=mysql_query(SELECT * from calendar, $Link) or die (YOu suck3); print(table width=53% border=0 cellpadding=0 cellspacing=0\n); print (tr\n); print (td background=topbig.gif\n); print (div align=centerfont face=Arial, Helvetica, sans-serifbfont color=#FFCalender/font/b/font/div /td /tr\n); print (tr bgcolor=#009ACE\n); print(td$result[meeting_name]/td\n)or die (you suck); mysql_close ($Link); ? any help? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec() not exec-ing?
On Saturday 04 January 2003 16:29, gilrain wrote: Try specifying the full path to the python binary and possibly the full path to ncMailer.py as well. Good suggestion! I switched everything over to absolute paths, as I should have done in the first place. Unfortunately, this didn't solve the problem. Does the webserver have permission to: (a) execute the python binary (b) access and read ncMailer.py -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A man's house is his hassle. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: Hi all, It seems that there might be some basic solution on this that I never received a memo on... it's been mentioned MANY times on the list in the last week :) Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? when generating the form, include a hidden field which has a unique, random value. then the script that recieves/validated the post should check that the value doesn't already exist in the database before inserting... the only way someone can double-post is by actually refreshing the form (thus getting a new hidden field. I've thought about using a unique visit id or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? they can still go back after a redirect... it's just pages in the browser cache... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
I did searches on this one...I'm using NNTP so it's nice...unfortunatly, no one had quite the same problem. I had thought about the random value already (see paragraph about unique visit id), but it just seems like so much to keep track of... After asking on other board on the same topic, one theme seems to be the same...just use redirects. If anyone else is having the same issue, you can do a redirect using the PHP header() function to send the user directly to the next page. If the user goes back, they will get a new version of the form, and less browsers will support resubmitting. Also, on the same note, if anyone is using buttons as links, make sure you are using an input type=hidden onclick=window.location='http://whatever' command instead of submitting a form with no fields. This will solve the problem here. Lewis Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: Hi all, It seems that there might be some basic solution on this that I never received a memo on... it's been mentioned MANY times on the list in the last week :) Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? when generating the form, include a hidden field which has a unique, random value. then the script that recieves/validated the post should check that the value doesn't already exist in the database before inserting... the only way someone can double-post is by actually refreshing the form (thus getting a new hidden field. I've thought about using a unique visit id or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? they can still go back after a redirect... it's just pages in the browser cache... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec() not exec-ing?
Jason Wong wrote: Does the webserver have permission to: (a) execute the python binary (b) access and read ncMailer.py Thanks for all the help! I really appreciate it. :) Hm, I'm actually not sure if my host allows that. This could definitely be the problem. Is there a simple way to find out, other than asking? For now, my guess is I can only execute the file from my cgi-bin directory. Okay, we're a step closer to victory. I can run the script, via a web browser, through my cgi-bin. Unfortunately, this kind of defeats to purpose! This is no better than my original PHP script, since it too will hang the browser on long operations. I'm back to square one, if I can't run that script without the browser waiting on it to finish... Any ideas, given this new situation? gilrain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec() not exec-ing?
I'm back to square one, if I can't run that script without the browser waiting on it to finish... For instance, is there a way for my PHP script to log into my shell account and *then* send the command? Since I can execute the script, but PHP can't, this would solve the problem -- if it's possible. gilrain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MySQL bug
Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Actually, there is a different solution to this aswell. One that is used by phpBB and XMB, and maybe some others aswell. Basicly, it's an anti-flood system. It works like this: - You are a member and logged in You post, and the post gets inserted into the database, and with it, also the time of posting is kept. When you post the next thing, the script checks if there was a message posted, by that user in the last X seconds (can be set manually). If so, it will return a message saying not to repost stuff. Otherwise, it just continues... Hope this helps, - Tularis XMB Lead Developer Orangehairedboy wrote: I did searches on this one...I'm using NNTP so it's nice...unfortunatly, no one had quite the same problem. I had thought about the random value already (see paragraph about unique visit id), but it just seems like so much to keep track of... After asking on other board on the same topic, one theme seems to be the same...just use redirects. If anyone else is having the same issue, you can do a redirect using the PHP header() function to send the user directly to the next page. If the user goes back, they will get a new version of the form, and less browsers will support resubmitting. Also, on the same note, if anyone is using buttons as links, make sure you are using an input type=hidden onclick=window.location='http://whatever' command instead of submitting a form with no fields. This will solve the problem here. Lewis Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote: Hi all, It seems that there might be some basic solution on this that I never received a memo on... it's been mentioned MANY times on the list in the last week :) Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? when generating the form, include a hidden field which has a unique, random value. then the script that recieves/validated the post should check that the value doesn't already exist in the database before inserting... the only way someone can double-post is by actually refreshing the form (thus getting a new hidden field. I've thought about using a unique visit id or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? they can still go back after a redirect... it's just pages in the browser cache... Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript broken!
Adam Wilson wrote: I am beginning a tidy-up of a very messy site i am now managing. I have started splitting repeated sections into single header and footer files, for inclusion via php. Unfortunately the javascript no longer works, i.e. rollovers etc. Can someone please help me on this? Is this a known problem? it's a fairly standard thing to do most likely editing the files has introduced errors. -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Why not create a unique constraint with the userid, day (without time) and post content. Is it going in a DB? Mike *** REPLY SEPARATOR *** On 04/01/2003 at 3:26 AM OrangeHairedBoy wrote: Hi all, It seems that there might be some basic solution on this that I never received a memo on... Basically, I'm looking for a way to avoid repeat posts. If someone, for example, adds something to a bulletin board, clicks submit, and then presses F5, they're just 1 click away from re-submitting the form and posting the same information for a second time. Is there an easy way to avoid this? I've thought about using a unique visit id or something which gets triggered when a visitor posts, but that seems like a lot to do... Also, do you think I should look into redirecting the user once they've posted so they can't go back? I just don't know where to begin...any input is greatly appreciated. Thanks! Lewis -- 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 MySQL bug
I cant give you a solution, and I''m running on Linux. But I have pages were I do 6-7 queries on one page always using the same connection. Never had a problem with that. Mike *** REPLY SEPARATOR *** I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to determine if the output has been flushed normally...
Hi, I'm dealing with the following issue: how to determine whether the current page request has been responded normally, eg. output has been sent to the browser as regular, or just a redirection header sent to it header('Location: '); ? Some words about the background: This functinality would be implemented in my error handler class which does not depend on any application framework, or programming style, or whatsoever. And it must be used within a callback function by nature of error-handling. So I'm seeking for a native PHP solution (mostly a function), but any suggestions are welcome. -- gerzson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP vs. ASP
Hi! How does PHP differs from ASP? Are there any advantages in using PHP over ASP? Or the other way around? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to determine if the output has been flushed normally...
Hi, I'm dealing with the following issue: how to determine whether the current page request has been responded normally, eg. output has been sent to the browser as regular, or just a redirection header sent to it header('Location: '); ? Some words about the background: This functinality would be implemented in my error handler class which does not depend on any application framework, or programming style, or whatsoever. And it must be used within a callback function by nature of error-handling. So I'm seeking for a native PHP solution (mostly a function), but any suggestions are welcome. -- gerzson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REPOST: installation problems (php 4.2.3/mcrypt/curl)
repost [no response] I searched MARC first, but none of the answers there seemed to work. I have noticed similar issues on there, but the only answers are make sure you compiled with package X. Installing: RH 8 Apache 1.3.27 (--prefix --enable-module=so) PHP 4.2.3 (--with-apxs --enable-ftp --with-esoob --with-mcrypt --with-curl --with-openssl) Openssl 0.9.7 Mcrypt 2.5.3 (--disable-posix-threads) Curl 7.10.2 (--enable-ftp --enable-http --with-ssl) No errors during installation. Apache/PHP loads without error. phpinfo shows mcrypt and curl support, yet both error out on basic functions (mcrypt_module_open, curl_init)(PHP Fatal Error: call to undefined function...) mcrypt support enabled version = 2.4.x Supportedciphers twofish rijndael-128 rijndael-192 rijndael-256 saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 gost threeway cast-128 blowfish des blowfish-compat tripledes enigma arcfour panama wake Supported modes ofb cfb nofb cbc ecb stream ncfb ctr mcrypt.algorithms_dir /usr/local/lib/libmcrypt mcrypt.modes_dir /usr/local/lib/libmcrypt CURL support enabled CURL Information libcurl/7.10.2 OpenSSL/0.9.6b zlib/1.1.4 Any help appreciated. mike --- This email sent using CDM Sports Webmail v3.1 [ http://webmail.cdmsports.com ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with preg_match
Hi, I'm trying to write a function that validates the input in a textarea. I just want to allow alphanumrical characters, and if the user enters anything else, I display an error message by calling error(). But the following doesn't work. Even if I enter hello in the textarea, I get the error message. What am I missing? // validate entered text in textarea function validate_textarea($unchecked_text) { if (!preg_match (/^[a-zåäö0-9]$/is, $unchecked_text)) { error(You have used unlegal characters, just alphanumeric is ok.); } } Best regards, Anders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] security in guest book and user forums
I've seen both guest books and user forums hacked by users who enter javascript or other code, and that way redirects vistors to other sites or do other unwelcome things. What expressions should I look for and not allow in my forms? Best regards, Anders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
How about saving a timestamp when the user posts a message and when he posts another message check whether the user already posted a message in the past, let's say, minute. I saw this used in a lot of forums... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP vs. ASP
Anthony Rodriguez [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... How does PHP differs from ASP? search google on php vs asp ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with preg_match
You need to tell preg_match that there will be multiple characters. Right now, you're searching for one, and only one. if (! preg_match ('/^[a-z0-9]+$/', $unchecked_text)) { The + means one or more matches to the range in brackets. -- tracy On 1/4/03 9:03 AM, Anders Thoresson [EMAIL PROTECTED] wrote: Hi, I'm trying to write a function that validates the input in a textarea. I just want to allow alphanumrical characters, and if the user enters anything else, I display an error message by calling error(). But the following doesn't work. Even if I enter hello in the textarea, I get the error message. What am I missing? // validate entered text in textarea function validate_textarea($unchecked_text) { if (!preg_match (/^[a-zåäö0-9]$/is, $unchecked_text)) { error(You have used unlegal characters, just alphanumeric is ok.); } } Best regards, Anders -- Tracy F. Rotton [EMAIL PROTECTED] http://www.taupecat.com/ ... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat. -- Lisa Simpson, Lisa the Greek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upgrading WAMP environment
I've been using Apache, MySQL and PHP under Win2k for a while to learn PHP. At the moment, I'm running PHP 4.2.2, MySQL 3.23.39 and Apache 2.0.40. During the holidays, I've read about a security hole in MySQL and therefore plans to upgrade to 3.23.54a. At the same time, I want to install PHP 4.3.0 and Apache 2.0.43. But when I started to look for upgrading instructions for each software package, I find nothing. Therefore, I would like to know how to perform an upgrade of each package? Should the MySQL and Apache deamons be stopped first? Should I install into my current directories? Will my config files be overwritten? Does it matter which of the three I upgrade first? What more should I keep in mind? If questions like these are considered off topic, please let me know. Best regards, Anders -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Avoiding Repeat Posts
Michael J. Pawlowsky wrote: Why not create a unique constraint with the userid, day (without time) and post content. Is it going in a DB? Index on text columns does not seem very efficient, IMHO. If he wants to avoid multiple inserts, the random unique ID is enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REPOST: installation problems (php 4.2.3/mcrypt/curl)
Might or might not be helpful.. but I had the same thing happend when I added --with-jpeg-dir=/usr/lib Everything looked fine... but I could not call imagejpeg. (PHP 4.3 - RH8 - apache2) Once I did a make clean, ./configure -with- ... , make, make test (to see if it had jpg), make install It worked. It really needed to have that make clean done first. Don't know if this will help you or not. Mike *** REPLY SEPARATOR *** On 04/01/2003 at 9:48 AM Michael Geier wrote: phpinfo shows mcrypt and curl support, yet both error out on basic functions (mcrypt_module_open, curl_init)(PHP Fatal Error: call to undefined function...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
You really should be using a $link variable...it's good habit: $link = mysql_connect(...); mysql_select_db( mydb , $link); $query = mysql_query( select... , $link ); $result = mysql_fetch_array($query); Lewis Nuno Lopes [EMAIL PROTECTED] wrote in message 003a01c2b3de$95004650$0100a8c0@pc07653">news:003a01c2b3de$95004650$0100a8c0@pc07653... Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: exec() not exec-ing?
Just in case any of you are still watching this thread, I thought I should post the exciting conclusion! Not too exciting, actually. In the end, I've simply added my Python script to crontab. It runs every 20 minutes, and if the mailing file has changed, it sends out the e-mails. Pretty simple, and actually what I was first advised. Pity I thought I could find a better way. ;) Thanks to everyone who helped me out! I learned a lot, so it was worth my screw-ups. gilrain -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
Personally I say get yourself a good simple dbconnect class and make life easy. Also if you ever change users, database name etc, you onlu have one place to replace it in your code. I wrote mine based on http://www.vtwebwizard.com/tutorials/mysql/ Take a look at it. Nice and simple. Mike *** REPLY SEPARATOR *** On 04/01/2003 at 1:09 PM OrangeHairedBoy wrote: You really should be using a $link variable...it's good habit: $link = mysql_connect(...); mysql_select_db( mydb , $link); $query = mysql_query( select... , $link ); $result = mysql_fetch_array($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 4 Jan 2003 18:21:57 -0000 Issue 1803
php-general Digest 4 Jan 2003 18:21:57 - Issue 1803 Topics (messages 130209 through 130241): Re: true ip tracking 130209 by: electroteque 130212 by: Jason Wong Re: Still executing afte die()? 130210 by: Jason Wong 130213 by: Leif K-Brooks Re: exec() not exec-ing? 130211 by: Jason Wong 130215 by: gilrain 130217 by: Jason Wong 130220 by: gilrain 130221 by: gilrain 130240 by: gilrain Avoiding Repeat Posts 130214 by: OrangeHairedBoy 130218 by: Justin French 130219 by: OrangeHairedBoy 130223 by: Tularis 130225 by: Michael J. Pawlowsky 130233 by: Charles likes PHP 130237 by: Gyozo Papp Re: Hello and help 130216 by: OrangeHairedBoy PHP and MySQL bug 130222 by: Nuno Lopes 130226 by: Michael J. Pawlowsky 130239 by: OrangeHairedBoy 130241 by: Michael J. Pawlowsky Re: Javascript broken! 130224 by: Sean Burlington how to determine if the output has been flushed normally... 130227 by: Gyozo Papp 130229 by: Gyozo Papp PHP vs. ASP 130228 by: Anthony Rodriguez 130234 by: Leon Mergen REPOST: installation problems (php 4.2.3/mcrypt/curl) 130230 by: Michael Geier 130238 by: Michael J. Pawlowsky help with preg_match 130231 by: Anders Thoresson 130235 by: Tracy Finifter Rotton security in guest book and user forums 130232 by: Anders Thoresson upgrading WAMP environment 130236 by: Anders Thoresson 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--- its a bit tedious to make anonymous visotors register on the site to vote a poll , so there is no other workaround then ? Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Saturday 04 January 2003 12:38, electroteque wrote: hi i was wondering if there was a way to get the clients ip's behind proxies that hide the HTTP_X_FORWARDED_FOR header ? No. this is most important for checking ips for polls except some proxies dont send this important header ?? It's not that important. In many cases it could very well be a private IP address and hence of dubious value. If the accuracy of the poll is important then only let registered and logged in users take part in the poll. Even then, depending on your registration procedures, you may have people registering multiple times to cast multiple votes. In short there is no surefire way of preventing people from voting more than once. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* From there to here, from here to there, funny things are everywhere. -- Dr. Seuss */ ---End Message--- ---BeginMessage--- On Saturday 04 January 2003 14:32, electroteque wrote: its a bit tedious to make anonymous visotors register on the site to vote a poll , so there is no other workaround then ? No. You could make them people pay a substantial sum of money for each vote they place -- that'll make them think twice before putting in multiple votes :) But seriously, look in the archives the hows and whys have been covered quite comprehensively in the past. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* VMS is like a nightmare about RXS-11M. */ ---End Message--- ---BeginMessage--- On Saturday 04 January 2003 13:44, Leif K-Brooks wrote: As I understand it, your situation is this: a) all your pages are named in lowercase b) if someone tries to access a non-existent page on your site (eg using a URI which is not fully lowercase) they'll hit your 404.php But I only want it to insert if the page was all lowercase when they went to it. But if the page was all lowercase they wouldn't be hitting your 404.php page in the first place? Or am I missing something? I understand it continuing after redirecting, but why after die()ing too? Putting the insert code into an else statment solved the problem, but it's ugly, and the question still remains... why does it do this? It cannot continue after a die(), unless there's a bug in PHP. If you still think that it does then post your full code and the circumstances under which it happens. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* My nose feels like a bad Ronald Reagan movie ... */ ---End Message--- ---BeginMessage--- As I understand it, your
[PHP] No Global Code Fixing
Well I've been fixing up all my code (and other peoples which is worst) getting ready to do an upgrade to 4.3. and turning off globals and warnings on. I very often move parameters that were once POSTed as a GETs. For instance... some one does a search but is not logged in, they can see the results but don's see the Edit results button. So they log in, and I send them back to the search they just did. The first search is done by a POST and when I redirect them after the login it's done by a GET. So I use to simply not specify if it was a GET or POST and looked to see if the var existed or not to see how to load that page. Now I've been adding alot of: if (isset($_POST['keyword'])){ $keyword = $_POST['keyword']; }elseif (isset($_GET['keyword'])){ $keyword = $_GET['keyword']; } else { unset($keyword); } I suppose I could also do something like this (which is not much different) if(isset($_POST['keyword']) || isset($_GET['keyword'])){ $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword']; }else{ unset($keyword); } I guess I could get rid of the unset, but I like it there just in case something earlier filled that puppy. So I end up with alot of these right now at the top of each page. Especially if the URI is something like http:www.mysite.com/index.php?this=thatid=1lang=enso=onso=onso=onso=onso=onso=on Know what I mean? So just wondering if anyine had something really elegant to replace it. Cheers, Mike
[PHP] Re: security in guest book and user forums
Anders Thoresson wrote: I've seen both guest books and user forums hacked by users who enter javascript or other code, and that way redirects vistors to other sites or do other unwelcome things. What expressions should I look for and not allow in my forms? I use the htmlspecialchars() function to disable all html. This function basically puts a '\' in front of eacht html character and thus disables all html. You may not want to do this if you want to allow, for example b/b or other friendly html. If so you can use a regex to disable the script or /table tags. Now that I think about it, it might be better to disable all html and later enable i,b etc (or define your own, like a lot of forums seem to do). -Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Global Code Fixing
Why don't you just use $_REQUEST['keyword'] ? On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote: Well I've been fixing up all my code (and other peoples which is worst) getting ready to do an upgrade to 4.3. and turning off globals and warnings on. I very often move parameters that were once POSTed as a GETs. For instance... some one does a search but is not logged in, they can see the results but don's see the Edit results button. So they log in, and I send them back to the search they just did. The first search is done by a POST and when I redirect them after the login it's done by a GET. So I use to simply not specify if it was a GET or POST and looked to see if the var existed or not to see how to load that page. Now I've been adding alot of: if (isset($_POST['keyword'])){ $keyword = $_POST['keyword']; }elseif (isset($_GET['keyword'])){ $keyword = $_GET['keyword']; } else { unset($keyword); } I suppose I could also do something like this (which is not much different) if(isset($_POST['keyword']) || isset($_GET['keyword'])){ $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword']; }else{ unset($keyword); } I guess I could get rid of the unset, but I like it there just in case something earlier filled that puppy. So I end up with alot of these right now at the top of each page. Especially if the URI is something like http:www.mysite.com/index.php?this=thatid=1lang=enso=onso=onso=onso=onso=onso=on Know what I mean? So just wondering if anyine had something really elegant to replace it. Cheers, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Global Code Fixing
I just found a better answer, but still open to suggestions with the URI : http://rc.mikeathome.net/test/index.php?one=1two[]=2two[]=3three=3key=This%20is%20the%20key I tried this: ?php if (isset($_GET)){ foreach($_GET as $key = $value){ ${$key}=$value; } echo $one; echo br; print_r($two); echo /br; echo $three . br\n; echo $key; } ? Result: - 1 Array ( [0] = 2 [1] = 3 ) 3 This is the key And that actually worked... I can live without the unset()'s. Just need to add the same for POST and do an include with it. Anyone have a better idea? *** REPLY SEPARATOR *** On 04/01/2003 at 1:22 PM Michael J. Pawlowsky wrote: So just wondering if anyone had something really elegant to replace it. Cheers, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: security in guest book and user forums
most forums do this ?php htmlentities($input); --save input -- get output if($html == 'on'){ $output = hymlentities_decode($output); } print($output); exit(); ? Seraphim wrote: Anders Thoresson wrote: I've seen both guest books and user forums hacked by users who enter javascript or other code, and that way redirects vistors to other sites or do other unwelcome things. What expressions should I look for and not allow in my forms? I use the htmlspecialchars() function to disable all html. This function basically puts a '\' in front of eacht html character and thus disables all html. You may not want to do this if you want to allow, for example b/b or other friendly html. If so you can use a regex to disable the script or /table tags. Now that I think about it, it might be better to disable all html and later enable i,b etc (or define your own, like a lot of forums seem to do). -Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mssql functions
Hi, i need the php mssql functions, but php is not configured --with-mssql on my server. What options do i have to enable this? I mean, if i need the mssql-functions, does the client (as stated in the php manual) have to be installed, or can i use s.th. dynamical and load it at runtime? S.o. mentioned to use a mssql.so with the php dl command, but regarding the client isn't installed on the server, would it work then? btw: with client i mean Sybase's OpenClient or FreeTDS. Regards, Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Global Code Fixing
Hey that's great... I didn't know about $_REQUEST I suppose the order of overlapping is set in php.ini I think I saw that somewhere. Thanks As for tunring it back on... in .htaccess I like the idea of having cleaner code *** REPLY SEPARATOR *** On 04/01/2003 at 11:37 AM Rasmus Lerdorf wrote: Why don't you just use $_REQUEST['keyword'] ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Global Code Fixing
NOTE: this basicly mimics the way register_globals works. I use this code to fix register_globals aswell as the magic_quotes_gpc: $global = @array($_SESSION, $_SERVER, $_COOKIE, $_POST, $_GET, $_FILES, $_ENV); $global_old = @array($HTTP_SESSION_VARS, $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_FILES_VARS, $HTTP_ENV_VARS); if(!$global[1]){ $global = $global_old; } if(!@ini_get('magic_quotes_gpc')){ foreach($global as $array){ if(is_array($array)){ foreach($array as $key=$val){ $$key = addslashes($val); } } } }else{ foreach($global as $array){ if(is_array($array)){ foreach($array as $key=$val){ $$key = $val; } } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Global Code Fixing
If you do that you might as well just turn on register globals, you should look at the $_REQUEST variable, it combines $_POST, $_GET and $_COOKIE into one array so you can just reference $_REQUEST['variable'] for example $_REQUEST['one']. Jason On Sat, 2003-01-04 at 11:50, Michael J. Pawlowsky wrote: I just found a better answer, but still open to suggestions with the URI : http://rc.mikeathome.net/test/index.php?one=1two[]=2two[]=3three=3key=This%20is%20the%20key I tried this: ?php if (isset($_GET)){ foreach($_GET as $key = $value){ ${$key}=$value; } echo $one; echo br; print_r($two); echo /br; echo $three . br\n; echo $key; } ? Result: - 1 Array ( [0] = 2 [1] = 3 ) 3 This is the key And that actually worked... I can live without the unset()'s. Just need to add the same for POST and do an include with it. Anyone have a better idea? *** REPLY SEPARATOR *** On 04/01/2003 at 1:22 PM Michael J. Pawlowsky wrote: So just wondering if anyone had something really elegant to replace it. Cheers, Mike -- 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] One more form question
-Original Message- From: David Chamberlin To: [EMAIL PROTECTED] Is there an easy way to set something in a select list to be selected? Right now I'm doing a real brute-force method. e.g., echo tdselect name=\disp_address\; $choices = array( 'pub' = 'On Public Page', 'members' = 'Only on Members Page', 'nodisp' = 'Do not Display' ); foreach ( $choices as $key = $choice ) { $selected = ''; if ( strcmp( $key, $member_info-display_address ) == 0 ) { $selected = 'selected'; } echo option value=\$key\ $selected$choice; } echo '/select/td'; -- Well, that's pretty much how to do it. I'd really only query the expense of a call to strcmp(), rather than just doing a straight comparison. And I'd tend to do the if in-line where required, rather than assigning to an intermediate variable. Which gives you this: foreach ( $choices as $key = $choice ) { echo option value=\$key\ if ($key==$member_info-display_address) { echo 'selected'; } echo $choice/option; } Actually, I often wrap the selected test into a ?: operator, so you get something like this: foreach ( $choices as $key = $choice ) { echo option value=\$key\ . . ($key==$member_info-display_address?'selected':'') . $choice/option; } Also, the suggestion of turning this whole thing into a function is a good one, if that works for you. Cheers! Mike Ford -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and MySQL bug
Personally I think the problem lies somewhere between the chair and the keyboard (Sorry, couldn't resist) :-) *** REPLY SEPARATOR *** On 04/01/2003 at 4:58 PM Stefan Hinz, iConnect (Berlin) wrote: It doesn't work because of the /* Some code including ... */ part ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security in guest book and user forums
On Sunday 05 January 2003 01:16, Anders Thoresson wrote: I've seen both guest books and user forums hacked by users who enter javascript or other code, and that way redirects vistors to other sites or do other unwelcome things. What expressions should I look for and not allow in my forms? Disallow all HTML tags by using strip_tags(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* A dirty mind is a joy forever. -- Randy Kunkee */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] You gotta love it...
When doing a function seach at www.php.net I just got: Parse error: parse error in /local/Web/sites/phpweb/search.php on line 233 Twice in a row... Maybe they will be posting us a question soon!! :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] You gotta love it...
Well, we're all human. On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote: When doing a function seach at www.php.net I just got: Parse error: parse error in /local/Web/sites/phpweb/search.php on line 233 Twice in a row... Maybe they will be posting us a question soon!! :-) -- 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] Re: [PEAR-DEV] Announcing open CVS for phpDocumentor project
Hi all, open cvs has been fixed. Use at will Take care, Greg Jesus M. Castagnetto [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... It does not seem to be working at the moment. --- Greg Beaver [EMAIL PROTECTED] wrote: Hello all, Josh Eichorn has just finished setting up an open cvs for the phpDocumentor project (http://www.phpdoc.org). To get a current cvs build, use this command: cvs -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot login don't enter a password, then cvs -z 3 -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot co phpdoc I got: ... U phpdoc/Documentation/Release-old/Release-1.1.0rc1 U phpdoc/Documentation/Release-old/Release-1.1.0rc2 cvs server: Updating phpdoc/Documentation/old cvs server: failed to create lock directory for `/opt/cvsroot/phpdoc/Documentation/old' (/opt/cvsroot/phpdoc/Documentation/old/#cvs.lock): Permission denied cvs server: failed to obtain dir lock in repository `/opt/cvsroot/phpdoc/Documentation/old' cvs [server aborted]: read lock failed - giving up ... Seems like the repository is messed up. = --- Jesus M. Castagnetto ([EMAIL PROTECTED]) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I can't code today to save my life! :(
I have $REQUEST_URI that will take two values: /event/login.php and /event/register.php What I need to do is so simple it's brainless!!! I need to look into $REQUEST_URI and find if it contains register.php. I tried this and it completely failed, the results were wrong every time: if (strpos($REQUEST_URI, register.php) !== 0) { // you're in login.php } I don't know why I can't get this other than weekend stupidity, can someone help? Thanx Phil
Re: [PHP] I can't code today to save my life! :(
At 22:21 4-1-2003, you wrote: completely failed, the results were wrong every time: if (strpos($REQUEST_URI, register.php) !== 0) { // you're in login.php } try if (!strpos($REQUEST_URI, register.php) === FALSE) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I can't code today to save my life! :(
try if(stristr($_SERVER['REREQUEST_URI'], register.php){ echo at register; } else { echo Not; } Not tested but should work.. also case insensitive now... *** REPLY SEPARATOR *** On 04/01/2003 at 4:21 PM Phil Powell wrote: I have $REQUEST_URI that will take two values: /event/login.php and /event/register.php What I need to do is so simple it's brainless!!! I need to look into $REQUEST_URI and find if it contains register.php. I tried this and it completely failed, the results were wrong every time: if (strpos($REQUEST_URI, register.php) !== 0) { // you're in login.php } I don't know why I can't get this other than weekend stupidity, can someone help? Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I can't code today to save my life! :(
I must be doibg drugs with all those typos... Typos removed: ?php if(stristr($_SERVER['REQUEST_URI'], register.php)){ echo at register; } else { echo Not; } ? *** REPLY SEPARATOR *** On 04/01/2003 at 4:43 PM Michael J. Pawlowsky wrote: try if(stristr($_SERVER['REREQUEST_URI'], register.php){ echo at register; } else { echo Not; } Not tested but should work.. also case insensitive now... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and MySQL bug
Nuno, $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work!*/ It doesn't work because of the /* Some code including ... */ part ;-) First thing, I would check if $h and $id really are what you expect them to be, like: $sql = UPDATE d SET h='$h' WHERE id='$id'; echo $sql; MYSQL_QUERY($sql); If this part is okay, then the problem lies within this myterious /* Some code */. Regards, -- Stefan Hinz [EMAIL PROTECTED] Geschäftsführer / CEO iConnect GmbH http://iConnect.de Heesestr. 6, 12169 Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: Nuno Lopes [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, January 04, 2003 11:46 AM Subject: PHP and MySQL bug Dear Sirs, I'm using PHP and MySQL to make my programs. But I think I discovered a bug in PHP or in MySQL (I don't know!). In one of my files I have the following: MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); $r=MYSQL_QUERY(SELECT n,u,m,h FROM d WHERE id='$id'); /* Some code including mysql_num_rows and mysql_fetch_array($r, MYSQL_NUM) And the another query: */ MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); /* i don't know why but this doesn't work! But if I close the connection and open another te query is done:*/ MYSQL_CLOSE(); MYSQL_CONNECT(localhost, **user**, **pass**); mysql_select_db(be); MYSQL_QUERY(UPDATE d SET h='$h' WHERE id='$id'); --- I don't know why is this? Because I'm used to do more than a query per connection and this never happened! I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3. I hope you solve this, Nuno Lopes - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upgrading WAMP environment
Anders -- ...and then Anders Thoresson said... % % I've been using Apache, MySQL and PHP under Win2k for a while to learn % PHP. At the moment, I'm running PHP 4.2.2, MySQL 3.23.39 and Apache 2.0.40. Good for you! All you have left to do is upgrade to Linux ;-) % % During the holidays, I've read about a security hole in MySQL and I haven't seen this one... If the list isn't interested, could you at least send me a pointer? % therefore plans to upgrade to 3.23.54a. At the same time, I want to install % PHP 4.3.0 and Apache 2.0.43. Sounds like fun. % % But when I started to look for upgrading instructions for each software % package, I find nothing. Yeah. Generally just think of it as a fresh install instead of an upgrade. If I were you, I would - shut down mysqld and httpd - make a backup, of course - save your configs for each (did you install the utils originally?) - remove all three - install apache - install mysql - install php - install perl ;-) I say that because the web server is the base and mysql may tie into it; then you load mysql so php can see both it and the web server; then you drop in php (and the same for perl and mod_perl :-) You should be fine with the installation instructions for each. When in doubt, you might try the mailing lists for each, but I know that they are all supposed to go in together. HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg91603/pgp0.pgp Description: PGP signature
[PHP] counter problem
The following script is found in Matt Zandstra's book on PHP (Sams) on page 160. He's explaining forms with PHP and has hard coded a value - 42. He also is explaining a hidden fleld where the user can submit the number and each time the user hits submit in the formbox, the counter will register the total number of guesses. However, after running this script and submitting the number, I get: Guess number: 0 \ submit again and... Guess number: 0 \\, etc... instead of: Guess number: 1 Guess numver : 2 etc... Thanking all in advance. Tony Ritter .. ? $numtoguess=42; $num_tries=(isset($num_tries)) ? $num_tries++ : 0; $message=; if(!isset($guess)) $message=Welcome to the guessing machine; elseif ($guess$numtoguess) $message=Your guess was too low.; elseif ($guess$numtoguess) $message=Your guess was too high.; else $message=That is the correct number.; $guess=(int)$guess; ? HTML BODY H1 ? print $message ? /H1 Guess number: ?print $num_tries? FORM METHOD=post Type your guess here:BR INPUT TYPE =text NAME=guess VALUE=?print $guess? INPUT TYPE =hidden NAME=num_tries VALUE=? print $num_tries? INPUT TYPE=submit VALUE=submit it! /FORM /BODY /HTML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Second (Bizarre) Question regarding PHP and ASP
I don't know how to post this one so I'm sorry for such bizarre cross-posting, but honestly I don't know where to go for help on this one! I have process.php that has to call a remote file called process.asp on another site. Site 1 has the cookie domain I want (that's where process.php is housed) Site 2 has the database I need (because I can't obtain a database for Site 1 - Site 2 is where process.asp is housed) process.php has to do an fopen to process.asp to process username and password material. process.asp needs security, obviously, to ensure that the user is coming from process.asp (but he's not because he's doing an fopen). in other words, process.php opens up process.asp and returns the evaluation of process.asp onto process.php I tried using REQUEST_URI but I didn't get the results I wanted. How will process.asp know that process.php called it in order to do what it should do? Thanx Phil
Re: [PHP] counter problem
Use this... enjoy ?php $numtoguess=42; if (isset($_POST['num_tries'])) $num_tries = $_POST['num_tries'] + 1; $message=; if(!isset($_POST['guess'])) $message=Welcome to the guessing machine; elseif ($_POST['guess'] $numtoguess) $message=Your guess was too low.; elseif ($_POST['guess'] $numtoguess) $message=Your guess was too high.; else $message=That is the correct number.; if(isset($_POST['guess'])) $guess=(int)$_POST['guess']; else $guess=0; print_r($_POST); ? HTML BODY H1 ?php print $message ? /H1 Guess number: ?php print $num_tries ? FORM METHOD=post Type your guess here:BR INPUT TYPE =text NAME=guess VALUE=?php print $guess ? INPUT TYPE =hidden NAME=num_tries VALUE=?php print $num_tries ? INPUT TYPE=submit VALUE=submit it! /FORM /BODY /HTML *** REPLY SEPARATOR *** On 04/01/2003 at 6:40 PM Anthony Ritter wrote: The following script is found in Matt Zandstra's book on PHP (Sams) on page 160. He's explaining forms with PHP and has hard coded a value - 42. He also is explaining a hidden fleld where the user can submit the number and each time the user hits submit in the formbox, the counter will register the total number of guesses. However, after running this script and submitting the number, I get: Guess number: 0 \ submit again and... Guess number: 0 \\, etc... instead of: Guess number: 1 Guess numver : 2 etc... Thanking all in advance. Tony Ritter .. ? $numtoguess=42; $num_tries=(isset($num_tries)) ? $num_tries++ : 0; $message=; if(!isset($guess)) $message=Welcome to the guessing machine; elseif ($guess$numtoguess) $message=Your guess was too low.; elseif ($guess$numtoguess) $message=Your guess was too high.; else $message=That is the correct number.; $guess=(int)$guess; ? HTML BODY H1 ? print $message ? /H1 Guess number: ?print $num_tries? FORM METHOD=post Type your guess here:BR INPUT TYPE =text NAME=guess VALUE=?print $guess? INPUT TYPE =hidden NAME=num_tries VALUE=? print $num_tries? INPUT TYPE=submit VALUE=submit it! /FORM /BODY /HTML -- 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] counter problem
This also works with the ternary operator... I don't think it likes the ++ because it doesn't know the type yet. ?php $numtoguess=42; $num_tries = isset($_POST['num_tries'])?$_POST['num_tries']+1:0; $message=; if(!isset($_POST['guess'])) $message=Welcome to the guessing machine; elseif ($_POST['guess'] $numtoguess) $message=Your guess was too low.; elseif ($_POST['guess'] $numtoguess) $message=Your guess was too high.; else $message=That is the correct number.; if(isset($_POST['guess'])) $guess=(int)$_POST['guess']; else $guess=0; print_r($_POST); ? HTML BODY H1 ?php print $message ? /H1 Guess number: ?php print $num_tries ? FORM METHOD=post Type your guess here:BR INPUT TYPE =text NAME=guess VALUE=?php print $guess ? INPUT TYPE =hidden NAME=num_tries VALUE=?php print $num_tries ? INPUT TYPE=submit VALUE=submit it! /FORM /BODY /HTML *** REPLY SEPARATOR *** On 04/01/2003 at 6:40 PM Anthony Ritter wrote: The following script is found in Matt Zandstra's book on PHP (Sams) on page 160. He's explaining forms with PHP and has hard coded a value - 42. He also is explaining a hidden fleld where the user can submit the number and each time the user hits submit in the formbox, the counter will register the total number of guesses. However, after running this script and submitting the number, I get: Guess number: 0 \ submit again and... Guess number: 0 \\, etc... instead of: Guess number: 1 Guess numver : 2 etc... Thanking all in advance. Tony Ritter .. ? $numtoguess=42; $num_tries=(isset($num_tries)) ? $num_tries++ : 0; $message=; if(!isset($guess)) $message=Welcome to the guessing machine; elseif ($guess$numtoguess) $message=Your guess was too low.; elseif ($guess$numtoguess) $message=Your guess was too high.; else $message=That is the correct number.; $guess=(int)$guess; ? HTML BODY H1 ? print $message ? /H1 Guess number: ?print $num_tries? FORM METHOD=post Type your guess here:BR INPUT TYPE =text NAME=guess VALUE=?print $guess? INPUT TYPE =hidden NAME=num_tries VALUE=? print $num_tries? INPUT TYPE=submit VALUE=submit it! /FORM /BODY /HTML -- 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] Second (Bizarre) Question regarding PHP and ASP
I'm not sure I totally understand... But why not just call it like a web page using curl? *** REPLY SEPARATOR *** On 04/01/2003 at 6:43 PM Phil Powell wrote: I don't know how to post this one so I'm sorry for such bizarre cross-posting, but honestly I don't know where to go for help on this one! I have process.php that has to call a remote file called process.asp on another site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Second (Bizarre) Question regarding PHP and ASP
It would look like any other user. In ASP you will have to check the request's IP (if its static), or you can use some kind of username/password combinition... Or if you are real lazy use just a hidden url ie mysite.com/akjdhsanlfas/process.asp There is no way to tell the page process.php is making the request. Andrew - Original Message - From: Phil Powell [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, January 04, 2003 11:43 PM Subject: [PHP] Second (Bizarre) Question regarding PHP and ASP I don't know how to post this one so I'm sorry for such bizarre cross-posting, but honestly I don't know where to go for help on this one! I have process.php that has to call a remote file called process.asp on another site. Site 1 has the cookie domain I want (that's where process.php is housed) Site 2 has the database I need (because I can't obtain a database for Site 1 - Site 2 is where process.asp is housed) process.php has to do an fopen to process.asp to process username and password material. process.asp needs security, obviously, to ensure that the user is coming from process.asp (but he's not because he's doing an fopen). in other words, process.php opens up process.asp and returns the evaluation of process.asp onto process.php I tried using REQUEST_URI but I didn't get the results I wanted. How will process.asp know that process.php called it in order to do what it should do? Thanx Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Perl PHP
I don't know what the heck this is but it works: #!/usr/bin/perl $ENV{LD_LIBRARY_PATH} .=:.:..:../lib; $ENV{CLASSPATH} .= :Verisign.jar:.; print `javac PFProJava.java`; print `java PFProJava test-payflow.verisignscks.com`; How can it be done with PHP? OR run the perl script from a PHP script. ? exec(perl.pl) ? didn't work. Thanks, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counter problem
Michael J. Pawlowsky wrote in message: This also works with the ternary operator... . No dice Michael. I treid both your scripts. The formbox comes up. I enter a number. I hit submit. The box clears out the entered number without any message whether the number was too high or too low or correct. Nothing with the counter as well... Please advise. TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] web visitor viewing a script?
This came up in another group and I just wanted to know from the experts whether this is possible. Being someone well versed in PHP can you visit a web site, hit a script in PHP and be able to view the script on the page rather than just the html it generates. Is it true that the only way to view the script itself is to have some problem with the web server or have a local login for the server? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and empty() if form value is 0
foreach ($HTTP_GET_VARS as $key = $val) { if (!empty($HTTP_GET_VARS[$key])) ${$key} = $HTTP_GET_VARS[$key]; } foreach ($HTTP_POST_VARS as $key = $val) { if (!empty($HTTP_POST_VARS[$key])) ${$key} = $HTTP_POST_VARS[$key]; } Whenever the form variable is equal to 0, the value is not passed into the corresponding variable. For example, if isLogin = 1, then $isLogin = 1 But if isRegistered = 0 then $isRegistered = {null} I do not understand why this happens, someone enlighten me! Phil
Re: [PHP] Second (Bizarre) Question regarding PHP and ASP
On Sunday 05 January 2003 07:43 am, Phil Powell wrote: I tried using REQUEST_URI but I didn't get the results I wanted. How will process.asp know that process.php called it in order to do what it should do? if you can get $_SERVER[REMOTE_ADDR] or $HTTP_REMOTE_ADDR and if you can trust it (not only that it's right, but also that there are no man in the middle attacks or other scripts on the client that can pretend to be your script) then you could just check that the request is coming from the right IP. alternatively, you could use hashes that change from one invocation to the next (to avoid replay attacks). the server and the client should both have a secret passphrase (perhaps even a whole set of them, one for each day, and generated every month or so). on the client (process.php) randomly generate a string, e.g., $randstr. create a hash based on the secret passphrase and the randstr, e.g, $hash=makeMyHash($passphrase.$randstr); /* use whatever hash function you want: openssl, mhash, mcrypt or whatever you use */ send the randstr and the hash along with the rest of the data. on the server side, process.asp takes the randstr, takes the hash as above, and compares the hash generated with the hash passed in. if they don't match, don't reply. if they match, then the request comes from process.php (unless you're really paranoid, in which case, add some more hoops for process.php to jump through :). tiger -- Gerald Timothy Quimpo tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph Public Key: gpg --keyserver pgp.mit.edu --recv-keys 672F4C78 Veritas liberabit vos. Doveryai no proveryai. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] exec() not exec-ing?
Could you just get the php script to send the commands to schedule it as a task to run via cron etc in say 1 minute into the future... that command would be done quickly.. and the server could continue.. i did something similar when i used NT/ASP. But i'm just a php newbie so i could be lost.. cheers Brendon -Original Message- From: gilrain [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] exec() not exec-ing? I'm back to square one, if I can't run that script without the browser waiting on it to finish... For instance, is there a way for my PHP script to log into my shell account and *then* send the command? Since I can execute the script, but PHP can't, this would solve the problem -- if it's possible. gilrain -- 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] Perl PHP
Not good at perl, but you need to do: ?php exec('perl.pl'); ? Sam wrote: I don't know what the heck this is but it works: #!/usr/bin/perl $ENV{LD_LIBRARY_PATH} .=:.:..:../lib; $ENV{CLASSPATH} .= :Verisign.jar:.; print `javac PFProJava.java`; print `java PFProJava test-payflow.verisignscks.com`; How can it be done with PHP? OR run the perl script from a PHP script. ? exec(perl.pl) ? didn't work. Thanks, Sam -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read-only gif support in 4.3.0
I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version of gdlib. I am using the windows version with apache and tried both php_gd.dll and php_gd2.dll and I could not access any GIF related image functions, however I could use JPG, PNG, etc. Does anyone know if I need to do anything special to get those functions to work? The function I am mainly needing to use is imagecreatefromgif(). Thanks -Adam
RE: [PHP] web visitor viewing a script?
Only if your webserver has a handler issue will this occur or if you have a .htaccess to override the server from passing onto PHP. This will happen with .php3 files if you don't have them set to be processed by php or any other extension that is not included in your web server configuration file / htaccess. And you are correct unless you have FTP/File Sharing etc you can't view the source of a handler/parsed file. HiTCHO has Spoken! Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] -Original Message- From: Larry Brown [mailto:[EMAIL PROTECTED]] Sent: Sunday, 5 January 2003 10:18 AM To: PHP List Subject: [PHP] web visitor viewing a script? This came up in another group and I just wanted to know from the experts whether this is possible. Being someone well versed in PHP can you visit a web site, hit a script in PHP and be able to view the script on the page rather than just the html it generates. Is it true that the only way to view the script itself is to have some problem with the web server or have a local login for the server? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- 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 empty() if form value is 0
On Sat, 4 Jan 2003 19:26:02 -0500, you wrote: Whenever the form variable is equal to 0, the value is not passed into the corresponding variable. For example, if isLogin = 1, then $isLogin = 1 But if isRegistered = 0 then $isRegistered = {null} I do not understand why this happens, someone enlighten me! That's just the way empty() works. Strings which evaluate to false (either an empty string or the string '0') will cause empty() to return true. Therefore if you have a form where '0' is a valid value, empty() is not appropriate. Instead of: if (!empty($var)) { ... } use: if (isset($var) $var != '') { ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and empty() if form value is 0
I couldn't think of isset, so I winged it: if (strlen($var) 0) {...} Phil Michael Sims [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sat, 4 Jan 2003 19:26:02 -0500, you wrote: Whenever the form variable is equal to 0, the value is not passed into the corresponding variable. For example, if isLogin = 1, then $isLogin = 1 But if isRegistered = 0 then $isRegistered = {null} I do not understand why this happens, someone enlighten me! That's just the way empty() works. Strings which evaluate to false (either an empty string or the string '0') will cause empty() to return true. Therefore if you have a form where '0' is a valid value, empty() is not appropriate. Instead of: if (!empty($var)) { ... } use: if (isset($var) $var != '') { ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Second (Bizarre) Question regarding PHP and ASP
CURL? I only understand CURL as a Vignette command, sorry, you lost me. Phil Michael J. Pawlowsky [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm not sure I totally understand... But why not just call it like a web page using curl? *** REPLY SEPARATOR *** On 04/01/2003 at 6:43 PM Phil Powell wrote: I don't know how to post this one so I'm sorry for such bizarre cross-posting, but honestly I don't know where to go for help on this one! I have process.php that has to call a remote file called process.asp on another site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counter problem
I won't keep it up long... but go here... you will see it works... http://rc.mikeathome.net:8080/test/index.php *** REPLY SEPARATOR *** On 04/01/2003 at 7:17 PM Anthony Ritter wrote: Michael J. Pawlowsky wrote in message: This also works with the ternary operator... . No dice Michael. I treid both your scripts. The formbox comes up. I enter a number. I hit submit. The box clears out the entered number without any message whether the number was too high or too low or correct. Nothing with the counter as well... Please advise. TR -- 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] web visitor viewing a script?
or rename the file to .phps for PHP source. Many servers recognize this mime type as source and send you the file. But if you are thinking about security... the script is compiled and executed on the server. What you see are the results of the application. Get it? This is good and bad... Because it means you can only run each application once and then you have to call it again. Possibly with different parameters etc. It's why I also use JavaScript. The application resides on the client. Meaning the client can interact with it, So lets say you have 2 select boxes. You want to populate the second one with data depending on the selection of the first with out reloading the page. This can be done in JavaScript. Not in PHP. When doing something like that I use PHP to populate my javaScript arrays and JS handle the interaction with the client. Mike *** REPLY SEPARATOR *** On 04/01/2003 at 7:17 PM Larry Brown wrote: This came up in another group and I just wanted to know from the experts whether this is possible. Being someone well versed in PHP can you visit a web site, hit a script in PHP and be able to view the script on the page rather than just the html it generates. Is it true that the only way to view the script itself is to have some problem with the web server or have a local login for the server? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- 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] Read-only gif support in 4.3.0
I just installed 4.3 today... configured as ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib - -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf --with-fre etype --enable-gd-native-ttf I run this code: ?php header(Content-type: image/jpeg); $img = imagecreatefromgif(../images/camera.gif); imagejpeg($img); imagedestroy($img); ? and it works fine Mike *** REPLY SEPARATOR *** On 04/01/2003 at 4:50 PM Adam Plocher wrote: This encoded message has been converted to an attachment. I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version of gdlib. I am using the windows version with apache and tried both php_gd.dll and php_gd2.dll and I could not access any GIF related image functions, however I could use JPG, PNG, etc. Does anyone know if I need to do anything special to get those functions to work? The function I am mainly needing to use is imagecreatefromgif(). Thanks -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Second (Bizarre) Question regarding PHP and ASP
http://www.php.net/manual/en/ref.curl.php have the page send back whatever info you need. *** REPLY SEPARATOR *** On 04/01/2003 at 8:33 PM Phil Powell wrote: CURL? I only understand CURL as a Vignette command, sorry, you lost me. Phil Michael J. Pawlowsky [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm not sure I totally understand... But why not just call it like a web page using curl? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security in guest book and user forums
on 05/01/03 5:24 AM, Seraphim ([EMAIL PROTECTED]) wrote: I use the htmlspecialchars() function to disable all html. This function basically puts a '\' in front of eacht html character and thus disables all html. You may not want to do this if you want to allow, for example b/b or other friendly html. If so you can use a regex to disable the script or /table tags. Now that I think about it, it might be better to disable all html and later enable i,b etc (or define your own, like a lot of forums seem to do). What about striptags()? Designed EXACTLY for disabling HTML tags, except for a list you allow: ? $text = stiptags($text,'bi'); // allows bold and italics ? Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security in guest book and user forums
on 05/01/03 4:16 AM, Anders Thoresson ([EMAIL PROTECTED]) wrote: I've seen both guest books and user forums hacked by users who enter javascript or other code, and that way redirects vistors to other sites or do other unwelcome things. What expressions should I look for and not allow in my forms? Personally, I'd disallow ALL HTML tags. Why? Best two reasons I have are: - someone might open a b tag, and never close it, making your whole page bold, or a link, or whatever - someone could do something evil with javascript or any other onmouseover/click type event, like b onmouseover=javascript:window.close(); (can't remember exact syntax) Just use striptags() (or is it strip_tags()?) on the entire contents of all your form's text elements, giving you clean text. If you wanted to bring back simple formatting (say, B,I,BR), you could implement 'BBtags', basically using [ and ] instead of and : Hello, [b]this bit is in bold[/b][br][i]and this in italics on a new line[/i]. Then you can specifically search and replace those tags using str_replace() or eregi_replace() or preg_replace(). Personally, I believe they don't have the right to get such amazing access to your site... everyone who you don't know shouldn't be trusted to provide decent content, or write decent HTML. Cheers, Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Read-only gif support in 4.3.0
Michael, thanks for the response.. Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I could throw this on I suppose, but I was kind of hoping to use this machine as a dev box. I ran the same code you posted and these were my results: Fatal error: Call to undefined function: imagecreatefromgif() in c:\apache\htdocs\test.php on line 14 I don't get it - there are two gd dll's that come with it and I've tried both. Any other advice would be appreciated. Thanks -Adam -Original Message- From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] Sent: Sat 1/4/2003 5:58 PM To: Adam Plocher; [EMAIL PROTECTED] Cc: Subject: Re: [PHP] Read-only gif support in 4.3.0 I just installed 4.3 today... configured as ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib - -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf --with-fre etype --enable-gd-native-ttf I run this code: ?php header(Content-type: image/jpeg); $img = imagecreatefromgif(../images/camera.gif); imagejpeg($img); imagedestroy($img); ? and it works fine Mike *** REPLY SEPARATOR *** On 04/01/2003 at 4:50 PM Adam Plocher wrote: This encoded message has been converted to an attachment. I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version of gdlib. I am using the windows version with apache and tried both php_gd.dll and php_gd2.dll and I could not access any GIF related image functions, however I could use JPG, PNG, etc. Does anyone know if I need to do anything special to get those functions to work? The function I am mainly needing to use is imagecreatefromgif(). Thanks -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Read-only gif support in 4.3.0
when you do a phpinfo() what are the compiled with options? *** REPLY SEPARATOR *** On 04/01/2003 at 6:24 PM Adam Plocher wrote: This encoded message has been converted to an attachment. Michael, thanks for the response.. Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I could throw this on I suppose, but I was kind of hoping to use this machine as a dev box. I ran the same code you posted and these were my results: Fatal error: Call to undefined function: imagecreatefromgif() in c:\apache\htdocs\test.php on line 14 I don't get it - there are two gd dll's that come with it and I've tried both. Any other advice would be appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Read-only gif support in 4.3.0
There aren't any, however there is a GD section which says: GD Support enabled GD Version bundled (2.0 compatible) FreeType Supportenabled FreeType Linkagewith freetype JPG Support enabled PNG Support enabled WBMP Supportenabled Doesn't say anything about GIF =/. I looked in the php.ini file and didn't see anything relating to gif support, and there aren't any gif extensions in the php\extensions directory. Thx again. -Adam -Original Message- From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] Sent: Sat 1/4/2003 6:34 PM To: Adam Plocher; [EMAIL PROTECTED] Cc: Subject: RE: [PHP] Read-only gif support in 4.3.0 when you do a phpinfo() what are the compiled with options? *** REPLY SEPARATOR *** On 04/01/2003 at 6:24 PM Adam Plocher wrote: This encoded message has been converted to an attachment. Michael, thanks for the response.. Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I could throw this on I suppose, but I was kind of hoping to use this machine as a dev box. I ran the same code you posted and these were my results: Fatal error: Call to undefined function: imagecreatefromgif() in c:\apache\htdocs\test.php on line 14 I don't get it - there are two gd dll's that come with it and I've tried both. Any other advice would be appreciated. Thanks
[PHP] Function to catch all mySQL errors?
I know that mySQL errors are caught in mysql_error() and I find that function extremely useful (kudos!). However, I have several queries in a few scripts of mine but am wondering if anyone has written a small function that catches errors and outputs them. What I mean is lets say I have a block of code like so: $result = mysql_query(SELECT field1, field2 FROM users WHERE userLogin = '$authusername' AND userPassword = '$authpassword'); Instead of a small loop under my query that is like so: if (mysql_error()) { echo Error: .mysql_error(); exit; } I'd like to be able to call a function that does this instead of adding this if statement after all my queries...so...anyone do something similar? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Function to catch all mySQL errors?
How about something like this.. function runquery($query) { $query = mysql_query($query); if (mysql_error()) { echo div style=\color:red\MySQL Error: . mysql_error() ./div\n; exit(1); } return $query; } -Original Message- From: Jeff Lewis [mailto:[EMAIL PROTECTED]] Sent: Sat 1/4/2003 6:43 PM To: [EMAIL PROTECTED] Cc: Subject: [PHP] Function to catch all mySQL errors? I know that mySQL errors are caught in mysql_error() and I find that function extremely useful (kudos!). However, I have several queries in a few scripts of mine but am wondering if anyone has written a small function that catches errors and outputs them. What I mean is lets say I have a block of code like so: $result = mysql_query(SELECT field1, field2 FROM users WHERE userLogin = '$authusername' AND userPassword = '$authpassword'); Instead of a small loop under my query that is like so: if (mysql_error()) { echo Error: .mysql_error(); exit; } I'd like to be able to call a function that does this instead of adding this if statement after all my queries...so...anyone do something similar? Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Read-only gif support in 4.3.0
Didn't I answer this already? The Windows binary was built without the right #define to enable the GIF support. You will have to wait for the next Windows build before this will work. -Rasmus On Sat, 4 Jan 2003, Adam Plocher wrote: Michael, thanks for the response.. Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I could throw this on I suppose, but I was kind of hoping to use this machine as a dev box. I ran the same code you posted and these were my results: Fatal error: Call to undefined function: imagecreatefromgif() in c:\apache\htdocs\test.php on line 14 I don't get it - there are two gd dll's that come with it and I've tried both. Any other advice would be appreciated. Thanks -Adam -Original Message- From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] Sent: Sat 1/4/2003 5:58 PM To: Adam Plocher; [EMAIL PROTECTED] Cc: Subject: Re: [PHP] Read-only gif support in 4.3.0 I just installed 4.3 today... configured as ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib - -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf --with-fre etype --enable-gd-native-ttf I run this code: ?php header(Content-type: image/jpeg); $img = imagecreatefromgif(../images/camera.gif); imagejpeg($img); imagedestroy($img); ? and it works fine Mike *** REPLY SEPARATOR *** On 04/01/2003 at 4:50 PM Adam Plocher wrote: This encoded message has been converted to an attachment. I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version of gdlib. I am using the windows version with apache and tried both php_gd.dll and php_gd2.dll and I could not access any GIF related image functions, however I could use JPG, PNG, etc. Does anyone know if I need to do anything special to get those functions to work? The function I am mainly needing to use is imagecreatefromgif(). Thanks -Adam -- 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] Read-only gif support in 4.3.0
If I look at my phpinfo I get: gd GD Support enabled GD Version bundled (2.0 compatible) FreeType Support enabled FreeType Linkage with TTF library GIF Read Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled Notice the GIF Read Support Why dont you try and compile your own on Windoze Mike *** REPLY SEPARATOR *** On 04/01/2003 at 6:40 PM Adam Plocher wrote: This encoded message has been converted to an attachment. There aren't any, however there is a GD section which says: GD Support enabled GD Version bundled (2.0 compatible) FreeType Support enabled FreeType Linkage with freetype JPG Supportenabled PNG Supportenabled WBMP Support enabled -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] web visitor viewing a script?
Thank you guys for the confirmation and ...yes I got it. :( Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 04, 2003 8:52 PM To: Larry Brown; [EMAIL PROTECTED] Subject: Re: [PHP] web visitor viewing a script? or rename the file to .phps for PHP source. Many servers recognize this mime type as source and send you the file. But if you are thinking about security... the script is compiled and executed on the server. What you see are the results of the application. Get it? This is good and bad... Because it means you can only run each application once and then you have to call it again. Possibly with different parameters etc. It's why I also use JavaScript. The application resides on the client. Meaning the client can interact with it, So lets say you have 2 select boxes. You want to populate the second one with data depending on the selection of the first with out reloading the page. This can be done in JavaScript. Not in PHP. When doing something like that I use PHP to populate my javaScript arrays and JS handle the interaction with the client. Mike *** REPLY SEPARATOR *** On 04/01/2003 at 7:17 PM Larry Brown wrote: This came up in another group and I just wanted to know from the experts whether this is possible. Being someone well versed in PHP can you visit a web site, hit a script in PHP and be able to view the script on the page rather than just the html it generates. Is it true that the only way to view the script itself is to have some problem with the web server or have a local login for the server? Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -- 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] pack, unpack and little endian double values
Hello I am trying to parse ESRI shape files, which have double values stored in little endian format. when i read these values using something like this: $RawFileHeader = fread($ShapeFile, 100); $FileHeader = unpack(NFileCode/N5Unused/NFileLength/VVersion/VShapeType/d8Box, $RawFileHeader); the double values seem garbled. Is there any way to force unpack() to read the doubles as little endians and convert the value accordingly? Thanks. Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Function to catch all mySQL errors?
Also if you dont want ot to break you need to add the @ operator in front Mike *** REPLY SEPARATOR *** On 04/01/2003 at 6:47 PM Adam Plocher wrote: This encoded message has been converted to an attachment. How about something like this.. function runquery($query) { $query = mysql_query($query); if (mysql_error()) { echo div style=\color:red\MySQL Error: . mysql_error() ./div\n; exit(1); } return $query; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Recommend payment processors?
I've been using Authorize.Net for about 6 months now am happy with them. I use their AIM interface, which allows ,e complete control over the look feel of the payment process. There is no problem doing everything in PHP, as long as you have the CURL extensions they are built with SSL support. -- JR -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 11:15 AM To: php general Subject: [PHP] Recommend payment processors? Just wondering what people are using/recommend out there.. I'm going to be getting a merchant account and let people purchase services through my website on a secure server, all in PHP. What concerns me is this archived post I came across: http://marc.theaimsgroup.com/?l=php-generalm=102165623600464w=2 Reading that, it sounds like it's not possible to use Payment Pro, or possibly other systems, with PHP .. is this correct? Some of the other posts in the archive sounded like people were using it, so I'm not really sure what is possible at this point. Thanks, Chad -- 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] Function to catch all mySQL errors?
Hi, Sunday, January 5, 2003, 12:47:40 PM, you wrote: AP How about something like this.. AP function runquery($query) AP { AP $query = mysql_query($query); AP if (mysql_error()) AP { AP echo div style=\color:red\MySQL Error: . mysql_error() ./div\n; AP exit(1); AP } AP return $query; AP } AP -Original Message- AP From: Jeff Lewis [mailto:[EMAIL PROTECTED]] AP Sent: Sat 1/4/2003 6:43 PM AP To: [EMAIL PROTECTED] AP Cc: AP Subject: [PHP] Function to catch all mySQL errors? AP I know that mySQL errors are caught in mysql_error() and I find that AP function extremely useful (kudos!). However, I have several queries in a few AP scripts of mine but am wondering if anyone has written a small function that AP catches errors and outputs them. What I mean is lets say I have a block of AP code like so: AP $result = mysql_query(SELECT field1, field2 FROM users WHERE userLogin = AP '$authusername' AND userPassword = '$authpassword'); AP Instead of a small loop under my query that is like so: AP if (mysql_error()) { AP echo Error: .mysql_error(); AP exit; AP } AP I'd like to be able to call a function that does this instead of adding this AP if statement after all my queries...so...anyone do something similar? AP Jeff Here is a small class I use for mysql that will do what you want. ? class mysql_class{ var $connection = array('db'='database','host'=':/tmp/mysql.sock','user'='username','password'='password'); var $handles = array(); var $con; function mysql_class($db='',$ini=''){ global $class_ref; $class_ref[mysql_class] = $this; if($ini != '' file_exists($ini)){ $this-connection = parse_ini_file($ini,TRUE); } if(!$this-con = @mysql_connect($this-connection['host'] , $this-connection['user'] , $this-connection['password'])): echo oops failed to connect br; else: if($db != '') mysql_select_db($db,$this-con); else mysql_select_db($this-connection['db']); endif; } function get_handle($db=''){ $r = 0; if(!empty($this-con)): $r = count($this-handles) + 1; if($db == '') $db = $this-connection['db']; $this-handles[$r]['db'] = $db; endif; return $r; } function select_db($h){ mysql_select_db($this-handles[$h]['db'],$this-con); } function sql_query($sql,$h,$line=''){ $r = 0; if(!empty($line)){ $line = on line $line ; } if($sql != ''): $this-select_db($h); if(!$r = mysql_query($sql,$this-con)): echo 'Oops error '.$line.': '.mysql_error($this-con).'br'; endif; endif; return $r; } function num_rows($result){ return mysql_num_rows($result); } function sql_insert($sql,$h,$line=''){ $r = 0; if($sql != ''): $this-select_db($h); if(!$r = mysql_query($sql,$this-con)): echo 'Oops error at '.$line.': '.mysql_error($this-con).'br'; else: $r = mysql_insert_id($this-con); endif; endif; return $r; } function fetch_array($res,$row,$type=MYSQL_ASSOC){ $r = 0; if($row = mysql_fetch_array($res,$type)) $r = 1; return $r; } function fetch_result($res,$field){ return mysql_result($res,0,$field); } } //usage $mysql = new mysql_class(); $con = $mysql-get_handle('test_database'); $result = $mysql-sql_query(SELECT * FROM test_table,$con,__LINE__)): . . . $insert_id = $mysql-insert(INSERT INTO test_table (id,name) VALUES ($id,'$name'),$con,__LINE__); . . If it errors it will print an error and give the line number of the call. It can handle multiple databases in the same class just get another handle. Hope this helps Tom -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recommend payment processors?
I use authorize.net with curl as well. It works great. There are tutorials on http://www.phpbuilder.net on how to set this up. David - Original Message - From: Jonathan Rosenberg (Tabby's Place) [EMAIL PROTECTED] To: Chad Day [EMAIL PROTECTED]; php general [EMAIL PROTECTED] Sent: Saturday, January 04, 2003 7:16 PM Subject: RE: [PHP] Recommend payment processors? I've been using Authorize.Net for about 6 months now am happy with them. I use their AIM interface, which allows ,e complete control over the look feel of the payment process. There is no problem doing everything in PHP, as long as you have the CURL extensions they are built with SSL support. -- JR -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Friday, January 03, 2003 11:15 AM To: php general Subject: [PHP] Recommend payment processors? Just wondering what people are using/recommend out there.. I'm going to be getting a merchant account and let people purchase services through my website on a secure server, all in PHP. What concerns me is this archived post I came across: http://marc.theaimsgroup.com/?l=php-generalm=102165623600464w=2 Reading that, it sounds like it's not possible to use Payment Pro, or possibly other systems, with PHP .. is this correct? Some of the other posts in the archive sounded like people were using it, so I'm not really sure what is possible at this point. Thanks, Chad -- 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 Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and empty() if form value is 0
On Sat, 4 Jan 2003 20:33:14 -0500, you wrote: I couldn't think of isset, so I winged it: if (strlen($var) 0) {...} This should work most of the time, but be aware this will produce a warning if $var isn't set (and you haven't set your error reporting level to ignore warnings)... If you're not sure that $var exists it's better to check it with isset() before checking strlen()... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php