php-general Digest 2 Mar 2001 06:59:02 -0000 Issue 542 Topics (messages 42204 through 42301): Some search engine questions.... 42204 by: John Coggeshall Re: pleaaaaaaaase help! 42205 by: Carsten Gehling Re: PHP single user?? 42206 by: Todd Cary Re: Announcing PHP-GTK 42207 by: Rouvas Stathis Bitwise solution? 42208 by: Boget, Chris 42210 by: Boget, Chris 42298 by: Harshdeep S Jawanda PHP image browser 42209 by: Timothy Wright 42212 by: php3.developersdesk.com Odd PHP/MySQL Question 42211 by: Kath 42215 by: Hoover, Josh 42216 by: Julian Wood PHP 4.0.4pl1 on Cobalt Raq 2 42213 by: Matt Perry Error, anyone seen this before? 42214 by: Brandon Orther Munging hidden/form variables 42217 by: Boget, Chris 42218 by: Boget, Chris 42232 by: php3.developersdesk.com 42234 by: Opec Kemp \( Ozemail \) 42235 by: Kelly Corkill 42236 by: Boget, Chris 42237 by: Simon Garner 42239 by: Chris 42240 by: Boget, Chris 42242 by: Simon Garner 42243 by: Simon Garner 42244 by: Boget, Chris 42245 by: Chris 42246 by: Chris 42247 by: Simon Garner 42301 by: php3.developersdesk.com The neverending Session 42219 by: Sean B. 42249 by: CC Zona What did I forget? 42220 by: Borja Lopez Montilla Hiding php Code 42221 by: Rene Maldonado 42223 by: Rene Maldonado 42224 by: Hoover, Josh security approach? 42222 by: Gustavo Vieira Goncalves Coelho Rios SetCookie 42225 by: WreckRman2 wrapper (simple questions) 42226 by: Gustavo Vieira Goncalves Coelho Rios Re: Hebrew websites transition with php3 .. 42227 by: Aviv Revach ImageGif: No GIF support in this PHP build 42228 by: Jimmy Bäckström 42230 by: Jack Dempsey 42231 by: Jack Dempsey Re: PostgreSQL vs InterBase 42229 by: Shaun Thomas 42266 by: Mark Charette Loading config file from cgi 42233 by: Tyson Lloyd Thwaites Cutting long words 42238 by: Juan Germano 42241 by: Juan Germano validating fields 42248 by: W.D. 42250 by: Simon Garner session_destroy() fails... 42251 by: Tobias Talltorp 42252 by: Ernest E Vogelsinger 42261 by: Tobias Talltorp Cutting long strings for tables 42253 by: Juan Germano 42280 by: Clayton Dukes Loss of connection handle object 42254 by: Andrew Halliday 42257 by: Andrew Hill 42258 by: Andrew Halliday 42260 by: Simon Garner 42264 by: Andrew Hill 42265 by: Andrew Halliday 42268 by: Andrew Halliday 42279 by: Andrew Halliday What means "can't truncate sockets!" 42255 by: SED 42263 by: Jaxon configuring php.ini 42256 by: Erin Quick-Laughlin mysql newsserver 42259 by: deco Re: checking for a defined function 42262 by: Jason Brooke pspell/aspell breaking 42267 by: Seth Northrop Declaring SERVER-WIDE Variables 42269 by: Michael David 42274 by: Simon Garner Re: Restrict Access per IP Addresses 42270 by: Nazoréen HREFs that can't be 42271 by: Boget, Chris 42272 by: CC Zona 42273 by: Jaxon 42277 by: Boget, Chris 42278 by: CC Zona Re: Template recommendations 42275 by: Joseph H Blythe Way to generate Passwords 42276 by: Jochen Kaechelin 42281 by: Stephan Ahonen Dumb newbie graphics question 42282 by: darthzeth 42283 by: Jason Murray 42284 by: Jack Dempsey 42292 by: darthzeth 42294 by: Simon Garner 42295 by: John Ashton cant start apche 42285 by: Scott Wagner can't start apache 42286 by: Scott Wagner 42287 by: John Ashton 42288 by: Scott Wagner 42289 by: John Ashton php and javascript 42290 by: Dan Harrington Trigger script from Browser? 42291 by: Ted Goranson 42293 by: John Ashton Help - I can't create jpegs with GD 42296 by: Cherie Benoit 42297 by: Rasmus Lerdorf IE 5.5,authentication,PHP sessions: IE never stops running? 42299 by: Ken 42300 by: John Ashton 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] ----------------------------------------------------------------------
Hey guys, I've got a question regarding a search engine I have to write.... Basically what I have is this.. I have a table with a serialized array in it. I'd like to take that array and search for keywords... I've got a mySQL database and this is how I'm doing it... SELECT a FROM b,c WHERE(b.serializedarray LIKE CONCAT('%', c.keywords,'%')); Where b is the table containing the serialized data and c is a single column HEAP table with the list of keywords... Now... My question is kind of two fold... A) Is this the best way to do it? By Best I mean considering I am dealing with a serialized array.... and - thiis is my real question B) How do I show limited page results? I want to break up the results into groups of 5 per page and have x pages (count % 5). My problem is that the origional query gets lost once the page has returned the first set of results and I have no real way of keeping them... There can be too many to append to the <A HREF> of the link to the next page and I don't want to use form POSTS since I have to have buttons for all of them.... Any suggestions? John
From: "kaab kaoutar" <[EMAIL PROTECTED]> Sent: Thursday, March 01, 2001 5:59 PM > please i'm really in need of knowing if there is a way to do a php statement > once a button is clicked! What you really need to understand is, that PHP is a SERVER-side scripting language. The only way to execute a statement when pressing a button is to use a CLIENT-side scripting language (JavaScript or VBScript if you're using Explorer only). PHP is only run when a page is requested, such as when pressing a link or submitting a form or the like. - Carsten
Rick - That was a typo. I have IIS 5 on my Win 2K and my friend has IIS 4 on the NT 4 box. Something that I believe is at the heart of the problem is the fact that in the ISAPI Filters, PHP is associated with php4isapi.dll and the green up arrow does not come up; there is a red down arrow instead. Todd Rick Hodger wrote: > Todd Cary <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am having a very strange problem: PHP 4.0.4 on a NT 4 platform with > > IIS 5 is only allowing one surfer to do a DB Select. If the DB is busy > > with the first user, the page is not available to other users. And I > > have no problems with Win 2K. > > > > Am I missing something very obvious? > > Umm...is IIS5 not Win2k -only-? > > -- > Rick @ DomainsBuy.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Todd Cary Ariste Software [EMAIL PROTECTED]
Great News! -Stathis. Andrei Zmievski wrote: > > The first release of PHP-GTK is now available. PHP-GTK is a PHP > extension that provides an object-oriented interface to GTK+ toolkit and > enables you to write client-side cross-platform GUI applications. For > more information, visit http://gtk.php.net/. > > -Andrei > > UNIX is like sex: If you don't know it, you don't miss it. But if > you know it, you'll need it. -- Anonymous. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
I'm wondering how I can do the following (if it is possible at all): I have 2 values. The first is a constant while the second is not. The second value, in this case, is a unix time stamp and as such will change every time it is set, down to the second. I need to somehow merge the two values so that the new, merged value would be as (semi) unique as the timestamp value. I was thinking I could do something like this: ( var1 & var2 ) But that generates an identical value every time. Is there a way I can do this? And no, I cannot just use the timestamp value. :P And microtime() isn't really an option either. :( Any help at all would be greatly appreciated! :) Chris
> on 3/1/01 02:34 PM, [EMAIL PROTECTED] split open and melted thusly: > > I was thinking I could do something like this: > > ( var1 & var2 ) > i think what you want is: > ${$var1$var2} But that would give me a value of a variable variable. And I need a numerical value so $var1 ="joe"; $var2 = date( "U" ); echo "$var1$var2"; won't do me any good. :/ I've a very odd predicament... Chris
Hi, "Boget, Chris" wrote: > I have 2 values. The first is a constant while the second is not. Is the first value a numerical value (real/integer?) or a string value? If it is numerical, then one of the things you could do for using a numerical value of (say) less than 100 could be: $finalVar = ($var2 * 10) + $var2; This is one of the simplest things you could do and meant only as a rough example. A faster way would be to right-shift by 4 (if that can be done in PHP) instead of multiplying by 10. This well essentially multiply the number by 16. I am relatively new to PHP, so the syntax I have used may not be correct. Sorry about that. Does this come anywhere close to what you would like to do? -- Regards, Harshdeep Singh Jawanda.
Can PHP & GD-lib create an index with thumbnail images of all graphics in a directory? Has anyone done this? Specifically, I would like to create small (maybe 1/8 or 1/16 size) thumbnails on-the-fly and place them in an index.php page with links to the larger images. Thanks in advance, Tim Wright ::::::::::::::::::::::::::::::::::::::::::: ::: ::: ::: Timothy Wright ::: ::: mailto:[EMAIL PROTECTED] ::: ::: Digital Network Enterprises ::: ::: http://www.01network.com ::: ::: ::: ::: (PGP Public Key ID: 0x891B2C91) ::: :::::::::::::::::::::::::::::::::::::::::::
Addressed to: "Timothy Wright" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Timothy Wright" <[EMAIL PROTECTED]> Thu, 1 Mar 2001 14:40:16 -0500 > > Can PHP & GD-lib create an index with thumbnail images of all graphics in a > directory? Has anyone done this? Specifically, I would like to create > small (maybe 1/8 or 1/16 size) thumbnails on-the-fly and place them in an > index.php page with links to the larger images. It can be done, but it is not fast enough to do in real time. The way I create thumbnails is ImageMagick. I keep my thumbnails in a hidden directory (.s) and create them like this: mkdir( "imagedir/.s" 0700 ); system( 'cp imagedir/*.jpg imagedir/.s' ); system( '/usr/local/bin/mogrify -geometry 150X150 imagedir/.s/*' ); The last command will take an image of any size and aspect ratio, maintain the aspect ratio and resize it so the largest dimension is 150 pixels. There are MANY other commands available. Your thunbmails have the same names as the full size files, but are stored in imagedir/.s/. Image Magick: http://www.imagemagick.org/ Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
I have a user database where a year has to be put in. Now, I want to compile a list of each different year and how many users are in that year. Is there a way to do this beyond coding for each year: SELECT * FROM students WHERE year = '1983' ? - Kath
You could try something like this: SELECT year, count(studentID) FROM students GROUP BY year ...where studentID is the primary key column/field in your students table. Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here > I have a user database where a year has to be put in. > > Now, I want to compile a list of each different year and how > many users are in that year. > > Is there a way to do this beyond coding for each year: > > SELECT * FROM students WHERE year = '1983' ? > > - Kath >
select count(*), year from students group by year; on 3/1/01 12:07 PM, Kath at [EMAIL PROTECTED] wrote: > I have a user database where a year has to be put in. > > Now, I want to compile a list of each different year and how many users are in > that year. > > Is there a way to do this beyond coding for each year: > > SELECT * FROM students WHERE year = '1983' ? > > - Kath >
I have a Cobalt Raq 2 with with 2.0.34 kernel installed. When I compile PHP and then try to execute it, it will dump core with the following message: Floating point exception (core dumped) I'm untaring the files, cd'ing to the directory and running './configure' and then 'make'. The compile appears to work fine, yet when I run the php executable in the php directory, I get the above error. The only change I have made to the system is to install all the Cobalt security patches and then install flex 2.5.4 and bison 1.28. Otherwise it's a stock Raq2. One other thing: configure sees my system as mipsel-unknown-linux-gnu. Anyone have any suggestions? -- Matt Perry | matt at primefactor dot com
hello, I am getting this error when I try to get an ftp_list. Warning: Unable to find ftpbuf 0 in c:\apache\htdocs\sitemaestro\scripts\formmail.php on line 72 and ideas? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
It is possible (I've done it) to find out all the variables that make up a form on a particular site, generate a similar form on your site with that form's action being the CGI/PHP script that the particular site uses to process the form once submitted, modify the values for the form variables to be anything you want and submit the form that resides on your site. This will basically submit totally fabricated data to the foriegn site and possibly screw them up somehow and/or in some way. Is there any way to defend against this? Is there any way to ensure that when a form is submitted that the submission request originated from your site/domain and not somewhere else? Any help would be greatlyl appreciated. Chris
> Is there any way to defend against this? Is there any way > to ensure that when a form is submitted that the submission > request originated from your site/domain and not somewhere > else? Knowing that $HTTP_REFERER cannot be relied on as containing valid data (as some browsers don't support it)? Chris
Addressed to: "Boget, Chris" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Boget, Chris" <[EMAIL PROTECTED]> Thu, 1 Mar 2001 14:26:16 -0600 > > ------_=_NextPart_001_01C0A28D.E2F45248 > Content-Type: text/plain; > charset="iso-8859-1" > > It is possible (I've done it) to find out all the variables > that make up a form on a particular site, generate a > similar form on your site with that form's action being > the CGI/PHP script that the particular site uses to process > the form once submitted, modify the values for the form > variables to be anything you want and submit the form > that resides on your site. This will basically submit totally > fabricated data to the foriegn site and possibly screw them > up somehow and/or in some way. > > Is there any way to defend against this? Is there any way > to ensure that when a form is submitted that the submission > request originated from your site/domain and not somewhere > else? No. There is no way to tell a clever programmer from a live human on the other end of an Internet connection. You may be able to make it harder, say making sure your form page is hit before the results are returned, but that is easy to defeat. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
I can think of one way that you can take in an attempy to prevent this. It is not totally fool proof but it will make it more difficult to send spoof data: 1) Check your HTTP refereer when the form is submitted. If the referer is not from your host then don't process the form. Of course this can be faked quite easily if this person knows what (s)he doing. > > It is possible (I've done it) to find out all the variables > > that make up a form on a particular site, generate a > > similar form on your site with that form's action being > > the CGI/PHP script that the particular site uses to process > > the form once submitted, modify the values for the form > > variables to be anything you want and submit the form > > that resides on your site. This will basically submit totally > > fabricated data to the foriegn site and possibly screw them > > up somehow and/or in some way. > > > > Is there any way to defend against this? Is there any way > > to ensure that when a form is submitted that the submission > > request originated from your site/domain and not somewhere > > else?
I would think you should be able to write a random string to a file when the form page is accessed, and carry a variable with the action then have the recipient compare. Presents other challenges but should give you that comforting feeling he was looking for. On Thu, 1 Mar 2001 [EMAIL PROTECTED] wrote: > Date: Thu, 1 Mar 2001 16:18:08 MST > From: [EMAIL PROTECTED] > To: "Boget, Chris" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] > Subject: Re: [PHP] Munging hidden/form variables > > Addressed to: "Boget, Chris" <[EMAIL PROTECTED]> > [EMAIL PROTECTED] > > ** Reply to note from "Boget, Chris" <[EMAIL PROTECTED]> Thu, 1 Mar 2001 14:26:16 >-0600 > > > > ------_=_NextPart_001_01C0A28D.E2F45248 > > Content-Type: text/plain; > > charset="iso-8859-1" > > > > It is possible (I've done it) to find out all the variables > > that make up a form on a particular site, generate a > > similar form on your site with that form's action being > > the CGI/PHP script that the particular site uses to process > > the form once submitted, modify the values for the form > > variables to be anything you want and submit the form > > that resides on your site. This will basically submit totally > > fabricated data to the foriegn site and possibly screw them > > up somehow and/or in some way. > > > > Is there any way to defend against this? Is there any way > > to ensure that when a form is submitted that the submission > > request originated from your site/domain and not somewhere > > else? > > > No. There is no way to tell a clever programmer from a live human on > the other end of an Internet connection. You may be able to make it > harder, say making sure your form page is hit before the results are > returned, but that is easy to defeat. > > > > > > Rick Widmer > Internet Marketing Specialists > http://www.developersdesk.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > Kelly 303-444-1671 Boulder, Colorado
> I can think of one way that you can take in an attempy to prevent > this. It is not totally fool proof but it will make it more difficult > to send spoof data: > 1) Check your HTTP refereer when the form is submitted. If the > referer is not from your host then don't process the form. > Of course this can be faked quite easily if this person knows > what (s)he doing. Well, this was part of what I was going to do. I was going to check to see if the request method was post and if the referer was from our host (not just the form/page). If all that was true, then process the form. If not, don't. However, I know that the $HTTP_REFERER variable is not at all reliable. On that note, what browsers/versions would not send this information for Apache/PHP to set? I know it is because of the browser that the client is using that this variable is unreliable. But what those browsers/versions are, I don't know and am hoping someone can answer. Chris
From: "Boget, Chris" <[EMAIL PROTECTED]> > It is possible (I've done it) to find out all the variables > that make up a form on a particular site, generate a > similar form on your site with that form's action being > the CGI/PHP script that the particular site uses to process > the form once submitted, modify the values for the form > variables to be anything you want and submit the form > that resides on your site. This will basically submit totally > fabricated data to the foriegn site and possibly screw them > up somehow and/or in some way. > > Is there any way to defend against this? Is there any way > to ensure that when a form is submitted that the submission > request originated from your site/domain and not somewhere > else? > > Any help would be greatlyl appreciated. > > Chris > Don't bother with checking the HTTP_REFERER - it can be easily forged. There is a very simple solution to this problem -- validate the data from the form! I.e. if you're expecting $foo to be an integer from 2 to 5, look at intval($foo) and see if it's >=2 and <=5. You should be doing this anyway, since who knows what the user could type in your input box. Nevermind if somebody makes a copy of your form. Never never never trust the client. Cheers Simon Garner
Would it not be possible to have both the form page and the script page that handles the form be generated o the fly with random filenames? The form page would point to the random generated script page, and the script page could delete itself after it is proccessed. You would also want a cron to delete any files in case they never bothered to submit the form. Can anyone see a problem with this? > > I can think of one way that you can take in an attempy to prevent > > this. It is not totally fool proof but it will make it more difficult > > to send spoof data: > > 1) Check your HTTP refereer when the form is submitted. If the > > referer is not from your host then don't process the form. > > Of course this can be faked quite easily if this person knows > > what (s)he doing. > > Well, this was part of what I was going to do. I was going to check > to see if the request method was post and if the referer was from > our host (not just the form/page). If all that was true, then process > the form. If not, don't. > However, I know that the $HTTP_REFERER variable is not at all > reliable. On that note, what browsers/versions would not send this > information for Apache/PHP to set? I know it is because of the browser > that the client is using that this variable is unreliable. But what those > browsers/versions are, I don't know and am hoping someone can > answer. > > Chris >
> Don't bother with checking the HTTP_REFERER - it can be easily forged. > There is a very simple solution to this problem -- validate the data from > the form! [snip] > You should be doing this anyway, since who knows what the user could > type in your input box. Nevermind if somebody makes a copy of your > form. Never never never trust the client. I'm already doing this. However, if I have a hidden variable containing a value of the current user I'm working with, that value can be changed to something else and it would pass the test. However, I need to find a way to determine if something like that has happened. That's where my description of what I was thinking of doing came from. Chris
From: "Chris" <[EMAIL PROTECTED]> > Would it not be possible to have both the form page and the script page that > handles the form be generated o the fly with random filenames? > > The form page would point to the random generated script page, and the > script page could delete itself after it is proccessed. You would also want > a cron to delete any files in case they never bothered to submit the form. > > Can anyone see a problem with this? > > That is not going to solve the problem, because a cracker can just copy and paste the random filename of the script page into their form page. Bogus form data is a problem for everyone working with html forms. You're trying to find an esoteric solution to the problem, while overlooking the obvious: just check if the data is valid. Regards Simon Garner
From: "Boget, Chris" <[EMAIL PROTECTED]> > I'm already doing this. However, if I have a hidden variable containing > a value of the current user I'm working with, that value can be changed > to something else and it would pass the test. However, I need to find a > way to determine if something like that has happened. That's where my > description of what I was thinking of doing came from. > > Chris > Does the user have a password? You need to check if the password matches as well. Cheers Simon Garner
> > I'm already doing this. However, if I have a hidden > > variable containing a value of the current user I'm > > working with, that value can be changed to something > > else and it would pass the test. However, I need to find a > > way to determine if something like that has happened. > > That's where my description of what I was thinking of > > doing came from. > Does the user have a password? You need to check if the > password matches as well. Yes, but that's not going to do me any good because it is valid for one user to act on behalf of another (as a broker, if you will). So the currently logged in user might not be the one who's ID is in the hidden field... Chris
Not really, because the script filename is deleted and changed all the time, it doesn't matter if they paste the name into the form, since the file will no longer exist. > From: "Chris" <[EMAIL PROTECTED]> > > > Would it not be possible to have both the form page and the script page > that > > handles the form be generated o the fly with random filenames? > > > > The form page would point to the random generated script page, and the > > script page could delete itself after it is proccessed. You would also > want > > a cron to delete any files in case they never bothered to submit the form. > > > > Can anyone see a problem with this? > > > > > > > > That is not going to solve the problem, because a cracker can just copy and > paste the random filename of the script page into their form page. > > Bogus form data is a problem for everyone working with html forms. You're > trying to find an esoteric solution to the problem, while overlooking the > obvious: just check if the data is valid. > > > Regards > > Simon Garner > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
No wait, I see what you mean. You're right, sometimes the obvious is missed, but it sounded cool. > From: "Chris" <[EMAIL PROTECTED]> > > > Would it not be possible to have both the form page and the script page > that > > handles the form be generated o the fly with random filenames? > > > > The form page would point to the random generated script page, and the > > script page could delete itself after it is proccessed. You would also > want > > a cron to delete any files in case they never bothered to submit the form. > > > > Can anyone see a problem with this? > > > > > > > > That is not going to solve the problem, because a cracker can just copy and > paste the random filename of the script page into their form page. > > Bogus form data is a problem for everyone working with html forms. You're > trying to find an esoteric solution to the problem, while overlooking the > obvious: just check if the data is valid. > > > Regards > > Simon Garner > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
From: "Chris" <[EMAIL PROTECTED]> > Not really, > because the script filename is deleted and changed all the time, it doesn't > matter if they paste the name into the form, since the file will no longer > exist. > It has to exist long enough for your form to post to it, which is long enough for their form to post to it as well. > Yes, but that's not going to do me any good because it is > valid for one user to act on behalf of another (as a broker, > if you will). So the currently logged in user might not be > the one who's ID is in the hidden field... So how do you verify that the logged in user is allowed to act on behalf of the other ID? You just have to keep reverifying that the client is allowed to do what they're doing. It's a chore I know - security usually is :( Cheers Simon Garner
Addressed to: Kelly Corkill <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Kelly Corkill <[EMAIL PROTECTED]> Thu, 1 Mar 2001 16:27:21 -0700 (MST) > > > I would think you should be able to write a random string to a file when the > form page is accessed, and carry a variable with the action then have the > recipient compare. Presents other challenges but should give you that > comforting feeling he was looking for. ALl that means is that I have to load your form, identify your magic number, and send it when I return the form data. That makes it a little harder, but only a little. The magic number will be in a hidden field, but hidden fields are not all that 'hidden' when you View Source. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
I'm working on a chat of sorts, and in the main frame that shows the actual messages, there is an infinite loop (while(1)) ... now, for whatever reason, when the browser is closed, the loop/thread/whatever just won't die. There are sessions involved, and the loop basically just checks a MySQL DB for new posts, and updates a timestamp in a user database. Any idea of why the loop/thread/whatever won't die? Thanks, Sean B.
In article <01030114311802.11459@kilbourne>, [EMAIL PROTECTED] ("Sean B.") wrote: > I'm working on a chat of sorts, and in the main frame that shows the actual > messages, there is an infinite loop (while(1)) ... now, for whatever reason, > when the browser is closed, the loop/thread/whatever just won't die. There > are sessions involved, and the loop basically just checks a MySQL DB for new > posts, and updates a timestamp in a user database. Any idea of why the > loop/thread/whatever won't die? PHP is server-side. It doesn't know anything about a (client-side) browser window being closed. -- CC
Hello everybody, I´m a spanish newbie in PHP. I´ve installed Apache Web Server over my Windows 2000 Server and after that I did the same with PHP4. I followed the docs step by step and I think I did everything they say. I configured php.ini and httpd.conf to suply my needs and I restarted Apache but when I runned a simply script like this: <html> <head></head> <body> <?php echo "Hola, mi primera página PHP"; phpinfo(); ?> </body> </html> The browser gave me an Internal Error, and the Apache´s error logs says: [Thu Mar 01 21:29:06 2001] [error] [client 10.0.0.3] Premature end of script headers: d:/php/php.exe I don´t known what´s wrong, anybody can help me? thanks Borja.
Hi all, I need to hide the php code, on the server. I know that php is not compiled, so, is there a way to do this?? Thanks Rene
That's the problem, I don't want the web server user or administrator to see the code. Rene Kath wrote: > You might be able to limit who the file is readable by to just the web > server user. > > ----- Original Message ----- > From: "Rene Maldonado" <[EMAIL PROTECTED]> > To: "Lista PHP" <[EMAIL PROTECTED]> > Sent: Thursday, March 01, 2001 4:02 PM > Subject: [PHP] Hiding php Code > > > Hi all, I need to hide the php code, on the server. > > > > I know that php is not compiled, so, is there a way to do this?? > > > > Thanks > > > > Rene > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
If you don't want the admin or web server user to see your code, you may want to consider Zend's Encode product (http://www.zend.com/zend/products.php#encoder) which encodes your PHP code for you. BUT, this can be rather expensive (depending on your use) and you probably still need your Administrator to install it for you, so I'm not sure if this does you any good or not. Josh Hoover KnowledgeStorm, Inc. Searching for a new IT solution for your company? Need to improve your product marketing? Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify the process for you. KnowledgeStorm - Your IT Search Starts Here > That's the problem, I don't want the web server user or > administrator to see > the code. > > Rene
Hi folks! I am facing a common problem, related to allowing my shell users to use php. I would like to prevent them from forking process. How can this be accomplished? Is there any way to get the proccess creation wrapped by suexec?
How can I set cookies during a login for fields in the a table? Example set cookie for UserID which is a file in the same table. Also how would I retrieve that info? Thanks in advance... David Smith <?php $auth = false; // Assume user is not authenticated if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) // Connect to MySQL mysql_connect( 'localhost', 'root', '******' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'indywebdesign' ) or die ( 'Unable to select database.' ); // Formulate the query $sql = "SELECT * FROM customers WHERE username = '$PHP_AUTH_USER' AND password = '$PHP_AUTH_PW'"; // Execute the query and put results in $result $result = mysql_query( $sql ) or die ( 'Unable to execute query.' ); // Get number of rows in $result. $num = mysql_numrows( $result ); if ( $num != 0 ) // A matching row was found - the user is authenticated. $auth = true; } } if ( ! $auth ) header( 'WWW-Authenticate: Basic realm="Customer Support"' ); header( 'HTTP/1.0 401 Unauthorized' ); echo 'Authorization Required.'; exit; } else echo '<!-- Login Successful -->'; } ?> David Smith Indy Web Design http://www.indywebdesign.com
Is there any way to have process started by a php script wrapped by a similar suexec utility (like in apache)? Plans to support such a funcionality? When?
Hey! I'm sending this e-mail only to you, since it's way off-topic from being in the php-general mailing list. I have downloaded Netscape 6, it seems that Logical Hebrew isn't support yet - only Visual. So if Netscape 4.x (except for the 4.61 version developed by IBM), Netscape 6, and Opera does not support Logical Hebrew why should I use it?? What do other Hebrew web sites do regarding this matter? Do they make two versions of the same web site, one for Netscape and one for IE? For conclusion - I'm working on a Hebrew website. I want this website to look ok in both browsers (IE and Netscape), and I want this to be done the easiest way possible. What should I do? Use Logical Hebrew and ignore the fact that Netscape does not support it? or maybe I should use Visual Hebrew (reverse all the Hebrew words using some utility such as - "EasyHEB"), or maybe I should use Logical Hebrew in the HTML itself and turn it to Visual using a PHP script? (doing that would be rather complicated.. hebrev() and hebrevc() aren't enough..) Thank you in advance - Aviv Revach At 17:20 01/03/01 +0200, Meir kriheli wrote: >As Boaz suggested look into hebrev and hebrevc functions. They are the only >ones I can think about right now. > >check > http://php.net/hebrev > http://php.net/hebrevc > >the manual states that this functions are defined in PHP3 and PHP4. > >HTH >-- >Meir Kriheli > > There's someone in my head, but it's not me - Pink Floyd > > >On Wednesday 28 February 2001 17:00, Aviv Revach wrote: > > Hey! > > > > Ok, I think that I will stick to logical Hebrew as most of you suggested. > > > > But still, I'm interested in knowing how could I take a HTML document which > > contains > > HTML tags, Hebrew words and English words, and reveres only the Hebrew > > words (making > > them Visual Hebrew) using only php3 functions (the server I'm using doesn't > > support php4). > > > > It would be great if anyone could point of a solution for doing that. > > By writing a script that will do that, I will both options - show the > > Hebrew in my website as Logical or use a script to translate it into visual > > Hebrew for browsers who do not support it. > > > > Thank you in advance - > > > > Aviv Revach > > > > At 16:45 01/03/01 +0200, Meir kriheli wrote: > > >On Thursday 01 March 2001 09:17, Boaz Yahav wrote: > > > > > >I think that Aviv should stick to logical hebrew (which is the standart, > > > as mentioned by Boaz). > > > > > >I don't use IE (I'm using Linux) and I can access all the logical sites > > > with no problem, including the "<html dir=rtl>" tag and the 'direction: > > > rtl' style (thank > > >god for konqueror). > > > > > >Netsacpe 6/Mozilla should support logical Hebrew pretty soon so no trouble > > >there, and if Opera wants to gain market share they shold support the > > >standart (logical) in here to. > > > > > >Altough the 3% estimate seems wrong (as noted by Manuel Lemos - Hi :-) , > > > the majority of users in Israel are using IE. > > > > > >One more problem you'll have with visaul hebrew is the ugly line breaks > > > which cause the end of the sentence to appear before the start of it. > > > > > >I had a long discussion of this subject with Manuel off this mailing list. > > > I can send you a digest of it if you wish. > > > > > >-- > > >Meir Kriheli > > > > > > There's someone in my head, but it's not me - Pink Floyd > > > > > > > Hi Manuel, > > > > > > > > All is great, working hard to make WeberDev.com a better place > > > > for the community and trying to make people understand we don't > > > > make $$$ from it :) > > > > > > > > The IE / NN war was one that left no chance for NN in Israel. > > > > While MS spent millions in making all of their products in Hebrew, > > > > including the free IE, NN refused to support Hebrew. > > > > > > > > While the 3% is correct for Israel, it's far from being true on an > > > > international basis. > > > > > > > > There are 3 large portals in Israel, 1 supports only IE (MSN), > > > > and the other two that supported NN, until not long ago, started > > > > to develop for IE only about 4-6 months ago. > > > > > > > > This is why there is no reason to support anything other than > > > > IE in Israel. > > > > > > > > With all due respect to people that like other browsers, developing > > > > for all browsers costs lots of $$$ and as long as portals are free > > > > and loosing lots of $$$ it's not profitable to develop for all. > > > > > > > > Bottom line, as the CTO of one of those portals I say go > > > > with Logical Hebrew and dump Netscape (In Israel Only). > > > > > > > > and don't forget to add the <HTML DIR="rtl"> tag at the > > > > beginning of each page. > > > > > > > > Sincerely > > > > > > > > berber > > > > > > > > Visit http://www.weberdev.com Today!!! > > > > To see where PHP might take you tomorrow. > > > > > > > > > > > > -----Original Message----- > > > > From: Manuel Lemos [mailto:[EMAIL PROTECTED]] > > > > Sent: Wednesday, February 28, 2001 10:51 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: RE: [PHP] Hebrew websites transition with php3 .. > > > > > > > > > > > > Hello Boaz, > > > > > > > > How are you doing these days? :-) > > > > > > > > On 28-Feb-01 16:39:35, you wrote: > > > > >The figures I'm giving you are from one of the two biggest portals in > > > > >Israel. > > > > >it's less than 3%. > > > > > > > > Mind me for jumping in, but I think Aviv question about the truth of > > > > the 3% figure ie very pertinent. > > > > > > > > The way I see it it is a gross mistake to assume that the audience of a > > > > large portal is necessary a reflex of the potential audience of that > > > > portal. > > > > > > > > I also work for a large portal company (not for the Hebrew audience > > > > though) and I found people making the same large mistake. They looked > > > > at the sites audience and figure that there is over 90% of Internet > > > > Explorer users in a site that used IE specific DHTML. Needless to say > > > > that it didn't show right in Netscape. > > > > > > > > Given that sites do not show right in certain browsers, it looks > > > > obvious that almost nobody using those browsers would show in the > > > > browser audience rates. > > > > > > > > I even wonder why there are still 3% of users of browsers that do not > > > > support logical Hebrew display that go to your portal. Same for the > > > > 10% of Netscape users that go to that other site in my company portal. > > > > Maybe those are just lurkers that went there and gave up on the site > > > > and did not return because they could not see right what was in there. > > > > > > > > The reality is that it turns out that there is still about 30% os > > > > Netscape users, meaning that if you force a certain type of display > > > > that they don't see right, you loose their audience. > > > > > > > > Just my .02 EUR. :-) > > > > > > > > Manuel Lemos > > > > > > > > >I'm not sure about Opera, if you are developing for an Israeli > > > > >audience, you can simply develop for IE 4.x and up. > > > > > > > > > >anyone with any other browser can go and get IE :) > > > > > > > > > >-----Original Message----- > > > > > > > > From: Aviv Revach [mailto:[EMAIL PROTECTED]] > > > > > > > > >Sent: Tuesday, February 27, 2001 4:03 PM > > > > >To: Boaz Yahav; [EMAIL PROTECTED] > > > > >Subject: RE: [PHP] Hebrew websites transition with php3 .. > > > > > > > > > > > > > > >Hey! > > > > > > > > > >Thank you for the quick reply. > > > > > > > > > >I do have some questions regarding your answer. > > > > > > > > > > From what I know and have seen so far, there are more than just 3% > > > > >Internet users in Israel which use Netscape 4.x (I use it myself...). > > > > >Are you sure that I should just ignore these people, and just use > > > > > logical Hebrew? > > > > > > > > > >Also, quite a lot of people started using Opera lately.. (ain't > > > > > speaking about Israeli users). > > > > >Does Opera supports Logical Hebrew? If so, from which version? > > > > > > > > > > > > > > >Best Regards - > > > > > > > > > > Aviv Revach > > > > > > > > > >At 15:20 28/02/01 +0200, Boaz Yahav wrote: > > > > >>Hi Aviv > > > > >> > > > > >>Let me give you a small tip about Hebrew on the net. > > > > >> > > > > >>The proper Hebrew code which was adopted by the Israeli Institute of > > > > >>Standards > > > > >>is the Logical standard. This standard is automatically supported by > > > > >> IE > > > > > > > > 4.x > > > > > > > > >>and 5.x > > > > >>and also by Netscape 6.x. > > > > >> > > > > >>The percentage of not IE4.x or 5.x users in Israel is less than 3%. > > > > >> > > > > >>3 of the major portals in Israel (Walla, Nana and MSN) are already > > > > >> moving > > > > > > > > > >to > > > > > > > > > >>logical Hebrew. > > > > >> > > > > >>So why use Visual Hebrew? > > > > >> > > > > >>In case you decide to go with Visual in any case, did you try > > > > >> hebrevc()? > > > > >> > > > > >>Sincerely > > > > >> > > > > >> berber > > > > >> > > > > >>Visit http://www.weberdev.com Today!!! > > > > >>To see where PHP might take you tomorrow. > > > > >> > > > > >> > > > > >>-----Original Message----- > > > > >>From: Aviv Revach [mailto:[EMAIL PROTECTED]] > > > > >>Sent: Tuesday, February 27, 2001 1:43 PM > > > > >>To: [EMAIL PROTECTED] > > > > >>Subject: [PHP] Hebrew websites transition with php3 .. > > > > >> > > > > >> > > > > >>Hey! > > > > >> > > > > >>I've just joined this mailing-list, therefore, first of all, I would > > > > >> like to say hello to everybody. > > > > >> > > > > >> > > > > >>Now, regarding the issue.. > > > > >> > > > > >>As some of you might know, handling with Hebrew websites is rather > > > > >>difficult. Hebrew words often come-out in reversed order (i.e. 'lmth' > > > > >>instead of 'html'). > > > > >> > > > > >>I'm working on a php3 script which would help me do the following - > > > > >>Load an existing HTML file which consists Hebrew words (as well as > > > > >> English words and HTML tags), then reversing the Hebrew words back > > > > >> to order. > > > > >> > > > > >>The problem I'm dealing with is how to reverse only the Hebrew words > > > > >> and not the entire > > > > >>document, which contains HTML tags and English words as well. > > > > >>The function 'hebrev()' does the process of reversing, but it > > > > >> reverses > > > > > > > > tags > > > > > > > > >>as well. > > > > >> > > > > >> > > > > >>I would really appreciate it, if anyone will find some spare time to > > > > >> help me. > > > > >> > > > > >> > > > > >>Thank you in advance - > > > > >> > > > > >> Aviv Revach > > > > >> > > > > >>XOR-Coders Mega Programming Resource Site! - > > > > >> http://members.xoom.com/xorcoders/ > > > > >> > > > > >> > > > > >>-- > > > > >>PHP General Mailing List (http://www.php.net/) > > > > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > >>To contact the list administrators, e-mail: > > > > >> [EMAIL PROTECTED] > > > > > > > > > >XOR-Coders Mega Programming Resource Site! - > > > > > http://members.xoom.com/xorcoders/ > > > > > > > > > >-- > > > > >PHP General Mailing List (http://www.php.net/) > > > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > >To contact the list administrators, e-mail: > > > > > [EMAIL PROTECTED] > > > > > > > > Regards, > > > > Manuel Lemos > > > > > > > > Web Programming Components using PHP Classes. > > > > Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED] > > > > -- > > > > E-mail: [EMAIL PROTECTED] > > > > URL: http://www.mlemos.e-na.net/ > > > > PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp > > > > -- > > > > XOR-Coders Mega Programming Resource Site! - > > http://members.xoom.com/xorcoders/ XOR-Coders Mega Programming Resource Site! - http://members.xoom.com/xorcoders/
Shu! When I try to use the function ImageGif() I get the following error: Warning: ImageGif: No GIF support in this PHP build... I'm using win2k with php4 width the gd module enabled in php.ini What can I do to make this problem go away? Thanks in advance /Broder
what version do you have? gd > 1.3 (if memory serves correct) only supports PNG ~jack -----Original Message----- From: Jimmy Bäckström [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 5:20 PM To: PHP General List Subject: [PHP] ImageGif: No GIF support in this PHP build Shu! When I try to use the function ImageGif() I get the following error: Warning: ImageGif: No GIF support in this PHP build... I'm using win2k with php4 width the gd module enabled in php.ini What can I do to make this problem go away? Thanks in advance /Broder
sorry, clarification, not "only" PNG, but they've moved away from GIF... ~jack -----Original Message----- From: Jack Dempsey [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 5:27 PM To: PHP General List; Jimmy Bäckström Subject: RE: [PHP] ImageGif: No GIF support in this PHP build what version do you have? gd > 1.3 (if memory serves correct) only supports PNG ~jack -----Original Message----- From: Jimmy Bäckström [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 5:20 PM To: PHP General List Subject: [PHP] ImageGif: No GIF support in this PHP build Shu! When I try to use the function ImageGif() I get the following error: Warning: ImageGif: No GIF support in this PHP build... I'm using win2k with php4 width the gd module enabled in php.ini What can I do to make this problem go away? Thanks in advance /Broder -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
On Thu, 1 Mar 2001, Meir kriheli wrote: > I use both of the databases (Interbase 6.01 and PostgreSQL 7.1beta4). > > PostgreSQL has more features comapared to Interbase (the procedureal language > is very robust and there are many datatyps to choose from. Also you can have > some kind of object support in it to inherit tables for example), but it's > windows implemenation is very hard (at least for me, I like to compile it). Postgres also has a nasty show-stopping bug they don't seem to want to fix. Try making a stored procedure with many parameters, and send a single null to it. I dare you. I so love having all of my other parameters, and the return value of the function turned into null because postgres can't tell where a null occoured. I also love the fact that you can't drop foreign keys, modify columns, drop columns without rebuilding the entire table, etc. We use it here, but it makes me want to pull my hair out. If someone would just combine postgres and mysql, we'd have the best database in the universe. Fast and stable, with all of the RDBMS anyone could want. But as it stands, postgres is still a bit player with an incomplete feature set. But I don't want to start a holy war here, so I'll drop it. > As for speed both are very fast (even when compared to commerical DB, in my > tests the deafult install of Interbase outperfomed the default install of > Oracle 8i about 10X, tested on P166 with 96MB and PII400 with 192MB). This only occours if you don't know how to optimize Oracle. Oracle is *very* picky about *everything*. You need index tablespaces on separate disks from the data tablespaces, and yet another one for system tablespaces. You should also have one for archive logs, redo logs, and of course your temporary tables. Setting it to threading mode is also nice for connection pooling and to stop killing your machine under heavy load. That, and the machines you've quoted are in no way powerful enough for production Oracle databases, period. You should also run oracle on some kind of Solaris/Sun combo. Raw mount points direct to the actual disks is ideal, but loopback filesystems work just as well. Remember to cluster your raid into 4 - 6 arrays of 3+ disks, too. There is no such thing as a default Oracle install, because installing oracle on a single user machine with one disk and only a little ram (yes, anything under 512 is very little for Oracle) will make Oracle look like a piece of crap. The point about Oracle is that it *lets* you do all of those optimizations, and if you're good at it, it will outperform almost any other database you throw at it. Trust me on this one. -- +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ | Shaun M. Thomas INN Database Programmer | | Phone: (309) 743-0812 Fax : (309) 743-0830 | | Email: [EMAIL PROTECTED] AIM : trifthen | | Web : hamster.lee.net | | | | "Most of our lives are about proving something, either to | | "ourselves or to someone else." | | -- Anonymous | +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+
From: "Shaun Thomas" <[EMAIL PROTECTED]> > The point about Oracle is that it *lets* you do all of those > optimizations, and if you're good at it, it will outperform almost any > other database you throw at it. Trust me on this one. I'm sorry, I can't trust you very much on this. Having worked as a high-end Oracle tuner on a 1 terabyte database for 3 years and having recently been involved in a new DB2 app, I find DB2 to be as good if not better than Oracle in very many important ways. Not even including a cost that's about 1/4 of a highly discounted Oracle cost model for an identical HA envioronment. Mark C.
How do you do it? I'm running PHP on NT4, and if I call a cgi from the command line it doesn't read the config file. Is there a command to use that loads the config file? Regards, Tyson Lloyd Thwaites IT&e Limited e-Commerce Division Adelaide (08) 8346 3888
Hi. I use this function with the strings I'll be showing in tables to cut strings too long without spaces. To make it clear: <table width="50"><tr><td><?=$str?></td></tr></table> The table will be 50px width if $str isn't too long. Let's say: $str="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" The table goes to hell. So: function cut_text($res,$long=15,$max=20){ if ($max<=$long){$max=$long+2;} $ant=""; while ($res!=$ant){ $ant=$res; $res=addslashes($res); $res= preg_replace ("/(\w){".$max.",}/im","'.substr (\\0,0,$long).' '.substr (\\0,$long,strlen('\\0')-$long).'",$res); $res=" return '$res';"; $res=eval($res); } return $res; } For example: $str="Hello Howwwwwwwwwwwww arrrrreeeeeee yyyooooooouuuuuu"; echo cut_text($str,7,10); Results in: Hello Howwwww wwwwwwww arrrrre eeeeee yyyoooo ooouuuuuu The idea is: any word longer than 20 chars will split into a chunk of 15 and a chunk of 5. If you have a 45 chars string, it will leave you with 20, 20 and 5. It works fine with simple text, but with characters like ", / , $, etc. sometimes I have problems. I tried with quotemeta instead of addslashes but the problem persists. Anyone have an idea?. If you want to test the code, just try with Testing \" quotes Thanks in advance Juan I. Germano [EMAIL PROTECTED]
Hi. I use this function with the strings I'll be showing in tables to cut strings too long without spaces. To make it clear: <table width="50"><tr><td><?=$str?></td></tr></table> The table will be 50px width if $str isn't too long. Let's say: $str="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" The table goes to hell. So: function cut_text($res,$long=15,$max=20){ if ($max<=$long){$max=$long+2;} $ant=""; while ($res!=$ant){ $ant=$res; $res=addslashes($res); $res= preg_replace ("/(\w){".$max.",}/im","'.substr (\\0,0,$long).' '.substr (\\0,$long,strlen('\\0')-$long).'",$res); $res=" return '$res';"; $res=eval($res); } return $res; } For example: $str="Hello Howwwwwwwwwwwww arrrrreeeeeee yyyooooooouuuuuu"; echo cut_text($str,7,10); Results in: Hello Howwwww wwwwwwww arrrrre eeeeee yyyoooo ooouuuuuu The idea is: any word longer than 20 chars will split into a chunk of 15 and a chunk of 5. If you have a 45 chars string, it will leave you with 20, 20 and 5. It works fine with simple text, but with characters like ", / , $, etc. sometimes I have problems. I tried with quotemeta instead of addslashes but the problem persists. Anyone have an idea?. If you want to test the code, just try with Testing \" quotes Thanks in advance Juan I. Germano [EMAIL PROTECTED]
I dont know how to do this, but Ive tried several things with no success. I need to validate several form fields and here is the script I'm working with... <?php if($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") { (eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $Email))? header("Location: http://www.site.com/thanks.php"): header("Location: http://www.site.com/error.php"); } ;?> I need to check at least two more fields, possibly 3 but I keep getting errors when trying to loop through a bunch of if statements. The above works fine but I need to check eregi() against more strings from fields which then redirects as shown above. Anyone? _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
From: "W.D." <[EMAIL PROTECTED]> > I dont know how to do this, but Ive tried several things with no success. I > need to validate several form fields and here is the script I'm working > with... > > <?php if($HTTP_SERVER_VARS["REQUEST_METHOD"] == "POST") > { > (eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,3}$", $Email))? > header("Location: http://www.site.com/thanks.php"): > header("Location: http://www.site.com/error.php"); > } > ;?> > > I need to check at least two more fields, possibly 3 but I keep getting > errors when trying to loop through a bunch of if statements. The above works > fine but I need to check eregi() against more strings from fields which then > redirects as shown above. Anyone? > <?php if (getenv("REQUEST_METHOD") == "POST") { if ( eregi("pattern1", $field1) && eregi("pattern2", $field2) && eregi("pattern3", $field3) ) { echo "thanks"; } else { echo "error!"; } } ?> Or if you want better error reporting: <?php if (getenv("REQUEST_METHOD") == "POST") { $errors = array(); if (!eregi("pattern1", $field1)) { $errors[] = "field1 is not right"; } if (!eregi("pattern2", $field2)) { $errors[] = "field2 is not right"; } if (!eregi("pattern3", $field3)) { $errors[] = "field3 is not right"; } if (count($errors) > 0) { echo "Sorry, " . count($errors) . " errors occurred, please try again.\n<ul>"; foreach ($errors as $err) { echo "<li>$err\n"; } echo "</ul>"; } } ?>
I am looking into sessions at the moment and havn´t got it all working properly to continue my journey. I´m having problem with the session_destroy(), and after some searching in the archive, I found out that other people have had this problem aswell, but I didn´t find a fix... Here is the error message I get: Warning: Session object destruction failed in E:\Inetpub\wwwroot\testscript\sessions\test.php on line 5 Here is my code: <?php session_start(); session_register("value"); session_unregister("value"); session_destroy(); ?> Is this error caused by php.ini, my webserver or other? My configuration: IIS 5 for Win2k PHP 4.0.3 PL 1 Thanks // Tobbe
At 01:25 02.03.2001, Tobias Talltorp said: --------------------[snip]-------------------- ><?php >session_start(); >session_register("value"); >session_unregister("value"); >session_destroy(); >?> --------------------[snip]-------------------- Why would you want to create and destroy the session data during a single request? That simply doesn't make sense - session persistence is designed to keep registered session data available across _a_series_ requests. I believe PHP chokes at session_destroy() since the session save file has not yet been created, and thus deleting the session data returns an error code. Try this - it should work: <?php if ($isset($value)) { echo "thanks"; session_destroy(); } else { $value = 12; echo "<form><input type=hidden name=value value=$value>"; echo "input type=submit></form>"; session_start(); session_register($value); } ?> ...ebird >O Ernest E. Vogelsinger (\) http://www.1-at-web.at/ ^ ICQ# 13394035
> Why would you want to create and destroy the session data during a single > request? That simply doesn't make sense - session persistence is designed > to keep registered session data available across _a_series_ requests. This I know, but it was just to show what I wanted to do. > I believe PHP chokes at session_destroy() since the session save file has > not yet been created, and thus deleting the session data returns an error code. I first got the problem when I tried this tutorial at Zend: http://www.zend.com/zend/tut/session.php I found it funny that a tutorial about sessions had such a "bug", since it was supposed to cover this feature. Complete source can be downloaded here: http://www.phpwizard.net/resources/tutorials/session_intro.html I had to change some in your code (lines marked with >>)... <?php // removed $ from $isset >> if (isset($value)) { echo "thanks"; session_destroy(); } else { // These were below the echo before... >> session_start(); >> session_register($value); $value = 12; echo "<form><input type=hidden name=value value=$value>"; echo "input type=submit></form>"; } ?> Error message: Warning: Trying to destroy uninitialized session in E:\Inetpub\wwwroot\testscript\sessions\test.php on line 4 Just a thought... Could it have anything with the session.save_path? session.save_path =e:\Temp\sessions Regards, // Tobias
Hi. I use this function with the strings I'll be showing in tables to cut strings too long without spaces. To make it clear: <table width="50"><tr><td><?=$str?></td></tr></table> The table will be 50px width if $str isn't too long. Let's say: $str="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" The table goes to hell. So: function cut_text($res,$long=15,$max=20){ if ($max<=$long){$max=$long+2;} $ant=""; while ($res!=$ant){ $ant=$res; $res=addslashes($res); $res= preg_replace ("/(\w){".$max.",}/im","'.substr (\\0,0,$long).' '.substr (\\0,$long,strlen('\\0')-$long).'",$res); $res=" return '$res';"; $res=eval($res); } return $res; } For example: $str="Hello Howwwwwwwwwwwww arrrrreeeeeee yyyooooooouuuuuu"; echo cut_text($str,7,10); Results in: Hello Howwwww wwwwwwww arrrrre eeeeee yyyoooo ooouuuuuu The idea is: any word longer than 20 chars will split into a chunk of 15 and a chunk of 5. If you have a 45 chars string, it will leave you with 20, 20 and 5. It works fine with simple text, but with characters like ", / , $, etc. sometimes I have problems. I tried with quotemeta instead of addslashes but the problem persists. Anyone have an idea?. If you want to test the code, just try with Testing \" quotes Thanks in advance Juan I. Germano [EMAIL PROTECTED]
Juan, I'm not sure, but isn't there a wrap function? ----- Original Message ----- From: Juan Germano <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 01, 2001 6:29 PM Subject: [PHP] Cutting long strings for tables > Hi. I use this function with the strings I'll be showing in tables to cut > strings too long without spaces. > To make it clear: > > <table width="50"><tr><td><?=$str?></td></tr></table> > > The table will be 50px width if $str isn't too long. Let's say: > $str="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > The table goes to hell. > So: > function cut_text($res,$long=15,$max=20){ > if ($max<=$long){$max=$long+2;} > $ant=""; > while ($res!=$ant){ > $ant=$res; > $res=addslashes($res); > $res= preg_replace ("/(\w){".$max.",}/im","'.substr (\\0,0,$long).' > '.substr (\\0,$long,strlen('\\0')-$long).'",$res); > $res=" return '$res';"; > $res=eval($res); > } > return $res; > } > > For example: > $str="Hello Howwwwwwwwwwwww arrrrreeeeeee yyyooooooouuuuuu"; > echo cut_text($str,7,10); > Results in: > Hello Howwwww wwwwwwww arrrrre eeeeee yyyoooo ooouuuuuu > > The idea is: any word longer than 20 chars will split into a chunk of 15 > and a chunk of 5. If you have a 45 chars string, it will leave you with 20, > 20 and 5. > It works fine with simple text, but with characters like ", / , $, etc. > sometimes I have problems. I tried with quotemeta instead of addslashes but > the problem persists. Anyone have an idea?. If you want to test the code, > just try with > Testing \" quotes > > Thanks in advance > > Juan I. Germano > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED]
Okay - Im writing an object to wrap a database. The key problem is this: - it declares a connection var as an object property - the open() function opens the connection to the database and stores the handle in $this->connection - the executeQuery() method complains about not having a valid handle, because by then, somehow, $this->connection==null!!! Any ideas?-i swear its just something stupid ive missed ... HELP! Thanx in advance, AndrewH ------------------------------------------------------------- The code following this returns the following to the browser: ------------------------------------------------------------- The connection in open() is :Resource id #1 The connection in executeQuery() is :'' Warning: Supplied argument is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 ------------------------------------------------------------- class PostgreSQLDataSource { var $connection; var $lastResultSet; var $error_handler; var $host, $port, $username, $password, $database; function PostgreSQLDataSource($host, $port, $username, $password, $database) { global $error_handler; $this->error_handler = $error_handler; $this->host = $host; $this->port = $port; $this->username = $username; $this->password = $password; $this->database = $database; //Legacy behaviour: $this->open($host, $port, $username, $password, $database); } function open(/*variable arg list*/) { $connectionString = ""; if (func_num_args() == 5) { $this->host = func_get_arg(0); $this->port = func_get_arg(1); $this->username = func_get_arg(2); $this->password = func_get_arg(3); $this->database = func_get_arg(4); } if ($this->host) $connectionString .= " host=".$this->host; if ($this->port) $connectionString .= " port=".$this->port; if ($this->username) $connectionString .= " user=".$this->username; if ($this->password) $connectionString .= " password=".$this->password; if ($this->database) $connectionString .= " dbname=".$this->database; $this->connection = pg_Connect($connectionString); echo "The connection in open() is :".$this->connection."<BR>"; if ($this->connection == false) return false; else return true; } function close() { return pg_Close($this->connection); } function executeQuery($queryString) { echo "The connection in executeQuery() is :'".$this->connection."'<BR>"; $this->lastResultSet = pg_exec($this->connection,$queryString); return new Iterator($this); } /*PRIVATE FUNCTIONS:*/ function getRow($row) { return pg_fetch_array($this->lastResultSet,$row); } function getResultLength() { return count($this->lastResultSet); } }
Andrew, What is the open() function? Best regards, Andrew --------------------------------------- Andrew Hill - OpenLink Software Director Technology Evangelism eBusiness Infrastructure Technology http://www.openlinksw.com On 3/1/01 7:27 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > Okay - Im writing an object to wrap a database. > The key problem is this: > - it declares a connection var as an object property > - the open() function opens the connection to the database and stores > the handle in $this->connection > - the executeQuery() method complains about not having a valid handle, > because by then, somehow, $this->connection==null!!! > > Any ideas?-i swear its just something stupid ive missed ... > > HELP! > > Thanx in advance, > AndrewH > > ------------------------------------------------------------- > The code following this returns the following to the browser: > ------------------------------------------------------------- > The connection in open() is :Resource id #1 > The connection in executeQuery() is :'' > > Warning: Supplied argument is not a valid PostgreSQL link resource in > /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > > > ------------------------------------------------------------- > > > class PostgreSQLDataSource > { > var $connection; > var $lastResultSet; > var $error_handler; > > var $host, $port, $username, $password, $database; > > function PostgreSQLDataSource($host, $port, $username, $password, > $database) > { > global $error_handler; > $this->error_handler = $error_handler; > > $this->host = $host; > $this->port = $port; > $this->username = $username; > $this->password = $password; > $this->database = $database; > > //Legacy behaviour: $this->open($host, $port, $username, $password, > $database); > } > > function open(/*variable arg list*/) > { > $connectionString = ""; > > if (func_num_args() == 5) > { > $this->host = func_get_arg(0); > $this->port = func_get_arg(1); > $this->username = func_get_arg(2); > $this->password = func_get_arg(3); > $this->database = func_get_arg(4); > } > > if ($this->host) > $connectionString .= " host=".$this->host; > if ($this->port) > $connectionString .= " port=".$this->port; > if ($this->username) > $connectionString .= " user=".$this->username; > if ($this->password) > $connectionString .= " password=".$this->password; > if ($this->database) > $connectionString .= " dbname=".$this->database; > > $this->connection = pg_Connect($connectionString); > echo "The connection in open() is :".$this->connection."<BR>"; > if ($this->connection == false) > return false; > else > return true; > } > > function close() > { > return pg_Close($this->connection); > } > > function executeQuery($queryString) > { > echo "The connection in executeQuery() is :'".$this->connection."'<BR>"; > $this->lastResultSet = pg_exec($this->connection,$queryString); > return new Iterator($this); > } > > /*PRIVATE FUNCTIONS:*/ > function getRow($row) > { > return pg_fetch_array($this->lastResultSet,$row); > } > > function getResultLength() > { > return count($this->lastResultSet); > } > } > > > >
open() is simply supposed to open the connection to the database and store it in $this->connection. As you can see - it gets the connection info from either the objects properties or from parameters passed to it. Can you see what Ive done wrong...if anything?!?! AndrewH ----- Original Message ----- From: "Andrew Hill" <[EMAIL PROTECTED]> To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 02, 2001 11:13 AM Subject: Re: [PHP] Loss of connection handle object > Andrew, > > What is the open() function? > > Best regards, > Andrew > --------------------------------------- > Andrew Hill - OpenLink Software > Director Technology Evangelism > eBusiness Infrastructure Technology > http://www.openlinksw.com > > > > > On 3/1/01 7:27 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > > > Okay - Im writing an object to wrap a database. > > The key problem is this: > > - it declares a connection var as an object property > > - the open() function opens the connection to the database and stores > > the handle in $this->connection > > - the executeQuery() method complains about not having a valid handle, > > because by then, somehow, $this->connection==null!!! > > > > Any ideas?-i swear its just something stupid ive missed ... > > > > HELP! > > > > Thanx in advance, > > AndrewH > > > > ------------------------------------------------------------- > > The code following this returns the following to the browser: > > ------------------------------------------------------------- > > The connection in open() is :Resource id #1 > > The connection in executeQuery() is :'' > > > > Warning: Supplied argument is not a valid PostgreSQL link resource in > > /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > > > > > > ------------------------------------------------------------- > > > > > > class PostgreSQLDataSource > > { > > var $connection; > > var $lastResultSet; > > var $error_handler; > > > > var $host, $port, $username, $password, $database; > > > > function PostgreSQLDataSource($host, $port, $username, $password, > > $database) > > { > > global $error_handler; > > $this->error_handler = $error_handler; > > > > $this->host = $host; > > $this->port = $port; > > $this->username = $username; > > $this->password = $password; > > $this->database = $database; > > > > //Legacy behaviour: $this->open($host, $port, $username, $password, > > $database); > > } > > > > function open(/*variable arg list*/) > > { > > $connectionString = ""; > > > > if (func_num_args() == 5) > > { > > $this->host = func_get_arg(0); > > $this->port = func_get_arg(1); > > $this->username = func_get_arg(2); > > $this->password = func_get_arg(3); > > $this->database = func_get_arg(4); > > } > > > > if ($this->host) > > $connectionString .= " host=".$this->host; > > if ($this->port) > > $connectionString .= " port=".$this->port; > > if ($this->username) > > $connectionString .= " user=".$this->username; > > if ($this->password) > > $connectionString .= " password=".$this->password; > > if ($this->database) > > $connectionString .= " dbname=".$this->database; > > > > $this->connection = pg_Connect($connectionString); > > echo "The connection in open() is :".$this->connection."<BR>"; > > if ($this->connection == false) > > return false; > > else > > return true; > > } > > > > function close() > > { > > return pg_Close($this->connection); > > } > > > > function executeQuery($queryString) > > { > > echo "The connection in executeQuery() is :'".$this->connection."'<BR>"; > > $this->lastResultSet = pg_exec($this->connection,$queryString); > > return new Iterator($this); > > } > > > > /*PRIVATE FUNCTIONS:*/ > > function getRow($row) > > { > > return pg_fetch_array($this->lastResultSet,$row); > > } > > > > function getResultLength() > > { > > return count($this->lastResultSet); > > } > > } > > > > > > > > >
From: "Andrew Halliday" <[EMAIL PROTECTED]> > Okay - Im writing an object to wrap a database. > The key problem is this: > - it declares a connection var as an object property > - the open() function opens the connection to the database and stores > the handle in $this->connection > - the executeQuery() method complains about not having a valid handle, > because by then, somehow, $this->connection==null!!! > > Any ideas?-i swear its just something stupid ive missed ... > > HELP! > > Thanx in advance, > AndrewH > > ------------------------------------------------------------- > The code following this returns the following to the browser: > ------------------------------------------------------------- > The connection in open() is :Resource id #1 > The connection in executeQuery() is :'' > > Warning: Supplied argument is not a valid PostgreSQL link resource in > /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > > > ------------------------------------------------------------- > What happens if you do: <?php $db = new PostgreSQLDataSource("host", "port", "user", "pass", "db"); $db->open(); echo $db->connection; ?> Cheers Simon Garner
Perhaps if you showed us some code? Best regards, Andrew On 3/1/01 7:35 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > open() is simply supposed to open the connection to the database and store > it in $this->connection. > As you can see - it gets the connection info from either the objects > properties or from parameters passed to it. > Can you see what Ive done wrong...if anything?!?! > > AndrewH > > ----- Original Message ----- > From: "Andrew Hill" <[EMAIL PROTECTED]> > To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, March 02, 2001 11:13 AM > Subject: Re: [PHP] Loss of connection handle object > > >> Andrew, >> >> What is the open() function? >> >> Best regards, >> Andrew >> --------------------------------------- >> Andrew Hill - OpenLink Software >> Director Technology Evangelism >> eBusiness Infrastructure Technology >> http://www.openlinksw.com >> >> >> >> >> On 3/1/01 7:27 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: >> >>> Okay - Im writing an object to wrap a database. >>> The key problem is this: >>> - it declares a connection var as an object property >>> - the open() function opens the connection to the database and stores >>> the handle in $this->connection >>> - the executeQuery() method complains about not having a valid handle, >>> because by then, somehow, $this->connection==null!!! >>> >>> Any ideas?-i swear its just something stupid ive missed ... >>> >>> HELP! >>> >>> Thanx in advance, >>> AndrewH >>> >>> ------------------------------------------------------------- >>> The code following this returns the following to the browser: >>> ------------------------------------------------------------- >>> The connection in open() is :Resource id #1 >>> The connection in executeQuery() is :'' >>> >>> Warning: Supplied argument is not a valid PostgreSQL link resource in >>> /var/wwwroot/php/PostgreSQLDataSource.php on line 67 >>> >>> >>> ------------------------------------------------------------- >>> >>> >>> class PostgreSQLDataSource >>> { >>> var $connection; >>> var $lastResultSet; >>> var $error_handler; >>> >>> var $host, $port, $username, $password, $database; >>> >>> function PostgreSQLDataSource($host, $port, $username, $password, >>> $database) >>> { >>> global $error_handler; >>> $this->error_handler = $error_handler; >>> >>> $this->host = $host; >>> $this->port = $port; >>> $this->username = $username; >>> $this->password = $password; >>> $this->database = $database; >>> >>> //Legacy behaviour: $this->open($host, $port, $username, $password, >>> $database); >>> } >>> >>> function open(/*variable arg list*/) >>> { >>> $connectionString = ""; >>> >>> if (func_num_args() == 5) >>> { >>> $this->host = func_get_arg(0); >>> $this->port = func_get_arg(1); >>> $this->username = func_get_arg(2); >>> $this->password = func_get_arg(3); >>> $this->database = func_get_arg(4); >>> } >>> >>> if ($this->host) >>> $connectionString .= " host=".$this->host; >>> if ($this->port) >>> $connectionString .= " port=".$this->port; >>> if ($this->username) >>> $connectionString .= " user=".$this->username; >>> if ($this->password) >>> $connectionString .= " password=".$this->password; >>> if ($this->database) >>> $connectionString .= " dbname=".$this->database; >>> >>> $this->connection = pg_Connect($connectionString); >>> echo "The connection in open() is :".$this->connection."<BR>"; >>> if ($this->connection == false) >>> return false; >>> else >>> return true; >>> } >>> >>> function close() >>> { >>> return pg_Close($this->connection); >>> } >>> >>> function executeQuery($queryString) >>> { >>> echo "The connection in executeQuery() is :'".$this->connection."'<BR>"; >>> $this->lastResultSet = pg_exec($this->connection,$queryString); >>> return new Iterator($this); >>> } >>> >>> /*PRIVATE FUNCTIONS:*/ >>> function getRow($row) >>> { >>> return pg_fetch_array($this->lastResultSet,$row); >>> } >>> >>> function getResultLength() >>> { >>> return count($this->lastResultSet); >>> } >>> } >>> >>> >>> >>> >> >
> <?php > $db = new PostgreSQLDataSource("host", "port", "user", "pass", "db"); > $db->open(); > > echo $db->connection; > ?> returns : Resource id #1 ... which is what would be expected ... The wierd thing is the result i get from my test script: --------------------------------- $manualNameTest = new AbstractDataSourceManager("PostgreSQLDataSource","","","wwwuser","","rp2"); $result = $manualNameTest->executeQuery("select * from requirements;"); $db = new PostgreSQLDataSource('','','wwwuser','','rp2'); $db->open(); echo $db->connection."<BR>"; echo $db->executeQuery("select * from requirements;"); ------------------------------------- returns: ------------------------------------ The connection in open() is :Resource id #1 connection in executeQuery() is :'' Warning: Supplied argument is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 The connection in open() is :Resource id #1 Resource id #1 The connection in executeQuery() is :'Resource id #1' Warning: 1 is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 Object ------------------------------ WHAT THE HELL IS GOING ON ?!?!?!?! AARGH! AndrewH ----- Original Message ----- From: "Simon Garner" <[EMAIL PROTECTED]> To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 02, 2001 11:15 AM Subject: Re: [PHP] Loss of connection handle object > From: "Andrew Halliday" <[EMAIL PROTECTED]> > > > Okay - Im writing an object to wrap a database. > > The key problem is this: > > - it declares a connection var as an object property > > - the open() function opens the connection to the database and stores > > the handle in $this->connection > > - the executeQuery() method complains about not having a valid handle, > > because by then, somehow, $this->connection==null!!! > > > > Any ideas?-i swear its just something stupid ive missed ... > > > > HELP! > > > > Thanx in advance, > > AndrewH > > > > ------------------------------------------------------------- > > The code following this returns the following to the browser: > > ------------------------------------------------------------- > > The connection in open() is :Resource id #1 > > The connection in executeQuery() is :'' > > > > Warning: Supplied argument is not a valid PostgreSQL link resource in > > /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > > > > > > ------------------------------------------------------------- > > > > > What happens if you do: > > <?php > $db = new PostgreSQLDataSource("host", "port", "user", "pass", "db"); > $db->open(); > > echo $db->connection; > ?> > > > Cheers > > Simon Garner >
Well, you already have code to PostgreSQLDataSource ... the other object just encapsulates it ... ok heres some more code: class AbstractDataSourceManager { var $dataSourceName; var $dataSource; var $error_handler; ... function open() { <make $dataSource object with connection params> if (is_Object($dataSource)) return $dataSource->open(); else return false; } function executeQuery( $queryString ) { return $this->dataSource->executeQuery($queryString); } } -------------------- Test Code: if ($HTTP_GET_VARS["testno"]==7) { $manualNameTest = new AbstractDataSourceManager("PostgreSQLDataSource","","","wwwuser","","rp2"); $result = $manualNameTest->executeQuery("select * from requirements;"); $db = new PostgreSQLDataSource('','','wwwuser','','template1'); $db->open(); echo $db->connection."<BR>"; echo $db->executeQuery("select * from issues;"); } ---------------------- Test Output: The connection in open() is :Resource id #1 The connection in executeQuery() is :'' Warning: Supplied argument is not a valid PostgreSQL link resource in /var/wwwroot/php/PostgreSQLDataSource.php on line 67 <this is the pg_pConnect line...> The connection in open() is :Resource id #2 Resource id #2 The connection in executeQuery() is :'Resource id #2' Object ---------------- So in other words, the one using the encapsulator doesnt work - it seems to lose $this->connection in PostgreSQLDataSource when its contained in AbstractDataSourceManager ! ... theres something screwball here - i mean - an object should be able to access its own properties in any scope at any time shouldnt it ? This is totally screwing me here ... AndrewH ----- Original Message ----- From: "Andrew Hill" <[EMAIL PROTECTED]> To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 02, 2001 11:53 AM Subject: Re: [PHP] Loss of connection handle object > Perhaps if you showed us some code? > > Best regards, > Andrew > > > On 3/1/01 7:35 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > > > open() is simply supposed to open the connection to the database and store > > it in $this->connection. > > As you can see - it gets the connection info from either the objects > > properties or from parameters passed to it. > > Can you see what Ive done wrong...if anything?!?! > > > > AndrewH > > > > ----- Original Message ----- > > From: "Andrew Hill" <[EMAIL PROTECTED]> > > To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Friday, March 02, 2001 11:13 AM > > Subject: Re: [PHP] Loss of connection handle object > > > > > >> Andrew, > >> > >> What is the open() function? > >> > >> Best regards, > >> Andrew > >> --------------------------------------- > >> Andrew Hill - OpenLink Software > >> Director Technology Evangelism > >> eBusiness Infrastructure Technology > >> http://www.openlinksw.com > >> > >> > >> > >> > >> On 3/1/01 7:27 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > >> > >>> Okay - Im writing an object to wrap a database. > >>> The key problem is this: > >>> - it declares a connection var as an object property > >>> - the open() function opens the connection to the database and stores > >>> the handle in $this->connection > >>> - the executeQuery() method complains about not having a valid handle, > >>> because by then, somehow, $this->connection==null!!! > >>> > >>> Any ideas?-i swear its just something stupid ive missed ... > >>> > >>> HELP! > >>> > >>> Thanx in advance, > >>> AndrewH > >>> > >>> ------------------------------------------------------------- > >>> The code following this returns the following to the browser: > >>> ------------------------------------------------------------- > >>> The connection in open() is :Resource id #1 > >>> The connection in executeQuery() is :'' > >>> > >>> Warning: Supplied argument is not a valid PostgreSQL link resource in > >>> /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > >>> > >>> > >>> ------------------------------------------------------------- > >>> > >>> > >>> class PostgreSQLDataSource > >>> { > >>> var $connection; > >>> var $lastResultSet; > >>> var $error_handler; > >>> > >>> var $host, $port, $username, $password, $database; > >>> > >>> function PostgreSQLDataSource($host, $port, $username, $password, > >>> $database) > >>> { > >>> global $error_handler; > >>> $this->error_handler = $error_handler; > >>> > >>> $this->host = $host; > >>> $this->port = $port; > >>> $this->username = $username; > >>> $this->password = $password; > >>> $this->database = $database; > >>> > >>> //Legacy behaviour: $this->open($host, $port, $username, $password, > >>> $database); > >>> } > >>> > >>> function open(/*variable arg list*/) > >>> { > >>> $connectionString = ""; > >>> > >>> if (func_num_args() == 5) > >>> { > >>> $this->host = func_get_arg(0); > >>> $this->port = func_get_arg(1); > >>> $this->username = func_get_arg(2); > >>> $this->password = func_get_arg(3); > >>> $this->database = func_get_arg(4); > >>> } > >>> > >>> if ($this->host) > >>> $connectionString .= " host=".$this->host; > >>> if ($this->port) > >>> $connectionString .= " port=".$this->port; > >>> if ($this->username) > >>> $connectionString .= " user=".$this->username; > >>> if ($this->password) > >>> $connectionString .= " password=".$this->password; > >>> if ($this->database) > >>> $connectionString .= " dbname=".$this->database; > >>> > >>> $this->connection = pg_Connect($connectionString); > >>> echo "The connection in open() is :".$this->connection."<BR>"; > >>> if ($this->connection == false) > >>> return false; > >>> else > >>> return true; > >>> } > >>> > >>> function close() > >>> { > >>> return pg_Close($this->connection); > >>> } > >>> > >>> function executeQuery($queryString) > >>> { > >>> echo "The connection in executeQuery() is :'".$this->connection."'<BR>"; > >>> $this->lastResultSet = pg_exec($this->connection,$queryString); > >>> return new Iterator($this); > >>> } > >>> > >>> /*PRIVATE FUNCTIONS:*/ > >>> function getRow($row) > >>> { > >>> return pg_fetch_array($this->lastResultSet,$row); > >>> } > >>> > >>> function getResultLength() > >>> { > >>> return count($this->lastResultSet); > >>> } > >>> } > >>> > >>> > >>> > >>> > >> > > >
Ahh dont worry - figured it out!!! If anyone cares: In the encapsulating class i had two copies of the same variable and i was calling the local copy of open() not the object version ... AARGH ----- Original Message ----- From: "Andrew Halliday" <[EMAIL PROTECTED]> To: "Andrew Hill" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 02, 2001 12:18 PM Subject: Re: [PHP] Loss of connection handle object > Well, you already have code to PostgreSQLDataSource ... the other object > just encapsulates it ... > > ok heres some more code: > > class AbstractDataSourceManager > { > var $dataSourceName; > var $dataSource; > var $error_handler; > > ... > > function open() > { > <make $dataSource object with connection params> > > if (is_Object($dataSource)) > return $dataSource->open(); > else > return false; > } > > function executeQuery( $queryString ) > { > return $this->dataSource->executeQuery($queryString); > } > } > > -------------------- > Test Code: > > if ($HTTP_GET_VARS["testno"]==7) > { > $manualNameTest = new > AbstractDataSourceManager("PostgreSQLDataSource","","","wwwuser","","rp2"); > $result = $manualNameTest->executeQuery("select * from requirements;"); > > $db = new PostgreSQLDataSource('','','wwwuser','','template1'); > $db->open(); > echo $db->connection."<BR>"; > echo $db->executeQuery("select * from issues;"); > } > > ---------------------- > Test Output: > > The connection in open() is :Resource id #1 > The connection in executeQuery() is :'' > > Warning: Supplied argument is not a valid PostgreSQL link resource in > /var/wwwroot/php/PostgreSQLDataSource.php on line 67 <this is the > pg_pConnect line...> > The connection in open() is :Resource id #2 > Resource id #2 > The connection in executeQuery() is :'Resource id #2' > Object > ---------------- > > So in other words, the one using the encapsulator doesnt work - it seems to > lose $this->connection in PostgreSQLDataSource when its contained in > AbstractDataSourceManager ! > > ... theres something screwball here - i mean - an object should be able to > access its own properties in any scope at any time shouldnt it ? > > This is totally screwing me here ... > > AndrewH > > ----- Original Message ----- > From: "Andrew Hill" <[EMAIL PROTECTED]> > To: "Andrew Halliday" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, March 02, 2001 11:53 AM > Subject: Re: [PHP] Loss of connection handle object > > > > Perhaps if you showed us some code? > > > > Best regards, > > Andrew > > > > > > On 3/1/01 7:35 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > > > > > open() is simply supposed to open the connection to the database and > store > > > it in $this->connection. > > > As you can see - it gets the connection info from either the objects > > > properties or from parameters passed to it. > > > Can you see what Ive done wrong...if anything?!?! > > > > > > AndrewH > > > > > > ----- Original Message ----- > > > From: "Andrew Hill" <[EMAIL PROTECTED]> > > > To: "Andrew Halliday" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > > > Sent: Friday, March 02, 2001 11:13 AM > > > Subject: Re: [PHP] Loss of connection handle object > > > > > > > > >> Andrew, > > >> > > >> What is the open() function? > > >> > > >> Best regards, > > >> Andrew > > >> --------------------------------------- > > >> Andrew Hill - OpenLink Software > > >> Director Technology Evangelism > > >> eBusiness Infrastructure Technology > > >> http://www.openlinksw.com > > >> > > >> > > >> > > >> > > >> On 3/1/01 7:27 PM, "Andrew Halliday" <[EMAIL PROTECTED]> wrote: > > >> > > >>> Okay - Im writing an object to wrap a database. > > >>> The key problem is this: > > >>> - it declares a connection var as an object property > > >>> - the open() function opens the connection to the database and > stores > > >>> the handle in $this->connection > > >>> - the executeQuery() method complains about not having a valid > handle, > > >>> because by then, somehow, $this->connection==null!!! > > >>> > > >>> Any ideas?-i swear its just something stupid ive missed ... > > >>> > > >>> HELP! > > >>> > > >>> Thanx in advance, > > >>> AndrewH > > >>> > > >>> ------------------------------------------------------------- > > >>> The code following this returns the following to the browser: > > >>> ------------------------------------------------------------- > > >>> The connection in open() is :Resource id #1 > > >>> The connection in executeQuery() is :'' > > >>> > > >>> Warning: Supplied argument is not a valid PostgreSQL link resource in > > >>> /var/wwwroot/php/PostgreSQLDataSource.php on line 67 > > >>> > > >>> > > >>> ------------------------------------------------------------- > > >>> > > >>> > > >>> class PostgreSQLDataSource > > >>> { > > >>> var $connection; > > >>> var $lastResultSet; > > >>> var $error_handler; > > >>> > > >>> var $host, $port, $username, $password, $database; > > >>> > > >>> function PostgreSQLDataSource($host, $port, $username, $password, > > >>> $database) > > >>> { > > >>> global $error_handler; > > >>> $this->error_handler = $error_handler; > > >>> > > >>> $this->host = $host; > > >>> $this->port = $port; > > >>> $this->username = $username; > > >>> $this->password = $password; > > >>> $this->database = $database; > > >>> > > >>> //Legacy behaviour: $this->open($host, $port, $username, > $password, > > >>> $database); > > >>> } > > >>> > > >>> function open(/*variable arg list*/) > > >>> { > > >>> $connectionString = ""; > > >>> > > >>> if (func_num_args() == 5) > > >>> { > > >>> $this->host = func_get_arg(0); > > >>> $this->port = func_get_arg(1); > > >>> $this->username = func_get_arg(2); > > >>> $this->password = func_get_arg(3); > > >>> $this->database = func_get_arg(4); > > >>> } > > >>> > > >>> if ($this->host) > > >>> $connectionString .= " host=".$this->host; > > >>> if ($this->port) > > >>> $connectionString .= " port=".$this->port; > > >>> if ($this->username) > > >>> $connectionString .= " user=".$this->username; > > >>> if ($this->password) > > >>> $connectionString .= " password=".$this->password; > > >>> if ($this->database) > > >>> $connectionString .= " dbname=".$this->database; > > >>> > > >>> $this->connection = pg_Connect($connectionString); > > >>> echo "The connection in open() is :".$this->connection."<BR>"; > > >>> if ($this->connection == false) > > >>> return false; > > >>> else > > >>> return true; > > >>> } > > >>> > > >>> function close() > > >>> { > > >>> return pg_Close($this->connection); > > >>> } > > >>> > > >>> function executeQuery($queryString) > > >>> { > > >>> echo "The connection in executeQuery() is > :'".$this->connection."'<BR>"; > > >>> $this->lastResultSet = pg_exec($this->connection,$queryString); > > >>> return new Iterator($this); > > >>> } > > >>> > > >>> /*PRIVATE FUNCTIONS:*/ > > >>> function getRow($row) > > >>> { > > >>> return pg_fetch_array($this->lastResultSet,$row); > > >>> } > > >>> > > >>> function getResultLength() > > >>> { > > >>> return count($this->lastResultSet); > > >>> } > > >>> } > > >>> > > >>> > > >>> > > >>> > > >> > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hi, I'm trying to truncate a txt-file which I in my script use "http://mydomain/path/to/my/file.txt" as a reference but I get this error message: Warning: can't truncate sockets! in domains/mydomain/www/path/to/my/phpfile.php on line 47 Does it mean I'll have to use "real" path e.g. c:\\domains\\mydomain... (etc.) or is it something else I should focus at? I'm working on a remote server (Linux/Apache) but this works 100% on my local server (Win2k/IIS5). Regards, Sumarlidi Einar Dadason SED - Graphic Design ------------------------------------------ Phone: (+354) 4615501 Mobile: (+354) 8960376 Fax: (+354) 4615503 E-mail: [EMAIL PROTECTED] Homepage: www.sed.is <- New Homepage! ------------------------------------------
well, because you are using "http://" PHP will have opened a tcp/ip socket :) try using both fread() AND fclose() from the manual: http://www.php.net/manual/en/function.fread.php // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); then truncate $contents not sure, but should work... regards, jaxon On 3/1/01 7:32 PM, "SED" <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to truncate a txt-file which I in my script use > "http://mydomain/path/to/my/file.txt" as a reference but I get this error > message: > > Warning: can't truncate sockets! in > domains/mydomain/www/path/to/my/phpfile.php on line 47 > > Does it mean I'll have to use "real" path e.g. c:\\domains\\mydomain... > (etc.) or is it something else I should focus at? I'm working on a remote > server (Linux/Apache) but this works 100% on my local server (Win2k/IIS5). > > Regards, > Sumarlidi Einar Dadason > > SED - Graphic Design > > ------------------------------------------ > Phone: (+354) 4615501 > Mobile: (+354) 8960376 > Fax: (+354) 4615503 > E-mail: [EMAIL PROTECTED] > Homepage: www.sed.is <- New Homepage! > ------------------------------------------ >
I'm trying to use the example of mail() from php.net: <? mail("equick-laughlin", "testing php mail function", "Line 1\nLine 2\nLine 3"); ?> and I've configured my php.ini with the following: [mail function] sendmail_path = /usr/sbin/sendmail -t -i ;for unix only, may supply arguments as well (default is 'sendma il -t -i') Yes it still doesn't send for me. I've checked that sendmail is running, and I did a which sendmail to confirm it's location. When I run the php script and do a tail -f /var/log/messages, it doesn't show up. How can I further troubleshoot this? Eman -- ===================================================================== Erin Quick-Laughlin email: [EMAIL PROTECTED] R&R Partners : Comp.Spec.II phone: 702.228.0222 http://www.rrpartners.com/ fax: 702.228.7885 =====================================================================
is there a newsserver like this one at news.php.net with messages from mysql mailing lists?
http://www.php.net/manual/en/function.extension-loaded.php jason ----- Original Message ----- From: "Eric Peters" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 01, 2001 10:29 AM Subject: [PHP] checking for a defined function > how can I do something like > > if(!defined(cybercash_encr())) dl("cybercash.so"); > > anyone know of a good way to see if a function/module has been included in > php? > > I need a run time solution for a script to be encoder()ed and distributed, > > Thanks > > Eric
Setup: aspell-.32.6 pspell-.11.2 php-4.0.4pl1 apache_1.3.14 RH 7.0 glibc 2.2-12 gcc-2.96-69 Procedure: ./pspell-.11.2/configure make && make install ./aspell-.32.6/configure make && make install ./php-4.0.4pl1/configure --without-gd --with-mysql --with-config-file-path=/usr/local/apache/etc --enable-debug=no --with-pspell --with-apache=/usr/local/src/apache_1.3.14 make && make install ./apache_1.3.14/configure --prefix=/usr/local/apache --with-layout=GNU --disable-module=userdir --disable-module=include --activate-module=src/modules/php4/libphp4.a make && make install Results in: Warning: PSPELL couldn't open the dictionary. reason: Unable to load the "aspell" module. in foo.inc on line 564 Aspell works great on the command line. Am I missing something? Incidently, I can't even get php to compile with pspell-.12 Ideas? Seth
Greetings, fellow PHP hackers! The current project I'm working on is porting software written in Tango to PHP4. Because these programs heavily rely on information held in (off-site) databases, the tango programs were written to have a set of array variables declared from SQL queries, which then any user hitting the site would have access to. Ie... User 1 hits the webapge.. the server realizes this is the first user and populates the arrays with data from the source database. The page is able to use these arrays. User 2 hits the webpage.. the server already has the arrays packed with data, and user 2 is able to hit the pages quickly, due to no queries being made. All users are this way. Some events would require that these arrays be re-hashed such as when a user updates, inserts or changes the value of an item in the database. These changes. When this update happens, the changes would be made to the server-wide variables, so ANY user on the machine (independant of sessions) would have the fresh data when it next pulls from the arrays. .... Ideally, this would be like settings HTTP_SERVER_VARS[school_array] to contain the data, where every page would have $school_array there without any additional work, and a refresh being a small function that creates the arrays needed and sticks them into HTTP_SERVER_VARS[array_name]. (Along the lines of PHP_SELF, but not dynamic in that sense.) Some of this could be handled with sessions, but my concern is that carrying ALL of this data with each user is a waste of resources, and will require more database calls than needed. If anyone has ANY ideas, PLEASE share them! :) Regards, Michael --- Michael David The Miller Group Web-based software for Schools http://www.miller-group.net
Hi Michael, I've never used it myself, but this may be of some use: http://www.php.net/manual/en/ref.shmop.php If I understand it correctly, this lets you write a string into an area of memory which can be accessed from any process - i.e. another httpd process. If you wanted to save an array you would need to serialize() it first. Cheers Simon Garner From: "Michael David" <[EMAIL PROTECTED]> > Greetings, fellow PHP hackers! > > The current project I'm working on is porting software written in Tango to > PHP4. Because these programs heavily rely on information held in (off-site) > databases, the tango programs were written to have a set of array variables > declared from SQL queries, which then any user hitting the site would have > access to. > > Ie... > > User 1 hits the webapge.. the server realizes this is the first user and > populates the arrays with data from the source database. The page is able > to use these arrays. > > User 2 hits the webpage.. the server already has the arrays packed with > data, and user 2 is able to hit the pages quickly, due to no queries being > made. All users are this way. > > Some events would require that these arrays be re-hashed such as when a user > updates, inserts or changes the value of an item in the database. These > changes. > > When this update happens, the changes would be made to the server-wide > variables, so ANY user on the machine (independant of sessions) would have > the fresh data when it next pulls from the arrays. > > .... > > Ideally, this would be like settings HTTP_SERVER_VARS[school_array] to > contain the data, where every page would have $school_array there without > any additional work, and a refresh being a small function that creates the > arrays needed and sticks them into HTTP_SERVER_VARS[array_name]. (Along the > lines of PHP_SELF, but not dynamic in that sense.) > > Some of this could be handled with sessions, but my concern is that carrying > ALL of this data with each user is a waste of resources, and will require > more database calls than needed. > > If anyone has ANY ideas, PLEASE share them! :) > > Regards, > > Michael > > > --- > Michael David > The Miller Group > Web-based software for Schools > http://www.miller-group.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
Hello again :-) First, thanks for your help ! but it doesn't work, i think i don't make the right things !!! because i don't understand very well what i must do :-) For best explain, i must use PHP because my server disallow .htaccess files, this is the .htaccess files i must transform in PHP files : <limit GET> HTTP_REFERER require valid-user Satisfy any order deny,allow deny from all allow from 198.143.15.0/24 allow from 202.139.84.0/25 allow from 210.176.142.64/26 </Limit> The script allow all users who are connect with an IP Address between 198.143.15.0 and 198.143.15.255 or between 202.139.84.0 and 202.139.84.255 or between 210.176.142.0 and 210.176.142.255 All other users with other IP Address are disallow and redirect to http://www.yahoo.com/ for example or 403 Page. Information about network : 198.143.15.0/24 (255.255.255.0) 202.139.84.0/25 (255.255.255.128) 210.176.142.64/26 (255.255.255.192) numbers "0/24" or 64/26 is the range from 0 to 255 for the IP Address Could you help me once again, please. Thank you ! Have a nice day. Anthony. ----- Original Message ----- From: "Ernest E Vogelsinger" <[EMAIL PROTECTED]> To: "Nazoréen" <[EMAIL PROTECTED]> Cc: "PHP GENERAL LIST" <[EMAIL PROTECTED]> Sent: Thursday, March 01, 2001 4:27 PM Subject: Re: [PHP] Restrict Access per IP Addresses > At 16:09 01.03.2001, Nazoréen said: > --------------------[snip]-------------------- > >there are 3 networks, each of them have a mask : (it is not necessary to > >know these parameters i think !) > >198.143.15.255 (255.255.255.0) > >202.139.84.255 (255.255.255.128) > >210.176.142.255 (255.255.255.192) > > > >When a user will connect, his IP will be between 198.143.15.0 and > >198.143.15.255 or between 202.139.84.0 and 202.139.84.255 or between > >210.176.142.0 and 210.176.142.255 > > > >So if someone else connect without using my network, the system disallow him > >and redirect in 403 Page. > --------------------[snip]-------------------- > > Anthony, > > given the function contains_ip from my earlier post, you would code: > > <?php > > if (!contains_ip("198.143.15.255", "255.255.255.0", $REMOTE_ADDRESS) && > !contains_ip("202.139.84.255", "255.255.255.128", $REMOTE_ADDRESS) && > !contains_ip("210.176.142.255", "255.255.255.192", $REMOTE_ADDRESS)) > { > header("403 Forbidden"); > echo "<h1>Access Forbidden</h1>You may not come here from outside our > domain"; > exit(); > } > process_domain_app(); > ?> > > ...ebird > > >O Ernest E. Vogelsinger > (\) http://www.1-at-web.at/ > ^ ICQ# 13394035 >
I know I've been posing some funky wierd questions all day, but today has just been one of those days... I'm just trying to get a sense of other possibilities. And to find out what's plausable and what's not. Ok, here's my situation. I've a script that generates a variable number of HREFs/anchors. Each of those HREFs can go to variable pages and also have a variable number of GET variables. So, for the sake of this example, lets say my script generates the following HTML: ----------- <a href="/hispage.php?var1=xxx&var2=yyy">Here<a/><br> <a href="/otherpage.php">There<a/><br> <a href="/thatpage.php?joe=bob">This Place<a/><br> <a href="/lapage.php?this=that&his=hers&here=there">That Place<a/><br> ----------- As you know, those variables are being passed to the linked page via GET variables. Now, here comes the oddball question: How can I (is it even possible) pass those variables to each page w/o using GETs and w/o using Cookies. Ultimately, the plan they are pushing is to make our site(s) free of all GET variables (including the SESSID; yes, you read that right) and of cookies. Also those GET variables above should be turned into session variables if and when possible, but only if the user clicks on the actual link. This is basically the environment that has been presented to me. Is such an environment possible? If so, how? What is necessary to make it work this way? If it is not, to what extent is it possible? Thanks for reading this far. Thanks, also, for fielding this question and offering any help and any insight you can on my dilema. Chris
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Boget, Chris") wrote: > <a href="/hispage.php?var1=xxx&var2=yyy">Here<a/><br> > <a href="/otherpage.php">There<a/><br> > <a href="/thatpage.php?joe=bob">This Place<a/><br> > <a href="/lapage.php?this=that&his=hers&here=there">That Place<a/><br> > > ----------- > > As you know, those variables are being passed to the > linked page via GET variables. Now, here comes the > oddball question: > > How can I (is it even possible) pass those variables > to each page w/o using GETs and w/o using Cookies. POST. -- CC
Hi Chris, For my own edification, how are you creating the links dynamically - I need to do something similar ..? As far as removing GET variables, you could just flag variables in a database, that would eliminate the majority of the inter-page stuff. You would still need to leave one session on the client, though... hth, jaxon On 3/1/01 9:37 PM, "Boget, Chris" <[EMAIL PROTECTED]> wrote: > I know I've been posing some funky wierd questions > all day, but today has just been one of those days... > I'm just trying to get a sense of other possibilities. > And to find out what's plausable and what's not. > > Ok, here's my situation. I've a script that generates > a variable number of HREFs/anchors. Each of those > HREFs can go to variable pages and also have a variable > number of GET variables. > So, for the sake of this example, lets say my script > generates the following HTML: > > ----------- > > <a href="/hispage.php?var1=xxx&var2=yyy">Here<a/><br> > <a href="/otherpage.php">There<a/><br> > <a href="/thatpage.php?joe=bob">This Place<a/><br> > <a href="/lapage.php?this=that&his=hers&here=there">That Place<a/><br> > > ----------- > > As you know, those variables are being passed to the > linked page via GET variables. Now, here comes the > oddball question: > > How can I (is it even possible) pass those variables > to each page w/o using GETs and w/o using Cookies. > Ultimately, the plan they are pushing is to make our > site(s) free of all GET variables (including the SESSID; > yes, you read that right) and of cookies. Also those > GET variables above should be turned into session > variables if and when possible, but only if the user > clicks on the actual link. > > This is basically the environment that has been presented > to me. Is such an environment possible? If so, how? > What is necessary to make it work this way? If it is not, > to what extent is it possible? > > Thanks for reading this far. Thanks, also, for fielding > this question and offering any help and any insight you > can on my dilema. > > Chris >
>> <a href="/hispage.php?var1=xxx&var2=yyy">Here<a/><br> >> <a href="/otherpage.php">There<a/><br> >> <a href="/thatpage.php?joe=bob">This Place<a/><br> >> <a href="/lapage.php?this=that&his=hers&here=there">That Place<a/><br> >> ----------- >> As you know, those variables are being passed to the >> linked page via GET variables. Now, here comes the >> oddball question: >> How can I (is it even possible) pass those variables >> to each page w/o using GETs and w/o using Cookies. > POST. So basically each one of my links would have to be it's own form with each one of the variable number of GET vars as hidden elements along with the SESSID? And no, I couldn't make it one big form because: a) the GET variables can have the same name but different values b) these links could be right next to or miles apart from each other, depending on positioning. And if they each have to be their own form, that would do some funky things with regards to display... Lining them up would be a bitch. :p Also, how would I set the (previously GET) vars up as session variables? I'd have to post to yet another script which would set the session variables and in turn SUBMIT (with just the SESSID this time) to the actual page (remember, I can no longer use any GET variables so the header() function would be out) that is the final destination... Like I said, it's been one of those days and the above is the only solution I can come up with to my environment scenario/dilema. I'm hoping there is a better way. Chris
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("Boget, Chris") wrote: > Also, how would I set the (previously GET) vars up as session > variables? I'd have to post to yet another script which > would set the session variables and in turn SUBMIT (with just > the SESSID this time) to the actual page (remember, I can no > longer use any GET variables so the header() function would > be out) that is the final destination... Just include the SID as a hidden input. It'll be POSTED to the next page right along with your other variables. There's even a way to configure your php.ini file so that PHP includes the hidden SID for you. I forget which setting it is--maybe "trans-id" or something like that...? Poke around in the the "configuration" chapter of the manual; it's in there. -- CC
On Thu, 1 Mar 2001 07:58:23 +0100 Alexander wrote: AW> If you want something faster, try Smarty. Thanks, Smarty looks like it will do the trick and has some really neat features, like being able to nest dynamic blocks, I think this was my problem with FastTemplate. Regards, Joseph
i built a script to generate passwords: function passwort($laenge) { $allowed = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890:-+="; $allowed_length = strlen($allowed); $i=0; $pw = ""; while ($i<$laenge) { $pos = rand(0,$allowed_length); $pw.= substr($allowed,$pos,1); $i++; } return $pw; } My questions is, if this is a good or bad way? -- Ihr WEBberater Stuttgarter Str.3, D-73033 Goeppingen Tel. +49(0)7161-929594 - Fax. +49(0)7161-929598 http://www.wa-p.de ** mailto:[EMAIL PROTECTED]
> function passwort($laenge) > { > $allowed = > "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890:-+="; > $allowed_length = strlen($allowed); > > $i=0; > $pw = ""; > > while ($i<$laenge) { > $pos = rand(0,$allowed_length); > $pw.= substr($allowed,$pos,1); > $i++; > } > return $pw; > } > > My questions is, if this is a good or bad way? It's a whole lot better than using real words. As long as you encrypt the passwords using a good one-way hash when you store them on the server, you should be fine. Sig for a Day Stephan Ahonen, ICQ 491101 "That's very funny Scotty, now beam down my clothes!" Come back tomorrow for a different sig! Backspace a single "s" to reply by email
howdy, im new at this, so sorry if this is a dumb question... I want to make some dynamically generated buttons, but even when i copy the most basic of graphics scripts i can find out there, they dont seem to be working. Does this mean my ISP is not configured for displaying PHP generated graphics? thanks for your help "Men never do evil so completely and cheerfully as when they do it from mistaken conviction." Blaise Pascal http://assortedmonkeys.org/
> im new at this, so sorry if this is a dumb question... > I want to make some dynamically generated buttons, but even > when i copy the most basic of graphics scripts i can find out > there, they dont seem to be working. Does this mean my ISP is > not configured for displaying PHP generated graphics? That's possible. You might like to try manually downloading the file using a utility like wget or curl. This will show you if PHP is outputting any errors (which would thus result in a broken image). Jason -- Jason Murray [EMAIL PROTECTED] Web Design Team, Melbourne IT Fetch the comfy chair!
darthzeth wrote: > > howdy, > im new at this, so sorry if this is a dumb question... > I want to make some dynamically generated buttons, but even when i copy the most >basic of graphics scripts i can find out there, they dont seem to be working. Does >this mean my ISP is not configured for displaying PHP generated graphics? > > thanks for your help > > "Men never do evil so completely and cheerfully as when they do it from mistaken >conviction." > Blaise Pascal > > http://assortedmonkeys.org/ run phpinfo() and see if it has been compiled with gd support ~jack
like i said, im a newbie... how do i run phpinfo() ? my almost exclusive experience is with FTPing html pages and a few PHP scripts to the server, other than that, i dont know much. is there any FAQ you can point me to with answer to absolute newbie questions like these? ----- Original Message ----- > darthzeth wrote: > > > > howdy, > > im new at this, so sorry if this is a dumb question... > > I want to make some dynamically generated buttons, but even when i copy the most basic of graphics scripts i can find out there, they dont seem to be working. Does this mean my ISP is not configured for displaying PHP generated graphics? > > > > thanks for your help > > > > "Men never do evil so completely and cheerfully as when they do it from mistaken conviction." > > Blaise Pascal > > > > http://assortedmonkeys.org/ > > run phpinfo() and see if it has been compiled with gd support > > ~jack > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
From: "darthzeth" <[EMAIL PROTECTED]> > like i said, im a newbie... how do i run phpinfo() ? my almost exclusive > experience is with FTPing html pages and a few PHP scripts to the server, > other than that, i dont know much. is there any FAQ you can point me to with > answer to absolute newbie questions like these? > Create a new file called test.php and in it put: <?php phpinfo(); ?> FTP it to your web server and then look at it in your browser. It should tell you a whole lot of stuff about how PHP has been configured on your server. Regards Simon Garner
create a file called phpinfo.php and add to that file <? php_info(); ?> then load up that page in your browser. In regards to FAQ's visit www.php.net should also look at phpbuilder.com and there are many more. On php.net in the links section they have even more links to FAQ's John Ashton [EMAIL PROTECTED] The Data Source Network http://www.thedatasource.net > -----Original Message----- > From: darthzeth [mailto:[EMAIL PROTECTED]] > Sent: March 2, 2001 12:37 AM > To: Jack Dempsey > Cc: PHP general mailing list > Subject: Re: [PHP] Dumb newbie graphics question > > > like i said, im a newbie... how do i run phpinfo() ? my almost exclusive > experience is with FTPing html pages and a few PHP scripts to the server, > other than that, i dont know much. is there any FAQ you can point > me to with > answer to absolute newbie questions like these? > > ----- Original Message ----- > > darthzeth wrote: > > > > > > howdy, > > > im new at this, so sorry if this is a dumb question... > > > I want to make some dynamically generated buttons, but even > when i copy > the most basic of graphics scripts i can find out there, they dont seem to > be working. Does this mean my ISP is not configured for displaying PHP > generated graphics? > > > > > > thanks for your help > > > > > > "Men never do evil so completely and cheerfully as when they > do it from > mistaken conviction." > > > Blaise Pascal > > > > > > http://assortedmonkeys.org/ > > > > run phpinfo() and see if it has been compiled with gd support > > > > ~jack > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
Hi I just installed mysql, apache and php4 on Linux Mandrake 7.0. After installing apache it seemed ok and started normally. But after installing PHP4 I get the following error message when I try to start apache: Syntax error on line 207 of httpd. config: cannot load /usr/apache_1.3.12/libexec/libphp4.so into server: /usr/loca/apache_1.3.12/libexec/libphp4.so: undefined symbol: mysql_init I used the following command to build php4: ./configure --with-mysql=/usr/local/mysql-3.22.32-pc-linux-gnu-i686/ --with-apxs=/usr/local/apache_1.3.12/bin/apxs Any hints in a newbie-friendly format would be greatly appreciated. Thanks, SW
Hi I just installed mysql, apache and php4 on Linux Mandrake 7.0. After installing apache it seemed ok and started normally. But after installing PHP4 I get the following error message when I try to start apache: Syntax error on line 207 of httpd. config: cannot load /usr/apache_1.3.12/libexec/libphp4.so into server: /usr/loca/apache_1.3.12/libexec/libphp4.so: undefined symbol: mysql_init I used the following command to build php4: ./configure --with-mysql=/usr/local/mysql-3.22.32-pc-linux-gnu-i686/ --with-apxs=/usr/local/apache_1.3.12/bin/apxs Any hints in a newbie-friendly format would be greatly appreciated. Thanks, SW
did you have --activate-module=src/modules/php4/libphp4.a John Ashton > -----Original Message----- > From: Scott Wagner [mailto:[EMAIL PROTECTED]] > Sent: March 1, 2001 11:55 PM > To: php > Subject: [PHP] can't start apache > > > Hi > I just installed mysql, apache and php4 on Linux Mandrake 7.0. > After installing apache it seemed ok and started normally. But > after installing PHP4 I get the following error message when I > try to start apache: > > Syntax error on line 207 of httpd. config: cannot load > /usr/apache_1.3.12/libexec/libphp4.so into server: > /usr/loca/apache_1.3.12/libexec/libphp4.so: undefined symbol: mysql_init > > I used the following command to build php4: > ./configure > --with-mysql=/usr/local/mysql-3.22.32-pc-linux-gnu-i686/ > --with-apxs=/usr/local/apache_1.3.12/bin/apxs > > Any hints in a newbie-friendly format would be greatly appreciated. > Thanks, > SW > >
No. Does this get added to the configuration command? (touche on the double-post) SW
http://www.php.net/manual/en/install.apache.php all noted there ;) What a thing. John Ashton > -----Original Message----- > From: Scott Wagner [mailto:[EMAIL PROTECTED]] > Sent: March 2, 2001 12:12 AM > To: php general > Subject: [PHP] can't start apache > > > No. Does this get added to the configuration command? > (touche on the double-post) > SW >
Hello, Are there any good examples of producing embedded javascript code in a php file? I am having a weird problem with some javascript that simply will not execute, even though I've properly used slashes to prefix quote marks etc. I don't get javascript errors, it simply doesn't run like it should. Me thinks this is simple, but I can't seem to figure it out. Thanks
This may not be possible. I wish to trigger a small php script from a button on the displayed page without changing the page. Specifically, I wish to destroy the session. Best, Ted _____________ Ted Goranson Fusecap and Sirius-Beta, Virginia Beach USA 757/426-6704 [EMAIL PROTECTED] Symmetry Conference: http://www.isis-s.unsw.edu.au
You could always use some JavaScript to popup window ands use session_destroy might work never really tried it though. John Ashton [EMAIL PROTECTED] The Data Source Network http://www.thedatasource.net > -----Original Message----- > From: Ted Goranson [mailto:[EMAIL PROTECTED]] > Sent: March 1, 2001 11:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Trigger script from Browser? > > > This may not be possible. > > I wish to trigger a small php script from a button on the displayed > page without changing the page. Specifically, I wish to destroy the > session. > > Best, Ted > > _____________ > Ted Goranson > Fusecap and Sirius-Beta, Virginia Beach USA > 757/426-6704 > [EMAIL PROTECTED] > Symmetry Conference: http://www.isis-s.unsw.edu.au > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >
I can't create or manipulate jpegs, but pngs work fine. I am using a hosting service. They installed GD 1.8.4 with jpeg support a few days ago, but I'm thinking they did it wrong. I'm using code I know works because it's straight out of the PHP Cookbook. What do I need to tell them to correct the problem? phpinfo() tells me this: './configure' '--with-gd=/opt/local/src/gd-1.8.4' '--with-config-file-path=/usr/local/lib' '--with-ttf=/opt/local/src/freetype-1.3.1' '--with-jpeg-dir=/opt/local/src/jpeg-6b' '--libdir=/usr/local/lib/' This is the code I've tried: <?php header("Content-type: image/jpeg"); if (($im = ImageCreateFromJpeg("test.jpeg")) == "") { echo "error opening file"; exit; } $red = ImageColorAllocate($im, 255, 0, 0); ImageString($im, 3, 20, 10, "Hi", $red); ImageJpeg($im); ?> Thanks! -- Cherie Benoit
They probably didn't build jpeg support into their gd library. On Thu, 1 Mar 2001, Cherie Benoit wrote: > I can't create or manipulate jpegs, but pngs work fine. I am using a hosting > service. They installed GD 1.8.4 with jpeg support a few days ago, but I'm > thinking they did it wrong. I'm using code I know works because it's > straight out of the PHP Cookbook. What do I need to tell them to correct the > problem? > > > phpinfo() tells me this: > './configure' > '--with-gd=/opt/local/src/gd-1.8.4' > '--with-config-file-path=/usr/local/lib' > '--with-ttf=/opt/local/src/freetype-1.3.1' > '--with-jpeg-dir=/opt/local/src/jpeg-6b' > '--libdir=/usr/local/lib/' > > This is the code I've tried: > <?php > header("Content-type: image/jpeg"); > if (($im = ImageCreateFromJpeg("test.jpeg")) == "") { > echo "error opening file"; > exit; > } > $red = ImageColorAllocate($im, 255, 0, 0); > ImageString($im, 3, 20, 10, "Hi", $red); > ImageJpeg($im); > ?> > > > Thanks! > -- > Cherie Benoit > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] >
I'm experiencing strange behavior with my user authentication scheme in my PHP app, with users using IE 5.5 (PC and Mac). I am using browser authentication (WWW-Authenticate and 401 headers), "no cache" headers, and PHP 4 sessions. I am finding that even when the user totally quits IE, if he then restarts IE, one or both (haven't isolated for sure yet) of the following happen: - The browser still knows the user and password, and so will send it to the server upon an authentication request under the same realm, without prompting the user. (The user does NOT have "save this password" checked on the user/password prompt when it first comes up.) - The session is still active. A call to session_start() returns the pre-existing session, instead of getting a new one. If the user restarts his machine, IE no longer remembers his user and password, and so a prompt is displayed upon authentication headers being sent. And I presume (not 100% certain) that a new session gets created. Both of these are behaving like IE is still running. Is this a known issue with IE 5.5? Does it just stay running? These symptoms make it sound like this, and less like a logic problem in my PHP app. (I have verified that the username and password are sent when the user gets an authentication prompt, without the user typing anything. I'm assuming there's no possible way that a PHP session can retain this information; I am reading $PHP_AUTH_USER and $PHP_AUTH_PW...there's no way these can be set unless the browser were already running and the user had previously entered them into their prompts, right?) Has anyone else run into this? My application works perfectly under Netscape 4, IE 4, and Opera 5. Thanks, Ken
Yeah I have seen the same problems before as well with things like phpMyAdmin and others I think it has something to do with user.exe in windows.. not to sure though. If you get it figured out please let me know John Ashton [EMAIL PROTECTED] The Data Source Network http://www.thedatasource.net > -----Original Message----- > From: Ken [mailto:[EMAIL PROTECTED]] > Sent: March 1, 2001 7:14 PM > To: [EMAIL PROTECTED] > Subject: [PHP] IE 5.5,authentication,PHP sessions: IE never stops > running? > > > I'm experiencing strange behavior with my user authentication > scheme in my PHP app, with users using IE 5.5 (PC and Mac). > > I am using browser authentication (WWW-Authenticate and 401 > headers), "no cache" headers, and PHP 4 sessions. > > I am finding that even when the user totally quits IE, if he then > restarts IE, one or both (haven't isolated for sure yet) of the > following happen: > > - The browser still knows the user and password, and so will send > it to the server upon an authentication request under the same > realm, without prompting the user. (The user does NOT have "save > this password" checked on the user/password prompt when it first > comes up.) > - The session is still active. A call to session_start() returns > the pre-existing session, instead of getting a new one. > > If the user restarts his machine, IE no longer remembers his user > and password, and so a prompt is displayed upon authentication > headers being sent. And I presume (not 100% certain) that a new > session gets created. > > Both of these are behaving like IE is still running. Is this a > known issue with IE 5.5? Does it just stay running? These > symptoms make it sound like this, and less like a logic problem > in my PHP app. (I have verified that the username and password > are sent when the user gets an authentication prompt, without the > user typing anything. I'm assuming there's no possible way that > a PHP session can retain this information; I am reading > $PHP_AUTH_USER and $PHP_AUTH_PW...there's no way these can be set > unless the browser were already running and the user had > previously entered them into their prompts, right?) > > Has anyone else run into this? My application works perfectly > under Netscape 4, IE 4, and Opera 5. > > Thanks, > Ken > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > >