Re: Re: [PHP] Full-Duplex communication
Vinod, Interesting... Okay unless I'm mistaken, what you want to do can't be accomplished through PHP. However, you may want to take a look at libnet. http://www.packetfactory.net/Projects/Libnet/ I've always wanted someone to create a PHP interface for this- unfortunatly my C isn't quite there yet, but I'm working on it... Have fun! On Tuesday 21 May 2002 22:55 pm, Vinod Panicker wrote: Hi, It still seems like I havent made the problem clear enough. I am aware of the print(), echo() and flush() functions and what they do. It does not fit in as a solution. Let me explain my problem more elaborately - The client calls a PHP script, script_a.php on the Apache web server, using a Keep-Alive connection. The script returns some response to the client which it uses. Now since the connection is a Keep-alive, apache still has it open for reading and writing. When the client wants to call other scripts, it just sends the request over the same connection. Now the thing is that if the server needs to send some ASYNCHRONOUS data to the client, without the client requesting for anything, a normal PHP script wont be able to do it, since the script would get executed by the web server ONLY on a client request (coz thats the way HTTP works). Now what i was thinking was - if i could get hold of the socket that is being used by apache to send data to the client, I could effectively write() to it, from a C++ app or a PHP script (which gets invoked from lets say another server). print(), echo() etc are functions that write to the output stream, which is opened as a result of the clients request, by the web server. I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Functions like echo() and print() are not going to work here, i will have to use write() so that i can specify the socket to which the data has to be written! Hope the problem is understood now. Now for your question - When the client wants to send data to the server, it just has to open a socket connection with the web server, and issue a GET or a POST request! if the connection is a keep-alive connection, and it has already been created, the client just has to do a GET or a POST without the need to connect(). This mechanism, where the client frequently connects() to the server and checks for messages is called polling. One way of reducing the high overhead of this is to reuse the connection by using a keep-alive connection. A still better improvement would be to remove the need for a poll altogether, by doing something (thats what my question is all about) on the server so that it can send data asynchronously to the server. Tx, Vinod. On Wed, 22 May 2002 Bogdan Stancescu wrote : For your specific problem, I think Mr. Lemos has provided a viable solution (using print() or echo() and flush() whenever you need to, instead of grabbing the socket and write() to it). My problem however is how you envision solving the communication the other way around (i.e. when the CLIENT wants to send data to the server). Bogdan Vinod Panicker wrote: Hi, Tx for your very prompt reply. Yeah, I'll post the solution as soon as I find it someplace. Let me outline the problem in more detail - Client (VC++) calls a PHP script on the server, specifies the connection type as Keep-Alive. The PHP script, somehow (still a big question) gets the socket on which the apache server has received the client request (so that it can send data to the client later) and stores it in a database. Now whenever another PHP script wants to send data asynchronously to the client, it gets the socket from the database, and just calls a write() on it. Since the connection is still open (Keep-Alive), the client receives the information, and doesnt have to poll the server periodically. The application of this is indeed destined for a messaging product, and could benefit a lot of other areas as well. The only thing that is needed is the socket from apache. Someone somewhere knows how to get this done, i'm sure :) Possibly a hack into the PHP module can get this done, i'm open to suggestions. Tx, Vinod. On Tue, 21 May 2002 Bogdan Stancescu wrote : Hi! I'm looking for an answer to your questions as well, so if you do find a solution on other lists, could you please post it here as well? Regarding the issue, your proposal wouldn't make for full-duplex as far as I understand since I don't see how the client would be able to send any data on the same connection _after_ getting connected. What are you using on the other end of the pipe (on the client)? Plain HTML? Flash? Java? Something else? Bogdan Vinod Panicker wrote: Hi, We have developed a client-server application where the server needs to send asynchronous data to the client. Now since we are using
Re: Re: [PHP] Full-Duplex communication
I don't think you're going to get Apache to hand you the socket. However, you can write a program using the standalone (CGI) PHP interpreter that will act like a server - check out http://php.net/socket_create_listen for more info. You could redirect from your standard web server to your listening PHP app running on another port. You'll then have to implement at least a subset of the HTTP protocol in order to get browsers to talk to you. Unfortunately, since you can't - to the best of my knowledge - fork a PHP program, you're going to have to do your own homebrew threading which will make life slightly complicated. miguel On 22 May 2002, Vinod Panicker wrote: It still seems like I havent made the problem clear enough. I am aware of the print(), echo() and flush() functions and what they do. It does not fit in as a solution. Let me explain my problem more elaborately - The client calls a PHP script, script_a.php on the Apache web server, using a Keep-Alive connection. The script returns some response to the client which it uses. Now since the connection is a Keep-alive, apache still has it open for reading and writing. When the client wants to call other scripts, it just sends the request over the same connection. Now the thing is that if the server needs to send some ASYNCHRONOUS data to the client, without the client requesting for anything, a normal PHP script wont be able to do it, since the script would get executed by the web server ONLY on a client request (coz thats the way HTTP works). Now what i was thinking was - if i could get hold of the socket that is being used by apache to send data to the client, I could effectively write() to it, from a C++ app or a PHP script (which gets invoked from lets say another server). print(), echo() etc are functions that write to the output stream, which is opened as a result of the clients request, by the web server. I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Functions like echo() and print() are not going to work here, i will have to use write() so that i can specify the socket to which the data has to be written! Hope the problem is understood now. Now for your question - When the client wants to send data to the server, it just has to open a socket connection with the web server, and issue a GET or a POST request! if the connection is a keep-alive connection, and it has already been created, the client just has to do a GET or a POST without the need to connect(). This mechanism, where the client frequently connects() to the server and checks for messages is called polling. One way of reducing the high overhead of this is to reuse the connection by using a keep-alive connection. A still better improvement would be to remove the need for a poll altogether, by doing something (thats what my question is all about) on the server so that it can send data asynchronously to the server. Tx, Vinod. On Wed, 22 May 2002 Bogdan Stancescu wrote : For your specific problem, I think Mr. Lemos has provided a viable solution (using print() or echo() and flush() whenever you need to, instead of grabbing the socket and write() to it). My problem however is how you envision solving the communication the other way around (i.e. when the CLIENT wants to send data to the server). Bogdan Vinod Panicker wrote: Hi, Tx for your very prompt reply. Yeah, I'll post the solution as soon as I find it someplace. Let me outline the problem in more detail - Client (VC++) calls a PHP script on the server, specifies the connection type as Keep-Alive. The PHP script, somehow (still a big question) gets the socket on which the apache server has received the client request (so that it can send data to the client later) and stores it in a database. Now whenever another PHP script wants to send data asynchronously to the client, it gets the socket from the database, and just calls a write() on it. Since the connection is still open (Keep-Alive), the client receives the information, and doesnt have to poll the server periodically. The application of this is indeed destined for a messaging product, and could benefit a lot of other areas as well. The only thing that is needed is the socket from apache. Someone somewhere knows how to get this done, i'm sure :) Possibly a hack into the PHP module can get this done, i'm open to suggestions. Tx, Vinod. On Tue, 21 May 2002 Bogdan Stancescu wrote : Hi! I'm looking for an answer to your questions as well, so if you do find a solution on other lists, could you please post it here as well? Regarding the issue, your proposal wouldn't make for full-duplex as far as I understand since I don't see how the client would be able to send any data on the same
Re: Re: [PHP] Full-Duplex communication
1st thing: sorry about the double-post. i don't know why that happened. If this one gets double posted too, i apologize in advance. 2nd: php.net/pcntl On Tuesday 21 May 2002 23:30 pm, Miguel Cruz wrote: I don't think you're going to get Apache to hand you the socket. However, you can write a program using the standalone (CGI) PHP interpreter that will act like a server - check out http://php.net/socket_create_listen for more info. You could redirect from your standard web server to your listening PHP app running on another port. You'll then have to implement at least a subset of the HTTP protocol in order to get browsers to talk to you. Unfortunately, since you can't - to the best of my knowledge - fork a PHP program, you're going to have to do your own homebrew threading which will make life slightly complicated. miguel On 22 May 2002, Vinod Panicker wrote: It still seems like I havent made the problem clear enough. I am aware of the print(), echo() and flush() functions and what they do. It does not fit in as a solution. Let me explain my problem more elaborately - The client calls a PHP script, script_a.php on the Apache web server, using a Keep-Alive connection. The script returns some response to the client which it uses. Now since the connection is a Keep-alive, apache still has it open for reading and writing. When the client wants to call other scripts, it just sends the request over the same connection. Now the thing is that if the server needs to send some ASYNCHRONOUS data to the client, without the client requesting for anything, a normal PHP script wont be able to do it, since the script would get executed by the web server ONLY on a client request (coz thats the way HTTP works). Now what i was thinking was - if i could get hold of the socket that is being used by apache to send data to the client, I could effectively write() to it, from a C++ app or a PHP script (which gets invoked from lets say another server). print(), echo() etc are functions that write to the output stream, which is opened as a result of the clients request, by the web server. I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Functions like echo() and print() are not going to work here, i will have to use write() so that i can specify the socket to which the data has to be written! Hope the problem is understood now. Now for your question - When the client wants to send data to the server, it just has to open a socket connection with the web server, and issue a GET or a POST request! if the connection is a keep-alive connection, and it has already been created, the client just has to do a GET or a POST without the need to connect(). This mechanism, where the client frequently connects() to the server and checks for messages is called polling. One way of reducing the high overhead of this is to reuse the connection by using a keep-alive connection. A still better improvement would be to remove the need for a poll altogether, by doing something (thats what my question is all about) on the server so that it can send data asynchronously to the server. Tx, Vinod. On Wed, 22 May 2002 Bogdan Stancescu wrote : For your specific problem, I think Mr. Lemos has provided a viable solution (using print() or echo() and flush() whenever you need to, instead of grabbing the socket and write() to it). My problem however is how you envision solving the communication the other way around (i.e. when the CLIENT wants to send data to the server). Bogdan Vinod Panicker wrote: Hi, Tx for your very prompt reply. Yeah, I'll post the solution as soon as I find it someplace. Let me outline the problem in more detail - Client (VC++) calls a PHP script on the server, specifies the connection type as Keep-Alive. The PHP script, somehow (still a big question) gets the socket on which the apache server has received the client request (so that it can send data to the client later) and stores it in a database. Now whenever another PHP script wants to send data asynchronously to the client, it gets the socket from the database, and just calls a write() on it. Since the connection is still open (Keep-Alive), the client receives the information, and doesnt have to poll the server periodically. The application of this is indeed destined for a messaging product, and could benefit a lot of other areas as well. The only thing that is needed is the socket from apache. Someone somewhere knows how to get this done, i'm sure :) Possibly a hack into the PHP module can get this done, i'm open to suggestions. Tx, Vinod. On Tue, 21 May 2002 Bogdan Stancescu wrote : Hi! I'm looking for an answer to your questions as well, so if you
Re: Re: [PHP] Full-Duplex communication
Ah, yes - http://php.net/pcntl_fork Well there you go, then - everything required to create a server in PHP. miguel On Tue, 21 May 2002, Evan Nemerson wrote: 1st thing: sorry about the double-post. i don't know why that happened. If this one gets double posted too, i apologize in advance. 2nd: php.net/pcntl On Tuesday 21 May 2002 23:30 pm, Miguel Cruz wrote: I don't think you're going to get Apache to hand you the socket. However, you can write a program using the standalone (CGI) PHP interpreter that will act like a server - check out http://php.net/socket_create_listen for more info. You could redirect from your standard web server to your listening PHP app running on another port. You'll then have to implement at least a subset of the HTTP protocol in order to get browsers to talk to you. Unfortunately, since you can't - to the best of my knowledge - fork a PHP program, you're going to have to do your own homebrew threading which will make life slightly complicated. miguel On 22 May 2002, Vinod Panicker wrote: It still seems like I havent made the problem clear enough. I am aware of the print(), echo() and flush() functions and what they do. It does not fit in as a solution. Let me explain my problem more elaborately - The client calls a PHP script, script_a.php on the Apache web server, using a Keep-Alive connection. The script returns some response to the client which it uses. Now since the connection is a Keep-alive, apache still has it open for reading and writing. When the client wants to call other scripts, it just sends the request over the same connection. Now the thing is that if the server needs to send some ASYNCHRONOUS data to the client, without the client requesting for anything, a normal PHP script wont be able to do it, since the script would get executed by the web server ONLY on a client request (coz thats the way HTTP works). Now what i was thinking was - if i could get hold of the socket that is being used by apache to send data to the client, I could effectively write() to it, from a C++ app or a PHP script (which gets invoked from lets say another server). print(), echo() etc are functions that write to the output stream, which is opened as a result of the clients request, by the web server. I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Functions like echo() and print() are not going to work here, i will have to use write() so that i can specify the socket to which the data has to be written! Hope the problem is understood now. Now for your question - When the client wants to send data to the server, it just has to open a socket connection with the web server, and issue a GET or a POST request! if the connection is a keep-alive connection, and it has already been created, the client just has to do a GET or a POST without the need to connect(). This mechanism, where the client frequently connects() to the server and checks for messages is called polling. One way of reducing the high overhead of this is to reuse the connection by using a keep-alive connection. A still better improvement would be to remove the need for a poll altogether, by doing something (thats what my question is all about) on the server so that it can send data asynchronously to the server. Tx, Vinod. On Wed, 22 May 2002 Bogdan Stancescu wrote : For your specific problem, I think Mr. Lemos has provided a viable solution (using print() or echo() and flush() whenever you need to, instead of grabbing the socket and write() to it). My problem however is how you envision solving the communication the other way around (i.e. when the CLIENT wants to send data to the server). Bogdan Vinod Panicker wrote: Hi, Tx for your very prompt reply. Yeah, I'll post the solution as soon as I find it someplace. Let me outline the problem in more detail - Client (VC++) calls a PHP script on the server, specifies the connection type as Keep-Alive. The PHP script, somehow (still a big question) gets the socket on which the apache server has received the client request (so that it can send data to the client later) and stores it in a database. Now whenever another PHP script wants to send data asynchronously to the client, it gets the socket from the database, and just calls a write() on it. Since the connection is still open (Keep-Alive), the client receives the information, and doesnt have to poll the server periodically. The application of this is indeed destined for a messaging product, and could benefit a lot of other areas as well. The only thing that is needed is the socket from apache. Someone somewhere
Re: Re: Re: [PHP] Full-Duplex communication
Thanks for the reply Miguel, but here i'm not trying to implement my own multi-threaded server - exactly the reason why i'm using Apache / PHP. I could have made a listening server which is based on a multi-threaded or multi-forked model, but the time and complexities involved would be huge. Thats why I chose Apache / PHP. Now if what i'm asking for can be done, developers can easily leverage existing efficient server technologies (Apache) to build their own App servers. I know that there is no existing function in PHP that would allow it to retrieve the socket from Apache ;), all i'm asking for is a hack that would allow me to do it. I thought that i'd just as well post it on the mailing list before diving into the source code and trying to figure out for myself. No point trying to re-invent the wheel, right? Evan, that lib will allow me to create my own packets, but which socket do i send it to? Thats been the question all along. I think this is getting really interesting :) Tx, Vinod. On Wed, 22 May 2002 Miguel Cruz wrote : I don't think you're going to get Apache to hand you the socket. However, you can write a program using the standalone (CGI) PHP interpreter that will act like a server - check out http://php.net/socket_create_listen for more info. You could redirect from your standard web server to your listening PHP app running on another port. You'll then have to implement at least a subset of the HTTP protocol in order to get browsers to talk to you. Unfortunately, since you can't - to the best of my knowledge - fork a PHP program, you're going to have to do your own homebrew threading which will make life slightly complicated. miguel On 22 May 2002, Vinod Panicker wrote: It still seems like I havent made the problem clear enough. I am aware of the print(), echo() and flush() functions and what they do. It does not fit in as a solution. Let me explain my problem more elaborately - The client calls a PHP script, script_a.php on the Apache web server, using a Keep-Alive connection. The script returns some response to the client which it uses. Now since the connection is a Keep-alive, apache still has it open for reading and writing. When the client wants to call other scripts, it just sends the request over the same connection. Now the thing is that if the server needs to send some ASYNCHRONOUS data to the client, without the client requesting for anything, a normal PHP script wont be able to do it, since the script would get executed by the web server ONLY on a client request (coz thats the way HTTP works). Now what i was thinking was - if i could get hold of the socket that is being used by apache to send data to the client, I could effectively write() to it, from a C++ app or a PHP script (which gets invoked from lets say another server). print(), echo() etc are functions that write to the output stream, which is opened as a result of the clients request, by the web server. I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Functions like echo() and print() are not going to work here, i will have to use write() so that i can specify the socket to which the data has to be written! Hope the problem is understood now. Now for your question - When the client wants to send data to the server, it just has to open a socket connection with the web server, and issue a GET or a POST request! if the connection is a keep-alive connection, and it has already been created, the client just has to do a GET or a POST without the need to connect(). This mechanism, where the client frequently connects() to the server and checks for messages is called polling. One way of reducing the high overhead of this is to reuse the connection by using a keep-alive connection. A still better improvement would be to remove the need for a poll altogether, by doing something (thats what my question is all about) on the server so that it can send data asynchronously to the server. Tx, Vinod. On Wed, 22 May 2002 Bogdan Stancescu wrote : For your specific problem, I think Mr. Lemos has provided a viable solution (using print() or echo() and flush() whenever you need to, instead of grabbing the socket and write() to it). My problem however is how you envision solving the communication the other way around (i.e. when the CLIENT wants to send data to the server). Bogdan Vinod Panicker wrote: Hi, Tx for your very prompt reply. Yeah, I'll post the solution as soon as I find it someplace. Let me outline the problem in more detail - Client (VC++) calls a PHP script on the server, specifies the connection type as Keep-Alive. The PHP script, somehow (still a big question) gets the socket on which the apache server
Re: Re: [PHP] Full-Duplex communication
At 5:55 AM + 22/5/02, Vinod Panicker wrote: I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Why not just keep your script running and have it send more data to the browser whenever it becomes available. The browser will add the new data to the page on display. With some clever use of DHTML you could probably make the existing content be updated with the new material. When a browser wants to trigger an update it will close the existing connection and open a new one. Your running script will be killed by apache and your new one would build a base page and start streaming the data in it's place. I see nothing here more complicated than a long-running script and perhaps sessions to manage the browser-initiated connections. ...Richard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Re: [PHP] Full-Duplex communication
What i have at the other end is a Instant Messenger client :) Cant have the script running till the time the user logs out can i? And also, different activities are triggered on the server asynchronously (presence status, instant messages, notifications) which has to be sent to the client. Tx, Vinod. On Wed, 22 May 2002 Richard Archer wrote : At 5:55 AM + 22/5/02, Vinod Panicker wrote: I want the ability to write to a socket thats been created earlier - i want to steal it from Apache, so that i can use it when and where i like. Why not just keep your script running and have it send more data to the browser whenever it becomes available. The browser will add the new data to the page on display. With some clever use of DHTML you could probably make the existing content be updated with the new material. When a browser wants to trigger an update it will close the existing connection and open a new one. Your running script will be killed by apache and your new one would build a base page and start streaming the data in it's place. I see nothing here more complicated than a long-running script and perhaps sessions to manage the browser-initiated connections. ...Richard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
Yes Jimmy, you are correct. MD5 is a one-way hash. Its used for getting a unique fingerprint of some data (like files / passwords etc) so that it can be compared with another MD5 hash. Thats the point of a hashing algorithm like MD5 and SHA1 - you should never need to decrypt the data. Refer to how Digital signatures and PKI works - they use MD5 hashes. The next question - A bigger keylength means stronger encryption - but it also means more CPU cycles. A bigger blocksize means that bigger chunks of data are encrypted at a time. Its always a balance that needs to be found over here - you cant use a keylength that is 2048 bits - it will give u the strongest encryption, but it will also take a lot of time. Tx, Vinod. On Wed, 22 May 2002 Jimmy Lantz wrote : Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Servers, servers and more servers
Title: Message I'm trying to put together an architecture for a web environment and have a newbie question regarding PHP and application servers... I have decided to use Apache and MySQL running on Linux, using PHP for server side scripting. Were does an application server fit into this and is it necessary? I know that if I had chosen to use ColdFusion for my scripting environment that this is an application server but I don't know where one fits in with PHP, Apache and Linux. Thnx, Stephen
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
Jimmy, You could md5 something and send it encrypted and then verify the md5, something similar to sharing keys...md5 is similar to a key...i use it as something similar to kerberos... And yes, MD5 is a one-way hash...which comes in handy... Just remember that bigger is almost always better. I would suggest trying all three (blocksize, keylength, and both) and see which one works best for you. You should see how your system deals with it and then decide...I like to have bigger keylenghts personally... Thanks, Ray Hunter -Original Message- From: Jimmy Lantz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 12:58 AM To: [EMAIL PROTECTED] Subject: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2 Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Servers, servers and more servers
On Wed, 22 May 2002, Stephen Tredrea wrote: I'm trying to put together an architecture for a web environment and have a newbie question regarding PHP and application servers... I have decided to use Apache and MySQL running on Linux, using PHP for server side scripting. Were does an application server fit into this and is it necessary? I know that if I had chosen to use ColdFusion for my scripting environment that this is an application server but I don't know where one fits in with PHP, Apache and Linux. The application server model doesn't work that well with PHP. At best performance it integrates fairly tightly with the web server (Apache, etc.). How much you need to think about this depends on the type of application you're planning for. It's quite likely that buzzword compliance won't really get you anything and can be safely ignored. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Servers, servers and more servers
When referring to an application server many times people are refereeing to a server that is running something like J2EE or EJBs or .NET with XML. They are actual applications running behind a web server. Some examples are BEA, WebSphere, or Jonas for Java apps. I have no idea about .net, not into that... If you are looking for a good Java one I suggest Jonas which is open source (free) and is fairly decent. I have used it for running applications with apache and tomcat running together... The Java apps with Jonas need to have something handle the web front-end which is Tomcat for apache Thanks, Ray Hunter -Original Message- From: Stephen Tredrea [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:06 AM To: [EMAIL PROTECTED] Subject: [PHP] Servers, servers and more servers I'm trying to put together an architecture for a web environment and have a newbie question regarding PHP and application servers... I have decided to use Apache and MySQL running on Linux, using PHP for server side scripting. Were does an application server fit into this and is it necessary? I know that if I had chosen to use ColdFusion for my scripting environment that this is an application server but I don't know where one fits in with PHP, Apache and Linux. Thnx, Stephen
Re: Re: Re: [PHP] Full-Duplex communication
At 7:01 AM + 22/5/02, Vinod Panicker wrote: What i have at the other end is a Instant Messenger client :) Which is presumably accepting some form of HTML or at least a stream of data sent over HTTP and displaying the data. If it's notdoing this, Apache is almost certainly the wrong platform for the server!! So, just keep on streaming the data to the client. Keep the script running and keep on sending the message. If you need to have the client send a status stream to the server, have it trigger a new message which will be received by a second script on the server. This script would insert the new status for that client in a database and the long-running script would periodically poll the database and act upon whatever status info it finds. Might not be instant update, but that's dependent on how often you poll for change of status. Cant have the script running till the time the user logs out can i? Why not? You're planning on sending data to them until they log out, so why not keep one script running? ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-Duplex communication
Hi Richard, Thanks for your suggestion. Yes, Apache is the wrong platform for the server. What would be ideal is a custom designed TCP based multi-threaded server. Since we had lots of constraints, we went in for Apache / PHP. What i'm trying to do is to reduce the number of compromises being made in this architecture. If i have a long running script, the script is still polling the database, wasting precious server CPU cycles. Having an open socket on which the server calls select() is much less CPU intensive. Instant is how the response should be. Thats why i'm clamouring for the socket so that i can send data directly to the client, from a C++ binary or maybe another script. And to have the script running for hours, i would have to change the script timeout to a ludicrous setting, which would leave open many more possiblities for other problems. Tx, Vinod. On Wed, 22 May 2002 Richard Archer wrote : At 7:01 AM + 22/5/02, Vinod Panicker wrote: What i have at the other end is a Instant Messenger client :) Which is presumably accepting some form of HTML or at least a stream of data sent over HTTP and displaying the data. If it's notdoing this, Apache is almost certainly the wrong platform for the server!! So, just keep on streaming the data to the client. Keep the script running and keep on sending the message. If you need to have the client send a status stream to the server, have it trigger a new message which will be received by a second script on the server. This script would insert the new status for that client in a database and the long-running script would periodically poll the database and act upon whatever status info it finds. Might not be instant update, but that's dependent on how often you poll for change of status. Cant have the script running till the time the user logs out can i? Why not? You're planning on sending data to them until they log out, so why not keep one script running? ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-Duplex communication
On 22 May 2002, Vinod Panicker wrote: Instant is how the response should be. Thats why i'm clamouring for the socket so that i can send data directly to the client, from a C++ binary or maybe another script. If you're willing to write C code, I'd suggest posing your question in comp.infosystems.www.servers.unix, where people will be happy to tell you about Apache APIs that may be of use. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish?
Hi, I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH -Original Message- From: Jimmy Lantz [mailto:[EMAIL PROTECTED]] Sent: 21 May 2002 17:28 To: [EMAIL PROTECTED] Subject: [PHP] Mcrypt: Blowfish or Twofish or no fish? Hi, started playing with Mcrypt and just wanted to ask which encryption method makes the stronger encryption? (I can supply the necesary keylength). Should I go for MCRYPT_BLOWFISH or MCRYPT_TWOFISH? Or no fish at all :) So what do I need it for? I'm going to use it encrypting files, sizes varies between some 100 k's and 4-5 mb's. / Jim Paranoia + A system w/o users = Safe system :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-Duplex communication
On Wed, 22 May 2002, Miguel Cruz wrote: On 22 May 2002, Vinod Panicker wrote: Instant is how the response should be. Thats why i'm clamouring for the socket so that i can send data directly to the client, from a C++ binary or maybe another script. If you're willing to write C code, I'd suggest posing your question in comp.infosystems.www.servers.unix, where people will be happy to tell you about Apache APIs that may be of use. And, to be honest, the listen-fork model is so simple that it's not as if you're doing a whole lot of work implementing it in PHP. You're looking at about 15 lines of code for a model case. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check if image was clicked
Hi all, I have two images on my html form - one for submit and the other for skip with name=mode_skip. In my php script I want to check if user clicked on skip image but isset($_REQUEST[mode_skip]) and !empty($_REQUEST[mode_skip]) seems to always return true. In URL submitted I saw ...mode_skip.x=Xmode_skip.y=Y. How can I determin if skip image was clicked. Thank you in advance. Regards, Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] check if image was clicked
On Wed, 22 May 2002 [EMAIL PROTECTED] wrote: I have two images on my html form - one for submit and the other for skip with name=mode_skip. In my php script I want to check if user clicked on skip image but isset($_REQUEST[mode_skip]) and !empty($_REQUEST[mode_skip]) seems to always return true. In URL submitted I saw ...mode_skip.x=Xmode_skip.y=Y. How can I determin if skip image was clicked. It'll probably be $_REQUEST['mode_skip_x'] (and .._y if you're interested in the particular coordinates). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] Full-Duplex communication
Just subscribed to comp.infosystems True, the listen-fork model would hardly be any lines of code, but the changes that will have to be done to the client and the server would be enormous. We are talking abt a production system here which needs to be optimised. I cant honestly go ahead for a solution that would involve such a huge re-write :( though i'd love to do that using PHP. Just wanted to take the chance to give a huge CONGRATS to the PHP dev team for making such an AMAZING server-side scripting language. Beats the shit out of anything else (personal opinion :)) And looking at the pace at which the development and feature additions are going on, wont be long before we have our very own PHP-OS !!! (for all i know, it might be already there) Keep up the great work guys! Tx, Vinod. On Wed, 22 May 2002 Miguel Cruz wrote : On Wed, 22 May 2002, Miguel Cruz wrote: On 22 May 2002, Vinod Panicker wrote: Instant is how the response should be. Thats why i'm clamouring for the socket so that i can send data directly to the client, from a C++ binary or maybe another script. If you're willing to write C code, I'd suggest posing your question in comp.infosystems.www.servers.unix, where people will be happy to tell you about Apache APIs that may be of use. And, to be honest, the listen-fork model is so simple that it's not as if you're doing a whole lot of work implementing it in PHP. You're looking at about 15 lines of code for a model case. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4isapi
Hmm... When usig php4isapi some functions appear not to work, readfile for example? Using php.exe works fine. -Original Message- From: Ray Hunter [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 8:13 AM To: 'Jimmy Lantz' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2 Jimmy, You could md5 something and send it encrypted and then verify the md5, something similar to sharing keys...md5 is similar to a key...i use it as something similar to kerberos... And yes, MD5 is a one-way hash...which comes in handy... Just remember that bigger is almost always better. I would suggest trying all three (blocksize, keylength, and both) and see which one works best for you. You should see how your system deals with it and then decide...I like to have bigger keylenghts personally... Thanks, Ray Hunter -Original Message- From: Jimmy Lantz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 12:58 AM To: [EMAIL PROTECTED] Subject: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2 Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
There is no use of hashing in file-encryption except to use it as a check - to see if the decrypted file matches the original file. To do this check, you can use either MD5 or SHA1. The choice is urs. If ur looking for a good encryption algorithm, you might want to consider AES (Rijndael). It supports encryption using different key sizes as well as all modes. You can take your pick from ECB / CBC also. For binary file encryption, i would recommend ECB mode. For text files, it would be better that you use CBC mode. Tx, Vinod. On Wed, 22 May 2002 Jimmy Lantz wrote : I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
File hashing is used to take a hash of the clear text. In this way, you can append the hash to the encrypted text. When decrypting, you remove this hash, decrypt the rest of the file, hash this decrypted file and see if the two hashes match up. If they don't then an incorrect key was used with the algorithm (or the data was corrupted somehow). Hashes are typically used as sanity checks in this way. JH -Original Message- From: Jimmy Lantz [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 09:31 To: [EMAIL PROTECTED] Subject: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with install php 4.2.1
I want install php 4.2.1 (download from www.php.net) on ma linux red hat 7.0 server. configure ran good with no errors but when i do make install i get this error message. make[3]: *** [gettext.lo] Error 1 make[3]: Leaving directory `/update/php-4.2.1/ext/gettext' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/update/php-4.2.1/ext/gettext' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/update/php-4.2.1/ext' make: *** [all-recursive] Error 1 How to install php with gettext ? thanks roman this is my configure : ./configure --prefix=/usr --exec-prefix=/usr/ --with-config-file-path=/etc - -disable-debug --enable-pic --enable-inline-optimization --with-apxs=/usr/sb in/apxs --disable-static --with-exec-dir=/usr/bin --with-regex=system --with -gettext --with-gd --with-jpeg-dir=/usr --with-png --with-zlib --with-db2 -- with-db3 --with-gdbm --enable-debugger --enable-magic-quotes --enable-safe-m ode --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-yp --enab le-ftp --with-xml --with-mysql -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
And why not use AES, which is an industry standard and having being proven as the best encryption algorithm in recent times? http://csrc.nist.gov/encryption/aes/aesfact.html As far as ECB mode is concerned, I dont know what problems you are talking about. I'm aware that the data gets encrypted in independed blocks and its easier to crack it, but its faster than other modes. Tx, Vinod. On Wed, 22 May 2002 John Horton wrote : why use AES? Blowfish can have a 448 bit key size! Also, why use ebc mode with all the problems which come with it? JH -Original Message- From: Vinod Panicker [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 10:06 To: Jimmy Lantz Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 There is no use of hashing in file-encryption except to use it as a check - to see if the decrypted file matches the original file. To do this check, you can use either MD5 or SHA1. The choice is urs. If ur looking for a good encryption algorithm, you might want to consider AES (Rijndael). It supports encryption using different key sizes as well as all modes. You can take your pick from ECB / CBC also. For binary file encryption, i would recommend ECB mode. For text files, it would be better that you use CBC mode. Tx, Vinod. On Wed, 22 May 2002 Jimmy Lantz wrote : I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] variables
When are set in php.ini (php version 4.2.1 on linux) register_globals = Off how I read variables from html files with forms in other php file ? Thanks roman for example : html file : form action=query.php method=POST input type=text name=name1 value= input type=submit value = OK class=button /form and in php file ? echo $name1; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
One of the reasons I like Blowfish is that I have used it for years, and there have been no successfull attempts to crack it. Why do you encrypt binary files in ebc and text files in cbc? JH -Original Message- From: Vinod Panicker [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 10:25 To: John Horton Cc: [EMAIL PROTECTED]; Jimmy Lantz Subject: Re: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 And why not use AES, which is an industry standard and having being proven as the best encryption algorithm in recent times? http://csrc.nist.gov/encryption/aes/aesfact.html As far as ECB mode is concerned, I dont know what problems you are talking about. I'm aware that the data gets encrypted in independed blocks and its easier to crack it, but its faster than other modes. Tx, Vinod. On Wed, 22 May 2002 John Horton wrote : why use AES? Blowfish can have a 448 bit key size! Also, why use ebc mode with all the problems which come with it? JH -Original Message- From: Vinod Panicker [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 10:06 To: Jimmy Lantz Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 There is no use of hashing in file-encryption except to use it as a check - to see if the decrypted file matches the original file. To do this check, you can use either MD5 or SHA1. The choice is urs. If ur looking for a good encryption algorithm, you might want to consider AES (Rijndael). It supports encryption using different key sizes as well as all modes. You can take your pick from ECB / CBC also. For binary file encryption, i would recommend ECB mode. For text files, it would be better that you use CBC mode. Tx, Vinod. On Wed, 22 May 2002 Jimmy Lantz wrote : I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Executebale code from a databse
Hi. I'm changing my website to one based on My-SQL which will help with organization and searching etc. Hopefully, the code for all the pages will be stored in the database too. However, I cannot get PHP to parse / execute the code stored in the database. The script $query = mysql_query(SELECT * FROM pages, $link); $result = mysql_fetch_array($query); print $result['4']; gets the content of the page (column 4 of the database) but displays include(common/counter.php); include(common/navbar.php); to the screen instead of opening and including these two files in the output. Is there something I need to do to the result to make it executable? Might I need a \n between the two lines of code? I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure which version! (fairly recent though) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Executebale code from a databse
Use eval ... although beware of the serious security implications. Hi. I'm changing my website to one based on My-SQL which will help with organization and searching etc. Hopefully, the code for all the pages will be stored in the database too. However, I cannot get PHP to parse / execute the code stored in the database. The script $query = mysql_query(SELECT * FROM pages, $link); $result = mysql_fetch_array($query); print $result['4']; gets the content of the page (column 4 of the database) but displays include(common/counter.php); include(common/navbar.php); to the screen instead of opening and including these two files in the output. Is there something I need to do to the result to make it executable? Might I need a \n between the two lines of code? I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure which version! (fairly recent though) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Dan Hardiker [[EMAIL PROTECTED]] ADAM Software Systems Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: variables
you can use $_POST['name1'] if you're using post vars $_GET['name1'] if you're using get vars Regards Michael Roman Duriancik [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... When are set in php.ini (php version 4.2.1 on linux) register_globals = Off how I read variables from html files with forms in other php file ? Thanks roman for example : html file : form action=query.php method=POST input type=text name=name1 value= input type=submit value = OK class=button /form and in php file ? echo $name1; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
Thats why lots of people like Blowfish, including myself. I am using it in a production environment with PHP and mcrypt. In ECB mode, the blocks are encrypted independently, whereas in CBC mode, the blocks are encrypted with information based on the previous block. What this means is that if a particular block which was encrypted using ECB mode is decrypted, it would show the plain text, whereas it wont happen if the data was encrypted using CBC mode. Plain text files can be seen and understood, whereas its much more difficult to understand if the crack attempt on a block of binary data was successful, since the data wont necessarily make any sense. Tx, Vinod. On Wed, 22 May 2002 John Horton wrote : One of the reasons I like Blowfish is that I have used it for years, and there have been no successfull attempts to crack it. Why do you encrypt binary files in ebc and text files in cbc? JH -Original Message- From: Vinod Panicker [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 10:25 To: John Horton Cc: [EMAIL PROTECTED]; Jimmy Lantz Subject: Re: RE: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 And why not use AES, which is an industry standard and having being proven as the best encryption algorithm in recent times? http://csrc.nist.gov/encryption/aes/aesfact.html As far as ECB mode is concerned, I dont know what problems you are talking about. I'm aware that the data gets encrypted in independed blocks and its easier to crack it, but its faster than other modes. Tx, Vinod. On Wed, 22 May 2002 John Horton wrote : why use AES? Blowfish can have a 448 bit key size! Also, why use ebc mode with all the problems which come with it? JH -Original Message- From: Vinod Panicker [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 10:06 To: Jimmy Lantz Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3 There is no use of hashing in file-encryption except to use it as a check - to see if the decrypted file matches the original file. To do this check, you can use either MD5 or SHA1. The choice is urs. If ur looking for a good encryption algorithm, you might want to consider AES (Rijndael). It supports encryption using different key sizes as well as all modes. You can take your pick from ECB / CBC also. For binary file encryption, i would recommend ECB mode. For text files, it would be better that you use CBC mode. Tx, Vinod. On Wed, 22 May 2002 Jimmy Lantz wrote : I believe that twofish has been successfully broken, so use blowfish instead. Typically, for encrypting files you will use an algorithm like blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt supports this. Also, when creating the hash of the file, it is probably best to use SHA-1 instead of MD5, as there appears to be some concern with MD5 over it's compression function. HTH JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs _ Click below to visit monsterindia.com and review jobs in India or Abroad http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: variables
Also, it's good to read the press releases: http://www.php.net/release_4_2_1.php External variables We would also like to attend you on a big change in PHP 4.2.0 concerning variable handling. External variables (from the environment, the HTTP request, cookies or the web server) are no longer registered in the global scope by default. The preferred method of accessing these external variables is by using the new Superglobal arrays, introduced in PHP 4.1.0. http://www.php.net/release_4_1_0.php On Wed, May 22, 2002 at 11:52:02AM +0200, Michael Virnstein wrote: : : you can use : : $_POST['name1'] if you're using post vars : $_GET['name1'] if you're using get vars : : Roman Duriancik [EMAIL PROTECTED] schrieb: : : When are set in php.ini (php version 4.2.1 on linux) register_globals = Off : how I read variables from html files with forms in other php file ? -- Eugene Lee [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Smart Navigation
Is there any way to emulate ASP.NET's smartNavigation trick? What it does it to maintain control state and scroll position between postbacks, as well as stopping the page from flickering when reloading. It makes a mostly static page look very cool. Anyone done this in PHP, or know how to use IFRAMEs to do it manually? Cheers Fred Forsyth. Senior Software Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executebale code from a databse
eval ('?'.$var.'?php'); if you want to eval usual php scripts. (We close the ? then comes the content of the php script which also can contain html and then we reopen ?php again) So if you have a file: ?php include('test.php'); ? and you say $var = ?php include('test.php'); ?; you'll result in ... eval(??php include('test.php'); ??php); which will evaluate normally. Regards Michael Peter [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi. I'm changing my website to one based on My-SQL which will help with organization and searching etc. Hopefully, the code for all the pages will be stored in the database too. However, I cannot get PHP to parse / execute the code stored in the database. The script $query = mysql_query(SELECT * FROM pages, $link); $result = mysql_fetch_array($query); print $result['4']; gets the content of the page (column 4 of the database) but displays include(common/counter.php); include(common/navbar.php); to the screen instead of opening and including these two files in the output. Is there something I need to do to the result to make it executable? Might I need a \n between the two lines of code? I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure which version! (fairly recent though) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing PHP globals from a module.
On Tue, May 21, 2002 at 08:03:36AM -0700, Rasmus Lerdorf wrote: Depends a bit on what sort of globals you are after. If you mean a global variable set by the user in the global symbol table you would do: pval **tmp; if(zend_hash_find(EG(symbol_table), foo, 3, (void **)tmp) == SUCCESS) { RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } else { RETURN_FALSE; } Would fetch $foo from the global symbol table, stick it in tmp and return it from your function. I might be able to use this, but what I am really after is getting values from the session variables, like $_SESSION[id]. Is this possible at all and if so, is this documented somewhere? On Tue, 21 May 2002, Eric Veldhuyzen wrote: Hi, I have just written a module for PHP (in C, linked with PHP statically). Now I need to access session variables and other globals from whithin my module. But I can't find how I should do this, I see documentation on how to call user functions, and how to create new global varables, but now how to access existing globals. Could somebody please tell me where tell me where this is documented if it is documented at all, or explain it to me if it is not documented yet? -- #!perl # Life ain't fair, but root passwords help. # Eric Veldhuyzen [EMAIL PROTECTED] $!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger /.(.)...(.)(.)(.)..(.)..(.)/;`$^$~$/$: $^$*$@$~ $_$;` -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: JavaScript vs. Header redirect
note: you should use $array[test] if test is a string and $array[test] if test is a constant. do not use $array[test] if you mean the string test. $array[test] will also work, if test is a string. Php then tries to look for a constant with name test, won't find one and evaluate test as string. But as soon as you define a constant with the name test, it won't work as expected: $array = array(); $array[test] = hello; define(test, thetest); $array[test] = bye; print_r($array); will output: Array ( [test] = hello [thetest] = bye ) This could also happen if the php dev team decides to set a constant with the name test. Therefore always use for string-keys in arrays. Regards Michael Hunter Vaughn [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there any reason I can't just use a JavaScript redirect from a PHP login handling script since I can't seem to get the header(Location: URL); function to work? Any security concerns or anything else? As far as I can tell, all calls to header fail as soon as I attain variables based on a POST submission. See example below. ? $username = $_POST[username]; $password = $_POST[password]; if(some username/password format verification) { query the database if($password matches pass in database) { session_start(); $email = $Row[0]; $memberID = $Row[1]; session_register('email'); session_register('memberID'); //header(Location: URL);This doesn't work. print(script language=\JavaScript\window.location = \http://depts.washington.edu/bionano/HTML/letsboogie22.html\;;/script); exit; } else { print(That didn't work...); } } else { print(Please enter your username password.); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Smart Navigation
Interesting topic, although highly off-topic. I just had a quick kick around, and found this page: http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/Downlo ads/samples/Internet/ASP_DOT_NET_ServerControls/SmartNav/default.asp Doesn't really say HOW it does it, but here's the interesting part: I'm already experiencing simular benefits as described here, on PHP sites I've developed (and all over the web), using IE 5.1.3 Mac. On pages that share identical content, it doesn't flicker, and yes I'm seeing the other benefits (state, scroll position, etc) as well. Here's what they say it can do: 1Eliminates the flash, or flickering, caused by navigation. 2Persists the scroll position between page navigations. 3Persists element focus between navigations. 4Retains only the last page state in the browser history. I don't know how much can be done on the server to help this. Points #2-4 are client-side issues IMHO, and the only interesting one is really #1. You can emulate this sort of application feel in many ways. For starters: 1 FRAME will only refresh content in the frame specified 2 IFRAME allows you to embed content (HTML files) inside each other... same as a FRAME, but I like to think of it as a floating frame that can be positioned in-line with other HTML elements (like inside a table, block of text, etc). 3 CSS and layers. Load a whole site in (hidden) and use javascript to switch between content layers that have already been loaded. Either way, I can't imagine what can be done on the server side to help this, and it isn't exactly PHP related so far :) Justin on 22/05/02 8:09 PM, Fred Forsyth ([EMAIL PROTECTED]) wrote: Is there any way to emulate ASP.NET's smartNavigation trick? What it does it to maintain control state and scroll position between postbacks, as well as stopping the page from flickering when reloading. It makes a mostly static page look very cool. Anyone done this in PHP, or know how to use IFRAMEs to do it manually? Cheers Fred Forsyth. Senior Software Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Smart Navigation
I spoke too soon -- it looks like it's just a JavaScript library which I was able to download. I can't be bothered scanning through 16k of .js files to figure it out though :) Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whats Function like response.redirect
what function in PHP like response.redirect http://www.detik.com; in ASP ? Roy Daniel , ST IT Developer System - PT BERCA COMPUTEL My E-mail : [EMAIL PROTECTED] and : [EMAIL PROTECTED] / [EMAIL PROTECTED] My ICQNumber : # 103507581 My Phone Cell : 0816-1192832 My Web site: http://www22.brinkster.com/roydaniel/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats Function like response.redirect
header(Location: http://www.detik.com;); www.php.net/header Read the manual page... ---John Holmes... - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 5:12 AM Subject: [PHP] Whats Function like response.redirect what function in PHP like response.redirect http://www.detik.com; in ASP ? Roy Daniel , ST IT Developer System - PT BERCA COMPUTEL My E-mail : [EMAIL PROTECTED] and : [EMAIL PROTECTED] / [EMAIL PROTECTED] My ICQNumber : # 103507581 My Phone Cell : 0816-1192832 My Web site: http://www22.brinkster.com/roydaniel/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Whats Function like response.redirect
Hi Roy, what function in PHP like response.redirect http://www.detik.com; in ASP? header (Location: http://www.detik.com/;); HTH Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: substr....what does this mean? (newbie)
Hi, first take a look at this page: http://www.php.net/manual/en/function.substr.php if (substr($text, -1) == .) substr($text, -1) will return the last character in string $text. if it is a . the if statement will evaluate to true and it'll do the following {$test = substr($text, 0, -1);} $test = substr($text, 0, -1) will return all characters of $text but the last one and write them to $test. a negative third parameter means ommitting characters from the end of the string. The end of the string depends on the second parameter, which tells us where to start. if it is positive, start is the start and end is the end of the string, if it is negative start is the end and end is the start of the string Regards Michael P.S. the manual is your friend, learn how to read it!!! R [EMAIL PROTECTED] schrieb im Newsbeitrag 000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn">news:000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn... Hi ppl, Can you tell me what does this mean? if (substr($text, -1) == .) {$test = substr($text, 0, -1);} I know the if part searches the $text from the starting for the . I am just confused about what the second and third arguement does in the substr. (Second line) I know that this is an easy question for you PHP guys out there, and I know i will get an answer, so I thank you all in advance. Cheers -Ryan A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session vs MySQL-dbase
Hi everyone, since I'm developing a PHP-based forum, and still improving it, I was wondering about some issue. I'm having registered users, and keep their data in a dbase. When they log in, data is retrieved from the database. Now some slight problem comes up. I'm working on an account on a server with various websites on it, and a MySQL-server which is also used by many site with this hosting company. Since we already had some troubles with this company, and we were obliged to reprogram many features to make sure the server wouldn't flip anymore. First they complained about CPU-usage, afterwards, it was MySQL-connections (since I make many)... I'm not asking you guys to tell me to turn over to a dedicated server, because within a few months, this will probably happen. But this situation brought up a question to my mind, and I can 't find the answer in the manuals or sites that I know... Finally, the question :-) : Which would result in a higher server-load (assume everything is running on one machine): user-validation through sessions or by checking the SID in a MySQL-dbase? Thx for all advice you guys can give... Yves. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session vs MySQL-dbase
Hi everyone, since I'm developing a PHP-based forum, and still improving it, I was wondering about some issue. I'm having registered users, and keep their data in a dbase. When they log in, data is retrieved from the database. Now some slight problem comes up. I'm working on an account on a server with various websites on it, and a MySQL-server which is also used by many site with this hosting company. Since we already had some troubles with this company, and we were obliged to reprogram many features to make sure the server wouldn't flip anymore. First they complained about CPU-usage, afterwards, it was MySQL-connections (since I make many)... I'm not asking you guys to tell me to turn over to a dedicated server, because within a few months, this will probably happen. But this situation brought up a question to my mind, and I can 't find the answer in the manuals or sites that I know... Finally, the question :-) : Which would result in a higher server-load (assume everything is running on one machine): user-validation through sessions or by checking the SID in a MySQL-dbase? Thx for all advice you guys can give... Yves. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC for Informix
Hi there. Could someone please tell me where I could get hold of the ODBC drivers to connect to Informix with PHP. Is there anything else I should know. Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] voting using text files
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Are there any inherent problems I need be aware of for example (I can already think of one: what if 2 people try to vote at the same time?) Just some general thoughts would be greatly appreciated ;) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8659rHpvrrTa6L5oRAu8PAJ48Xf71iv98nN9nTac+tyHX5PJ+VgCgrTuI dk/+Hf8S+L9NdBo02oDt25U= =ESei -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accessing PHP globals from a module.
On Tue, May 21, 2002 at 08:03:36AM -0700, Rasmus Lerdorf wrote: Depends a bit on what sort of globals you are after. If you mean a global variable set by the user in the global symbol table you would do: pval **tmp; if(zend_hash_find(EG(symbol_table), foo, 3, (void **)tmp) == SUCCESS) { RETURN_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } else { RETURN_FALSE; } Would fetch $foo from the global symbol table, stick it in tmp and return it from your function. I might be able to use this, but what I am really after is getting values from the session variables, like $_SESSION[id]. Is this possible at all and if so, is this documented somewhere? Yup, in ext/session/session.c -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
Use file locking, so only one instance of the script is writing to the file at a time... www.php.net/flock ---John Holmes... - Original Message - From: Nick Wilson [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 9:38 AM Subject: [PHP] voting using text files -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Are there any inherent problems I need be aware of for example (I can already think of one: what if 2 people try to vote at the same time?) Just some general thoughts would be greatly appreciated ;) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8659rHpvrrTa6L5oRAu8PAJ48Xf71iv98nN9nTac+tyHX5PJ+VgCgrTuI dk/+Hf8S+L9NdBo02oDt25U= =ESei -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using the pdf tags.
Does anyone know of a way to rotate text in a pdf? I can rotate an image and rotate a page but can not seen to rotate text. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read from flatfile and convert
Hey Guys, Heres the deal, I have a client who wants me to make a testimonials program for him, Which is no problem till now, but now he has come with some additional requirments that I dont know how to deal with... he has a flatfile with a crap load of entries and he wants me to export it into mySql! Do any of you know what function to write to read a record from a flatfile and write it to the database record for record? doing it manually will be a pain in the --- but i dont want to lose the chance for work...:-( The flatfile was written using perl. If need be I can give you the MyTestimonialsDB.txt file to screw around with. As usual, Any help appreciated. Kindly reply, Cheers, -Ryan. /*Don't steal. The government hates competition.*/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] in_array problems (another pair of eyes?)
Unless you are using PHP version 4.2 or higher, the first argument can't be an array. Kirk -Original Message- From: Jas [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 11:46 AM To: [EMAIL PROTECTED] Subject: [PHP] in_array problems (another pair of eyes?) I don't think I am using the syntax correctly, I have been looking at this function on php.net and everything I have seen says my code should be working. A form allows the user to upload a file: form name=img1 method=post action=upload_done.php enctype=multipart/form-data input type=file name=img1 size=25 input type=submit name=Submit value=save input type=reset name=reset value=reset /form Resulting file (upload_done.php): ?php $types = array(.gif, .jpg, .jpeg, .htm, .pdf); //place file type into array if (in_array(array ('.jpg', '.jpeg'), $types)) { //this is the error line (line 7) print jpg file; } ? And here is my error: Warning: Wrong datatype for first argument in call to in_array in upload_done.php on line 7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read from flatfile and convert
r wrote: Hey Guys, Heres the deal, I have a client who wants me to make a testimonials program for him, Which is no problem till now, but now he has come with some additional requirments that I dont know how to deal with... he has a flatfile with a crap load of entries and he wants me to export it into mySql! Do any of you know what function to write to read a record from a flatfile and write it to the database record for record? doing it manually will be a pain in the --- but i dont want to lose the chance for work...:-( The flatfile was written using perl. If need be I can give you the MyTestimonialsDB.txt file to screw around with. Depends on the format contained in the flat file... if it is some kind of standard format then you may find a tool that does the job for you... more than likely the format is custom and you'll need to do the grunt work yourself - either by hand (small file) or by writing a script to do it for you. Cheers, Rob. -- .-. | Robert Cummings | :-`. | Webdeployer - Chief PHP and Java Programmer | :--: | Mail : mailto:[EMAIL PROTECTED] | | Phone : (613) 731-4046 x.109 | :--: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `--' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] read from flatfile and convert
How is the text file organized? Is it one testimonial per line? or is there some other kind of seperator? This should be easy. Use file() to read in the file, then do an insert for each line. one little loop will load the whole file for you. how large of a file is it? ---John Holmes... - Original Message - From: r [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 11:05 PM Subject: [PHP] read from flatfile and convert Hey Guys, Heres the deal, I have a client who wants me to make a testimonials program for him, Which is no problem till now, but now he has come with some additional requirments that I dont know how to deal with... he has a flatfile with a crap load of entries and he wants me to export it into mySql! Do any of you know what function to write to read a record from a flatfile and write it to the database record for record? doing it manually will be a pain in the --- but i dont want to lose the chance for work...:-( The flatfile was written using perl. If need be I can give you the MyTestimonialsDB.txt file to screw around with. As usual, Any help appreciated. Kindly reply, Cheers, -Ryan. /*Don't steal. The government hates competition.*/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 4
I always hate mentioning this 'cause I feel like an attention whore or something, but nevertheless, I can't get the thing tested thouroughly without a bit of whoring... I've been working on a crypto extension for PHP for a while now, and since you guys seem into the crypto thing, you might like to check it out. It's not really meant to be a replacement for mcrypt/mhash or anything, just as an alternative. (One advantage is that it works on Windows as well as UNIX, and I believe the native, non-cygwin win32 port of libmcrypt/libmhash are no longer maintained.) Anyways, if you're at all interested, see http://www.tutorbuddy.com/software/ It supports pretty much all of the algorithms mcrypt and mhash do, plus a few more. (30-some block and stream ciphers, the usual block cipher modes, and 17 hash/checksum algorithms altogether.) Again, I hate the self-promotion, but as you all probably know, cryptography is useless unless it's been tested, studied and proven to be effective. J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg_replace problems
I'm trying to replace values within a string with a value looked up from a database. I have a function that looks up the value in the database for me but I'm having trouble passing the value to the function because of the backslashes, is there a way around this? Code: $cntnt = eregi_replace(\[L=([a-zA-Z]+)].([a-zA-Z]+)\[EL], a href=\ . fndLnk(\\1) . \\\2/a, $cntnt); fndLnk is the function and the error I receive is - Warning: Unexpected character in input: '\' (ASCII=92) state=1 Thanks for any help Zac
Re: [PHP] voting using text files
Just have a look around for a counter script which uses file locking, then port it to suit your needs, or check out the flock() example that *i think* there is in the manual. phpbuilder.com or zend.com or the rest are bound to have a script. Justin French on 22/05/02 11:38 PM, Nick Wilson ([EMAIL PROTECTED]) wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Are there any inherent problems I need be aware of for example (I can already think of one: what if 2 people try to vote at the same time?) Just some general thoughts would be greatly appreciated ;) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8659rHpvrrTa6L5oRAu8PAJ48Xf71iv98nN9nTac+tyHX5PJ+VgCgrTuI dk/+Hf8S+L9NdBo02oDt25U= =ESei -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
On Wed, 22 May 2002, Jimmy Lantz wrote: Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? Does it really make a difference? I'm not exactly crypto-literate, but the idea is to encrypt the thing so that it's not visible by Foo Bar even if he does break into your system. If someone is competent enough to break Mcrypt's 128/256bit cyphers, then it doesn't really matter if you use the weak or the strong ones. I've used 256bit Rijndael in CBC mode, but I wouldn't feel more/less safe if it was CFB or if it was 3DES. Just my 2c. --thalis / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help .. deprecated messages
Hello php-general, We have recently hand a system melt down sigh. After reinstalling apache, PHP4 and Mysql I then copied/restored from backup the files(data and all). Using phpmyadmin (2x) or infact any of my previous applications I get errors like the following .. Warning: mysql_db_query is deprecated; use mysql_select_db() and mysql_query() instead in c:\program files\apache group\apache\htdocs\phpmyadmin\lib.inc.php on line 506 Once again .. note that this is not just phpmyadmin. All my apps seem to be doing this type of error. So my question is ... why would I be getting this now? I have restored in this manor before. What did I miss in this? I can send the phpinfo page if necessary -- Best regards, Dtsig mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to simultaneously send HTML *and* start download?
Following on from my mail yesterday, here are the results of testing Billy's multipart content method on Windows browsers (Windows 98 to be precise): * IE 6.0 displays the boundary markers and content-type headers inline and also the contents of myfile.foo instead of saving it to disk. * Netscape 6.2.2 displays the HTML correctly and prompts regarding whether myfile.foo should be saved to disk but then appears to do nothing. * Netscape 4.7 displays the HTML correctly and begins downloading the file, only prompting for where it should be saved when the download is complete. * Opera 6.0 displays the HTMl correctly and prompts for where you wish to save the file, but incorrectly uses the script name and not the file name as specified in the content-disposition header. (It is possible that the behaviour of both Netscape 4.7 and Netscape 6.2.2 was in part due to interaction with Norton Anti-Virus.) Hope this is informative and not spam. Best, Darren On Tue, 2002-05-21 at 21:02, Billy S Halsey wrote: Hi, Here's the shell of a script I wrote a while back to do exactly what you want: ?php header(Content-Type: multipart/mixed; boundary=\-Boundary-12399\); print ---Boundary-12399\r\n; print Content-Type: text/html\r\n; print \r\n; // Your HTML code goes here print \n; print ---Boundary-12399\r\n; print Content-Type: application/octet-stream\r\n; print Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n; readfile(./foo.tar.gz); print ---Boundary-12399--\r\n; print \r\n; ? Note the format of the Boundary headers, especially the dashes. -- == D. D. Brierton[EMAIL PROTECTED] www.dzr-web.com Trying is the first step before failure (Homer Simpson) == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ini_set('display_errors',1) not working.
I have the following in my php.ini file: display_errors=Off log_errors=On error_log=filename I want to turn on display_errors for developers, I'm attempting to use ini_set to do this. I made a script like: ?php ini_set('display_errors',1); ini_set('log_errors',0); ini_set('error_log',null); ini phpinfo(); ? (I added log_errors and error_log lines in an attempt to get this working) The phpinfo() shows that the local values for the variables I set as I just set them, and the master values are those of the php.ini file. Everything looks how I what it. If I add an error: echo asdfadfasdfa; The script behaves as it would in the php.ini, it displays no error and writes it to the log. Does anybody have any ideas on why this isn't working? -- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Online PHP training course
Merrow Internet Services run online training courses. We use a web conferencing system to create a virtual classroom where we hold live interactive seminars. You can connect to the conference with an ordinary telephone modem, so you can take part at home or at work. Our Introduction to PHP Programming starts on the 13th June 2002. It runs for one day (eight hours) in total. We have scheduled times to suit customers in a wide range of timezones including the UK, mainland Europe and the USA. The course costs 212 Pounds, 341 Euros or $310. Prices include VAT (sales tax) at the UK rate of 17.5%. For more details visit http://www.merrowinternet.com. Simon Ritchie Merrow Internet Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help .. deprecated messages
It's just a warning, not an error. It's probably always been there, but your error reporting was set to a level that didn't display it. Turn your error reporting level up in php.ini. it's set lower in PHP 4.1+ than it has been in the past. Best fix is to of course not use the mysql_db_query() function... ---John Holmes... - Original Message - From: Dtsig [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 11:38 AM Subject: [PHP] Help .. deprecated messages Hello php-general, We have recently hand a system melt down sigh. After reinstalling apache, PHP4 and Mysql I then copied/restored from backup the files(data and all). Using phpmyadmin (2x) or infact any of my previous applications I get errors like the following .. Warning: mysql_db_query is deprecated; use mysql_select_db() and mysql_query() instead in c:\program files\apache group\apache\htdocs\phpmyadmin\lib.inc.php on line 506 Once again .. note that this is not just phpmyadmin. All my apps seem to be doing this type of error. So my question is ... why would I be getting this now? I have restored in this manor before. What did I miss in this? I can send the phpinfo page if necessary -- Best regards, Dtsig mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP PGP
Hi I need to encrypt some fields in my mysql database. I need to ask a user for a pass when he enters the data, encrypt it and show him the data only if he enters the pass again. I know that pgp has a module that works with passwords instead of keys. I never tried this on Linux though. Any help will be appreciated. thanks berber
RE: [PHP] PHP PGP
calculate a hash of the pass the user enters and store that. When the user enters a pass again to get the data, then hash this pass and see if it matches the stored hash. If it does , then send the user the data. create a table that stores username, and hashed passwords for authentication. HTH -Original Message- From: Boaz Yahav [mailto:[EMAIL PROTECTED]] Sent: 22 May 2002 17:43 To: PHP General (E-mail) Subject: [PHP] PHP PGP Hi I need to encrypt some fields in my mysql database. I need to ask a user for a pass when he enters the data, encrypt it and show him the data only if he enters the pass again. I know that pgp has a module that works with passwords instead of keys. I never tried this on Linux though. Any help will be appreciated. thanks berber -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] upload problem...
Yeah I tried that as well, no dice, however here is what I the code that DID work. Hope this helps anyone that is trying to accomplish much of the same. Jas ?php session_start(); //start the session if one hasn't been started if (isset($HTTP_SESSION_VARS['user']) || isset($HTTP_SESSION_VARS['password'])) { // check for username and password in session $main = Your changes have been saved to the database. If you need to make more changes please select the page from the menu and follow the instructions.; // echo this somewhere on your page elseif ($img1_name != eregi('.jpg$', $img1_name)) { // check for empty file or .jpg file for upload @copy($img1, /path/to/images/directory/$img1_name) or die (Could not upload file, please try again after making sure the file is less than 2mb in size and the file name correct); // upload the file or error if not correct type or empty value for file } else { die(No file selected for upload, or the file was not the correct type. Please only upload .jpg files.); // kill upload } Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Wednesday 22 May 2002 07:02, Jas wrote: Ok here is my error message: Warning: Unable to open '' for reading: No such file or directory in upload_done.php on line 9 I have checked permissions on the folder and they are correct, my only guess is that upon doing several checks, session vars, etc... it is loosing the file name somewhere. Try modelling your code on the example in the manual. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* sticktion */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Help .. deprecated messages
John, First thanks for the note. 1JWH It's just a warning, not an error. It's probably always been there, but your 1JWH error reporting was set to a level that didn't display it. Turn your error 1JWH reporting level up in php.ini. it's set lower in PHP 4.1+ than it has been 1JWH in the past. I probably didn't make myself clear .. once installed (in case of any registry settings .. I HATE windows registry) I copied the old directories (php, mysql and apache) back over the top of the new directories. I also copied mysql.ini and php.ini from the old windows directory to the new windows directory. This was all done in hopes that I would then have the exact same setup as before ... So why would I be getting this message now? By the way .. here is the bit from the original/current php.ini You will note that it does all ... error_reporting = E_ALL ~E_NOTICE ; Print out errors (as a part of the output). For production web sites, ; you're strongly encouraged to turn this feature off, and use error logging ; instead (see below). Keeping display_errors enabled on a production web site ; may reveal security information to end users, such as file paths on your Web ; server, your database schema or other information. display_errors = On ; Even when display_errors is on, errors that occur during PHP's startup ; sequence are not displayed. It's strongly recommended to keep ; display_startup_errors off, except for when debugging. display_startup_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below)) ; As stated above, you're strongly advised to use error logging in place of ; error displaying on production web sites. log_errors = Off ; Store the last error/warning message in $php_errormsg (boolean). track_errors = Off ; String to output before an error message. ;error_prepend_string = font color=ff ; String to output after an error message. ;error_append_string = /font ; Log errors to specified file. ;error_log = filename ; Log errors to syslog (Event Log on NT, not valid in Windows 95). ;error_log = syslog ; Warn if the + operator is used with strings. warn_plus_overloading = Off 1JWH Best fix is to of course not use the mysql_db_query() function... I agree .. and will do this as the time permits Thanks again 1JWH - Original Message - 1JWH From: Dtsig [EMAIL PROTECTED] 1JWH To: [EMAIL PROTECTED] 1JWH Sent: Wednesday, May 22, 2002 11:38 AM 1JWH Subject: [PHP] Help .. deprecated messages Hello php-general, We have recently hand a system melt down sigh. After reinstalling apache, PHP4 and Mysql I then copied/restored from backup the files(data and all). Using phpmyadmin (2x) or infact any of my previous applications I get errors like the following .. Warning: mysql_db_query is deprecated; use mysql_select_db() and mysql_query() instead in c:\program files\apache group\apache\htdocs\phpmyadmin\lib.inc.php on line 506 Once again .. note that this is not just phpmyadmin. All my apps seem to be doing this type of error. So my question is ... why would I be getting this now? I have restored in this manor before. What did I miss in this? I can send the phpinfo page if necessary -- Best regards, Dtsig mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Best regards, Dtsigmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing an array on
Whats the best way to pass on array on in a link ? eg offset is where we are (what page) but state is an array, with a variable size href=joblist.php?offset=$offsetstate=$state thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP PGP
Hello, On 05/22/2002 01:43 PM, Boaz Yahav wrote: Hi I need to encrypt some fields in my mysql database. I need to ask a user for a pass when he enters the data, encrypt it and show him the data only if he enters the pass again. I know that pgp has a module that works with passwords instead of keys. I never tried this on Linux though. I don't know if this solves your problem, but have you tried this? http://www.phpclasses.org/pgp -- Regards, Manuel Lemos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session.save_path
Hi all, I'm trying to install php/apache with phptriad. This worked fine, however when I'm using session variables the thing goes nuts: Warning: open(/tmp\sess_d22b57336449f89ad54b974794dd53f4, O_RDWR) failed: m (2) in C:\apache\htdocs\dm\wwwtest\phpincludes\session\session.php on line 2 Warning: open(/tmp\sess_d22b57336449f89ad54b974794dd53f4, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 -- This is how my phpinfo() sees it: session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On Does anybody have any idea what to do. Should I adjust php.ini?? And where should this directory /tmp be located?? cause it's not on my harddisk-- so this might be the error. (i'm on winXP BTW) well, thx for all info! regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] -
[PHP] Re: Passing an array on
Hi You could try : http://www.php.net/manual/en/function.serialize.php http://www.php.net/manual/en/function.unserialize.php Pass the serialized array in the URL, then unserialize it back when in the target page. Regards Girish -- www.girishnath.co.uk John Fishworld [EMAIL PROTECTED] wrote in message 009501c201aa$a077d070$04010a0a@fishworld">news:009501c201aa$a077d070$04010a0a@fishworld... Whats the best way to pass on array on in a link ? eg offset is where we are (what page) but state is an array, with a variable size href=joblist.php?offset=$offsetstate=$state thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Help .. deprecated messages
On Thursday 23 May 2002 00:12, Dtsig wrote: 1JWH It's just a warning, not an error. It's probably always been there, but your 1JWH error reporting was set to a level that didn't display it. Turn your error 1JWH reporting level up in php.ini. it's set lower in PHP 4.1+ than it has been 1JWH in the past. I probably didn't make myself clear .. once installed (in case of any registry settings .. I HATE windows registry) I copied the old directories (php, mysql and apache) back over the top of the new directories. I also copied mysql.ini and php.ini from the old windows directory to the new windows directory. This was all done in hopes that I would then have the exact same setup as before ... What version of php was you using before? So why would I be getting this message now? The obvious explanation is that if you had been using an old version of php (pre 4.0.6) then ... Warning: mysql_db_query is deprecated; use mysql_select_db() and mysql_query() instead in c:\program files\apache group\apache\htdocs\phpmyadmin\lib.inc.php on line 506 ... mysql_db_query() had not yet been deprecated thus you would not have seen such an error message. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Can you MAIL a BEAN CAKE? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
Using file locking, if two people tried to use the script at the same time, wouldn't there be an error for one of them? My first guess at defeating this is having the script write a file named after the voter's IP. Have the file written to a different directory for whatever choices they have, then use readdir() to count the files in each directory, i.e. the number of votes for each choice. Then if that same IP tries to vote again, check it against votes already received and approve/deny it. I guess another way, have files written with consecutive titles, vote1, vote2, vote3, inside each one, store their vote choice, their IP, and a timestamp. I don't know, I'm not an expert! Just throwing out ideas. Jason Soza - Original Message - From: 1LT John W. Holmes [EMAIL PROTECTED] Date: Wednesday, May 22, 2002 5:46 am Subject: Re: [PHP] voting using text files Use file locking, so only one instance of the script is writing to the file at a time... www.php.net/flock ---John Holmes... - Original Message - From: Nick Wilson [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 9:38 AM Subject: [PHP] voting using text files -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi all I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Are there any inherent problems I need be aware of for example (I can already think of one: what if 2 people try to vote at the same time?) Just some general thoughts would be greatly appreciated ;) - -- Nick Wilson // www.explodingnet.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
Nick: I have to build a php 'survey' app. but cannot use a db, clearly text files are the way but I wondered, before I start if any of you have done similar and might offer any words of wisdom? Everyone thus far has recommended file locking. Another way is to create a new file for each vote, naming the new file with a date/time/microtime with each vote. You start or end the file name with something unique (a number or letter, etc) to each answer, OR, put the file in a particular directory depending on the answers. Then, it's easy to count how many people voted a particular way just by counting the number of files. For example, at a unix type command line, you can type ls | wc -l --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unknown problem of script
me estais mandando mensajes vuestros, - Original Message - From: erich [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, May 21, 2002 4:22 PM Subject: [PHP] unknown problem of script i run a install.php, the server says the following statement, Warning: Undefined index: install in d:\wwwroot\program_files\install.php on line 14 the strange things is when i install the php program, it does not have outputted this warning, but this warning occurs when i put all the files to a remote server the install.php source is as follows: ?php // include config, functions, common and header include (./include/config.php); include (./include/functions.php); include (./include/common.php); include (./include/header_admin.php); // variables: // GET // POST // $install from install.php (set to 1 when user click on install) $install = $HTTP_POST_VARS[install]; if ($table_name != and $table_internal_name != ) { if ($install == 1) { $unique_field_name = get_unique_field($conn, $db_name, $table_name); // get the array containing the names of the fields $fields_names_ar = build_fields_names_array($conn, $db_name, $table_name); // drop (if present) the old internal table and create the new one. create_internal_table($conn, $table_internal_name); echo pInternal table b$table_internal_name/b correctly created..; for ($i=0; $icount($fields_names_ar); $i++){ // insert a new record in the internal table with the name of the field as name and label $sql = insert into $table_internal_name (name_field, label_field, order_form_field) values ('$fields_names_ar[$i]', '$fields_names_ar[$i]', '.($i+1).'); $res_insert = execute_db($sql, $conn); } // end for echo p..The system is correctly installed!!; echo pYou can now manage your table b$table_name/b, starting from a href=\index.php\index.php/a; echo pIn order to customize the internal db you have to use the a href=\admin.php\administration page/a.; if ($unique_field_name == ){ echo pYour table b$table_name/b hasn't any primary keys set, if you don't set a primary key won't show the edit/delete/details buttons.; } // end if } // end if ($install == 1) else{ echo form name=\install_form\ action=\install.php\ method=\post\; echo input type=\hidden\ name=\install\ value=\1\; echo input type=\submit\ value=\Click this button to install\; echo /form; } // end else } // end if ($table_name != and $table_internal_name != ) else{ echo pPlease specify table_name and table_internal_name in config.php; } // end else // include footer include (./include/footer_admin.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace problems
Zac: $cntnt = eregi_replace(\[L=([a-zA-Z]+)].([a-zA-Z]+)\[EL], a href=\ . fndLnk(\\1) . \\\2/a, $cntnt); Put \\1 in double quotes so it gets evaluated as a substring. a href=\ . fndLnk(\\1) . \\\2/a, $cntnt); Enjoy, --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] unable to register session variables
I am following example 4 on http://www.php.net/manual/en/ref.session.php code: if(!session_is_registered(layer) ) { session_register(layer); } I tried both and ''s. Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS I've both track_vars and register_globals enabled in my php.ini Any idea what's wrong? Thanks, -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing an array on
you can use serialize() and unserialize() and make sure that you urlencode() and urldecode() the serialized string before attaching it to your URL. if you don't, you might find that some chars will not be right on the other end of the line. Jim Lucas - Original Message - From: John Fishworld [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 9:05 AM Subject: [PHP] Passing an array on Whats the best way to pass on array on in a link ? eg offset is where we are (what page) but state is an array, with a variable size href=joblist.php?offset=$offsetstate=$state thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to register session variables
Are you starting the session first? ? session_start(); session_register('variable'); ? Jim Lucas - Original Message - From: Pushkar Pradhan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 10:19 AM Subject: [PHP] unable to register session variables I am following example 4 on http://www.php.net/manual/en/ref.session.php code: if(!session_is_registered(layer) ) { session_register(layer); } I tried both and ''s. Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS I've both track_vars and register_globals enabled in my php.ini Any idea what's wrong? Thanks, -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP PGP
Boaz: On Wed, May 22, 2002 at 04:48:59PM +0100, John Horton wrote: calculate a hash of the pass the user enters and store that. FYI, by hash he means using the md5() function. Ciao! --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: voting using text files
Text files are good providing the vote is simple. I would recommend using file locking, but to stop a user recieving an error if the file is in use you could get the script to retry after half a second or so. A good structure would be to have one file for each possible answer and each file contains the number of votes it has recieved. Then: -- Open file for the chosen option as read only -- Read the value in the file -- Close the file -- Increase the value by one using ++ -- Open the file again in write mode -- Lock the file -- Write the new value to the file - old one overwritten -- Unlock the file -- Close the file I don't do the file locking bit and I've never had problems but my script doesn't get heavy useage! You'll have to make sure all your files are CHMODed properly to allow them to be open and written to etc. I had a problem where my host did something to the system, changed the privelages and as a result my guestbook got wiped because it couldn't replace a file! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using the pdf tags.
On Wed, 22 May 2002, Jeff Hatcher wrote: Does anyone know of a way to rotate text in a pdf? I can rotate an image and rotate a page but can not seen to rotate text. You're using PDFlib? It works just fine, but you have to understand how PostScript works. Calling PDF_rotate rotates the entire page beneath you by that amount. Call it first, THEN draw your text. It may be sensible to wrap the whole thing in a PDF_save and PDF_restore so you don't have to keep track and manually unrotate. So: 1. pdf_save 2. pdf_rotate 3. pdf_show 4. pdf_restore miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: read from flatfile and convert
I copied some data from a web page straight into Excel then saved it as tab delimited which allowed me to import it into MySQL. Try opening the file in a spreadsheet program - it might understand the file! Alternatively, if the data was stored in a flat file previously, there must have been a script or program that was able to extract it. You could be cheeky and ask your client if he has it saved in another format! ;o) R [EMAIL PROTECTED] wrote in message 000f01c20206$a0ac9740$0a6da8c0@lgwezec83s94bn">news:000f01c20206$a0ac9740$0a6da8c0@lgwezec83s94bn... Hey Guys, Heres the deal, I have a client who wants me to make a testimonials program for him, Which is no problem till now, but now he has come with some additional requirments that I dont know how to deal with... he has a flatfile with a crap load of entries and he wants me to export it into mySql! Do any of you know what function to write to read a record from a flatfile and write it to the database record for record? doing it manually will be a pain in the --- but i dont want to lose the chance for work...:-( The flatfile was written using perl. If need be I can give you the MyTestimonialsDB.txt file to screw around with. As usual, Any help appreciated. Kindly reply, Cheers, -Ryan. /*Don't steal. The government hates competition.*/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to register session variables
Aren't there two method to register variables: 1. session_start() as you suggested with track_vars enabled 2. !session_is_registered() with register_globals enabled I tried session_start also but didn't work, phpinfo() doesn't show any $HTTP_SESSION_VARS Are you starting the session first? ? session_start(); session_register('variable'); ? Jim Lucas - Original Message - From: Pushkar Pradhan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 10:19 AM Subject: [PHP] unable to register session variables I am following example 4 on http://www.php.net/manual/en/ref.session.php code: if(!session_is_registered(layer) ) { session_register(layer); } I tried both and ''s. Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS I've both track_vars and register_globals enabled in my php.ini Any idea what's wrong? Thanks, -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
On Wed, 22 May 2002, Jason Soza wrote: Using file locking, if two people tried to use the script at the same time, wouldn't there be an error for one of them? The second session would just have to wait for the first to finish (which should be an infinitessimal amount of time). My first guess at defeating this is having the script write a file named after the voter's IP. Have the file written to a different directory for whatever choices they have, then use readdir() to count the files in each directory, i.e. the number of votes for each choice. Then if that same IP tries to vote again, check it against votes already received and approve/deny it. Using IPs is a pretty lousy way of uniquely identifying users, especially for a purpose like this: 1. If I dial in with a modem, I probably get a new IP each time I connect, so I can vote as often as I like. 2. Many companies, ISPs, and even countries use proxy servers that aggregate thousands or millions of users behind a handful of IP addresses. One vote from China, Saudi Arabia or New Zealand and that could be it for the country. Likewise AOL. Try cookies or something. Still can be defeated by the determined ballot-box stuffer, but so can everything else that doesn't require human verification of identity. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] unable to register session variables
not that I am aware of. Jim Lucas - Original Message - From: Pushkar Pradhan [EMAIL PROTECTED] To: Jim lucas [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 10:43 AM Subject: Re: [PHP] unable to register session variables Aren't there two method to register variables: 1. session_start() as you suggested with track_vars enabled 2. !session_is_registered() with register_globals enabled I tried session_start also but didn't work, phpinfo() doesn't show any $HTTP_SESSION_VARS Are you starting the session first? ? session_start(); session_register('variable'); ? Jim Lucas - Original Message - From: Pushkar Pradhan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 10:19 AM Subject: [PHP] unable to register session variables I am following example 4 on http://www.php.net/manual/en/ref.session.php code: if(!session_is_registered(layer) ) { session_register(layer); } I tried both and ''s. Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS I've both track_vars and register_globals enabled in my php.ini Any idea what's wrong? Thanks, -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -Pushkar S. Pradhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with install php 4.2.1
On Wed, 22 May 2002, Roman Duriancik wrote: I want install php 4.2.1 (download from www.php.net) on ma linux red hat 7.0 server. configure ran good with no errors but when i do make install i get this error message. make[3]: *** [gettext.lo] Error 1 make[3]: Leaving directory `/update/php-4.2.1/ext/gettext' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/update/php-4.2.1/ext/gettext' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/update/php-4.2.1/ext' make: *** [all-recursive] Error 1 You clipped too soon - what was the actual error? (it'll be just before the beginning of what you pasted there) miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] W2K SP2, PHP 4.2.1, IIS 5
Hey all, I have a problem, that I can't seem to find the answer to. I have checked the archives and the website, but to no avail. I have installed PHP 4.2.1 on my local machine with IIS running W2K Pro. When I run php -i, I get the html output expected. But when I try to open the simple php script ?php phpinfo(); ? all I get is the script written directly to the browser as text. I can't figure out why it is not going through php.exe. Any help would be greatly appreciated. -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UTF-8/FormMail headaches
Hi all, I've got a problem with character encoding in combination with a FormMail-script (coded in PHP). Everything works fine as long as I stick to ISO-8859-1 as charset, but when I call the script from pages that use UTF-8 as encoding, special characters (e.g. those special chars with dots and circles above that we tend to use here in Sweden) end up garbled. The encoding is set with a meta-tag in case the document is in UTF-8, like so: meta http-equiv=content-type content=text/html; charset=UTF-8/ The server hasn't got any special charset configured, so it should deliver ISO-8859-1 (which is the default if I'm not mistaken) on those pages which haven't got that meta-tag. I can understand that the characters are garbled, using different charsets and all, but how can I make my FormMail-script to cope with both variants of encoding? I've played around with phpinfo() to see if the encoding is available in some environment variable, but I haven't find anything of interest. There's a function utf8_decode() in php that seems to work for converting the UTF-8 form data to ISO-8859-1 prior to sending the mail, problem is that it doesn't work all that well on data already in ISO-8859-1. I guess I need some way to determine what encoding the posted data is in? The content-type after the form has been posted to my FormMail-script always seems to be application/x-www-form-urlencoded no matter what I try. I've looked at the HTML-specs at www.w3.org and even tried to set the enctype to application/x-www-form-urlencoded; charset=ISO-8859-1 in an attempt to make the form-data use a different encoding than the rest of the page, but no success. I've also tried the accept-charset but I couldn't get that to work either. Anyone who has a clue on this? I guess I could alter the script somehow and add a new hidden field that indicate which encoding is used, and then decide whether to call utf8_decode() on the data, but I don't think that's a very nice solution. And changing all pages that uses FormMail is out of the question (well, almost anyway) since there's _alot_ of them. Regards, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] W2K SP2, PHP 4.2.1, IIS 5
Josh, Try just using ? as the opening tag. Make sure your php file has the extension php and make sure the php extension is setup as a CGI extension in IIS (pointing to php.exe). --Bruce -Original Message- From: Joshua E Minnie [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 12:55 PM To: [EMAIL PROTECTED] Subject: [PHP] W2K SP2, PHP 4.2.1, IIS 5 Hey all, I have a problem, that I can't seem to find the answer to. I have checked the archives and the website, but to no avail. I have installed PHP 4.2.1 on my local machine with IIS running W2K Pro. When I run php -i, I get the html output expected. But when I try to open the simple php script ?php phpinfo(); ? all I get is the script written directly to the browser as text. I can't figure out why it is not going through php.exe. Any help would be greatly appreciated. -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] W2K SP2, PHP 4.2.1, IIS 5
Already tried the other tag, and php extension is setup as a CGI in IIS. That is why this is puzzling me so. -josh Bruce Vander Werf [EMAIL PROTECTED] wrote: Josh, Try just using ? as the opening tag. Make sure your php file has the extension php and make sure the php extension is setup as a CGI extension in IIS (pointing to php.exe). --Bruce Joshua E Minnie [EMAIL PROTECTED] wrote: Hey all, I have a problem, that I can't seem to find the answer to. I have checked the archives and the website, but to no avail. I have installed PHP 4.2.1 on my local machine with IIS running W2K Pro. When I run php -i, I get the html output expected. But when I try to open the simple php script ?php phpinfo(); ? all I get is the script written directly to the browser as text. I can't figure out why it is not going through php.exe. Any help would be greatly appreciated. -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UTF-8/FormMail headaches
For detection of encoding, perhaps you could include a hidden field with some shibboleth characters. Research how they are transformed by various encodings, and then just look at them to figure out what for that the rest of the data is in. miguel On Wed, 22 May 2002, Peter Johansson wrote: I've got a problem with character encoding in combination with a FormMail-script (coded in PHP). Everything works fine as long as I stick to ISO-8859-1 as charset, but when I call the script from pages that use UTF-8 as encoding, special characters (e.g. those special chars with dots and circles above that we tend to use here in Sweden) end up garbled. The encoding is set with a meta-tag in case the document is in UTF-8, like so: meta http-equiv=content-type content=text/html; charset=UTF-8/ The server hasn't got any special charset configured, so it should deliver ISO-8859-1 (which is the default if I'm not mistaken) on those pages which haven't got that meta-tag. I can understand that the characters are garbled, using different charsets and all, but how can I make my FormMail-script to cope with both variants of encoding? I've played around with phpinfo() to see if the encoding is available in some environment variable, but I haven't find anything of interest. There's a function utf8_decode() in php that seems to work for converting the UTF-8 form data to ISO-8859-1 prior to sending the mail, problem is that it doesn't work all that well on data already in ISO-8859-1. I guess I need some way to determine what encoding the posted data is in? The content-type after the form has been posted to my FormMail-script always seems to be application/x-www-form-urlencoded no matter what I try. I've looked at the HTML-specs at www.w3.org and even tried to set the enctype to application/x-www-form-urlencoded; charset=ISO-8859-1 in an attempt to make the form-data use a different encoding than the rest of the page, but no success. I've also tried the accept-charset but I couldn't get that to work either. Anyone who has a clue on this? I guess I could alter the script somehow and add a new hidden field that indicate which encoding is used, and then decide whether to call utf8_decode() on the data, but I don't think that's a very nice solution. And changing all pages that uses FormMail is out of the question (well, almost anyway) since there's _alot_ of them. Regards, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
A good structure would be to have one file for each possible answer and each file contains the number of votes it has recieved. Then: -- Open file for the chosen option as read only -- Read the value in the file -- Close the file -- Increase the value by one using ++ -- Open the file again in write mode -- Lock the file -- Write the new value to the file - old one overwritten -- Unlock the file -- Close the file That's a bad method. You have to have the lock around the read and the write. With your method, 5 users might read the file, all getting 99 for the count, and then each one will try to seperatly write 100 to the file. So you lose 4 actual counts. You want to open the file, read it, update value, write it, unlock, and close the file. Using multiple files would just be a waste of space in my opinion. A locked file doesn't stop the script, it simply waits for the file to be unlocked and then continues on. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session.save_path
You have to set the session.save_path to a path on your machine that PHP can write session files to. You can make a temp folder in your C: drive and then set the path to c:/temp or c:\\temp or create and set it to any other folder you want. Make sure (if you're using NTFS) that user IUSR_computer_name has permission to read/write to the directory you specify. ---John Holmes... - Original Message - From: Wilbert Enserink [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, May 22, 2002 12:09 PM Subject: [PHP] session.save_path Hi all, I'm trying to install php/apache with phptriad. This worked fine, however when I'm using session variables the thing goes nuts: Warning: open(/tmp\sess_d22b57336449f89ad54b974794dd53f4, O_RDWR) failed: m (2) in C:\apache\htdocs\dm\wwwtest\phpincludes\session\session.php on line 2 Warning: open(/tmp\sess_d22b57336449f89ad54b974794dd53f4, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 -- This is how my phpinfo() sees it: session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On Does anybody have any idea what to do. Should I adjust php.ini?? And where should this directory /tmp be located?? cause it's not on my harddisk-- so this might be the error. (i'm on winXP BTW) well, thx for all info! regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using the pdf tags.
Yes I'm using the PDFlib. I understand the rotating of the page. So this is what I am doing: I am building a page $pdf. If I rotate the page then everything on the page rotates also. I need to put titles in a 45 degree angle. These titles can change and there can be between 3-6 depending on the users input. Is there a way to build this text on a separate page then merge it into the $pdf page. Or any ideas of how you might do it. If it was just one title or on a page by itself then I understand how to do it. The problem is that it isn't. Thanks -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 22, 2002 1:39 PM To: Jeff Hatcher Cc: PHP-General Subject: Re: [PHP] Using the pdf tags. On Wed, 22 May 2002, Jeff Hatcher wrote: Does anyone know of a way to rotate text in a pdf? I can rotate an image and rotate a page but can not seen to rotate text. You're using PDFlib? It works just fine, but you have to understand how PostScript works. Calling PDF_rotate rotates the entire page beneath you by that amount. Call it first, THEN draw your text. It may be sensible to wrap the whole thing in a PDF_save and PDF_restore so you don't have to keep track and manually unrotate. So: 1. pdf_save 2. pdf_rotate 3. pdf_show 4. pdf_restore miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: JavaScript vs. Header redirect
Okay, looks like I was stupid/lazy for including the pseudo code instead of something closer to what I was using. Also, perhaps I'm being dense, but I don't understand what Michael's response has to do with this situation. Can he or someone else enlighten me? Here's a more accurate/detailed description of what's going on, complete with the exact code (minus sensitive info) that I'm using: The chunk of code in question is a login handler. It's supposed to collect two form fields named username and password from the Post method variables. Then it's supposed to check the password against an encrypted version stored in a database (I didn't include the database variables/code in the example below). If it matches, it's supposed to redirect them to a page where they can perform administrative functions. In the course of debugging it, I found that the header(Location: ...) command worked perfectly until I called on the $_POST or $HTTP_POST_VARS arrays (which seem to be synonymous). If I removed the calls to the arrays, it worked fine. I looked through the comments on the header function on www.php.net and through some of the previous questions posted in the news group, and it seems like others have experienced this problem as well. However, the most common situation noted was that it broke as soon as they called a function. I guess I'm calling a function implicitly when I ask for the $_POST variables. The most obvious way I can see around this is simply to cause the client to redirect using JavaScript. Of course, the downside to this is that the user may have disabled scripting, but I'm working in a pretty closed environment, so I think I can avoid that contingency. I'm using 4.1.2 as a cgi in a UNIX environment w/ MySQL 3.22.x. --Hunter Vaughn ?php $Host = ___; $User = ___; $Pass = ___; $dbName = ___; $username = $_POST[username]; $password = $_POST[password]; $Link = mysql_connect($Host, $User, $Pass) or die (Could not connect to the database.); mysql_select_db($dbName); if((ereg(.+@.+\..+, $username)) (eregi(^[[:alnum:]]{8,16}$, $password))) { $Query = SELECT email, memberID, pass FROM Login where email='$username'; $Result = mysql_query($Query); $Row = @mysql_fetch_array($Result); if((crypt($password, $Row[pass])) == $Row[pass]) { session_start(); $email = $Row[0]; $memberID = $Row[1]; session_register('email'); session_register('memberID'); //header(Location: http://some.domain.com/PHP/update.php;); This doesn't work... print(script language=\JavaScript\window.location = \http://some.domain.com/PHP/update.php\;;/script); exit; } else { $message = urlencode(The username and password submitted do not match those on file. Please try again.); } } else { $message = urlencode(Please enter your username and password to log in.); } print(script language=\JavaScript\window.location = \http://some.domain.com/HTML/letsboogie22.html\;;/script); exit; ? Hunter Vaughn [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there any reason I can't just use a JavaScript redirect from a PHP login handling script since I can't seem to get the header(Location: URL); function to work? Any security concerns or anything else? As far as I can tell, all calls to header fail as soon as I attain variables based on a POST submission. See example below. ? $username = $_POST[username]; $password = $_POST[password]; if(some username/password format verification) { query the database if($password matches pass in database) { session_start(); $email = $Row[0]; $memberID = $Row[1]; session_register('email'); session_register('memberID'); //header(Location: URL);This doesn't work. print(script language=\JavaScript\window.location = \http://depts.washington.edu/bionano/HTML/letsboogie22.html\;;/script); exit; } else { print(That didn't work...); } } else { print(Please enter your username password.); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] voting using text files
I think you guys are making this way more complicated than it needs to be. Anytime you start talking about locking files, you need to apply a huge reality check to yourself and sit down and approach the problem from a different direction. In this case could I suggest that you make use of the fact that appends of less than a blocksize are atomic. Therefore, why not simply append a single character to a text file for each vote? If you are voting for a list of things, assigning a character to each item and simply append 'a', 'b', 'c' or 'd' to your file. The size of the file instantly gives you the number of votes cast. Reading the file and counting the number of times each letter occurs using something like substr_count() will give you the number of votes for each option. That gives you a lockless and flexible system without the risk of deadlock or missing votes due to race conditions. -Rasmus On Wed, 22 May 2002, 1LT John W. Holmes wrote: A good structure would be to have one file for each possible answer and each file contains the number of votes it has recieved. Then: -- Open file for the chosen option as read only -- Read the value in the file -- Close the file -- Increase the value by one using ++ -- Open the file again in write mode -- Lock the file -- Write the new value to the file - old one overwritten -- Unlock the file -- Close the file That's a bad method. You have to have the lock around the read and the write. With your method, 5 users might read the file, all getting 99 for the count, and then each one will try to seperatly write 100 to the file. So you lose 4 actual counts. You want to open the file, read it, update value, write it, unlock, and close the file. Using multiple files would just be a waste of space in my opinion. A locked file doesn't stop the script, it simply waits for the file to be unlocked and then continues on. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] W2K SP2, PHP 4.2.1, IIS 5
Hi there!, In a word - script mappings. In the IIS administrator, you must associate the .php extension with the php interpreter. Use the IIS help wizard to tell you how, or: 1. Start Regedt32.exe and open the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC \Parameters\ScriptMap 2. Click Add Value from the Edit menu. 2b. The Value Name is .php 2c. The Data type is REG_SZ. 2d. The String value is the full path to php.exe.exe\php.exe %s %s NOTE: The %s %s is case sensitive. (e.g. %S %S will not work). (%s %s is the file, you might need to add a -i or -whatever if php needs it) 3. Restart the WWW service. 4. Cross your fingers, if it doesn't work go in play with the string value by using the edit dialog in regedt32. HTH, Dw. Sqlcoders.com Dynamic data driven web solutions - Original Message - From: Joshua E Minnie [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: May 22 2002 10:54 AM Subject: [PHP] W2K SP2, PHP 4.2.1, IIS 5 Hey all, I have a problem, that I can't seem to find the answer to. I have checked the archives and the website, but to no avail. I have installed PHP 4.2.1 on my local machine with IIS running W2K Pro. When I run php -i, I get the html output expected. But when I try to open the simple php script ?php phpinfo(); ? all I get is the script written directly to the browser as text. I can't figure out why it is not going through php.exe. Any help would be greatly appreciated. -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: JavaScript vs. Header redirect
Hi there!, I've looked over this thread and from what I gather you want to know if you can/should use JavaScript for redirecting, my usual way of going about things is to put a JavaScript scriptlocation.href='page.aspx'/script call in the head of the document (putting JS in the head causes it to execute before the page is rendered, or should at any rate), and then I use a meta refresh tag as my backup, set for 3 seconds. That usually covers everything, it stops spiders (google has a strong dislike of meta refresh), it redirects JS users transparently, it's almost instantaneous for the paranoid-shouldn't-be-let-out-of-the-ward non JS people, and it's easy to code. Plus it works in any server side scripting language, as it's all client-side code. Just my $0.02, Dw. Sqlcoders.com Dynamic data driven web solutions - Original Message - From: Hunter Vaughn [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: May 22 2002 11:19 AM Subject: [PHP] Re: JavaScript vs. Header redirect Okay, looks like I was stupid/lazy for including the pseudo code instead of something closer to what I was using. Also, perhaps I'm being dense, but I don't understand what Michael's response has to do with this situation. Can he or someone else enlighten me? Here's a more accurate/detailed description of what's going on, complete with the exact code (minus sensitive info) that I'm using: The chunk of code in question is a login handler. It's supposed to collect two form fields named username and password from the Post method variables. Then it's supposed to check the password against an encrypted version stored in a database (I didn't include the database variables/code in the example below). If it matches, it's supposed to redirect them to a page where they can perform administrative functions. In the course of debugging it, I found that the header(Location: ...) command worked perfectly until I called on the $_POST or $HTTP_POST_VARS arrays (which seem to be synonymous). If I removed the calls to the arrays, it worked fine. I looked through the comments on the header function on www.php.net and through some of the previous questions posted in the news group, and it seems like others have experienced this problem as well. However, the most common situation noted was that it broke as soon as they called a function. I guess I'm calling a function implicitly when I ask for the $_POST variables. The most obvious way I can see around this is simply to cause the client to redirect using JavaScript. Of course, the downside to this is that the user may have disabled scripting, but I'm working in a pretty closed environment, so I think I can avoid that contingency. I'm using 4.1.2 as a cgi in a UNIX environment w/ MySQL 3.22.x. --Hunter Vaughn ?php $Host = ___; $User = ___; $Pass = ___; $dbName = ___; $username = $_POST[username]; $password = $_POST[password]; $Link = mysql_connect($Host, $User, $Pass) or die (Could not connect to the database.); mysql_select_db($dbName); if((ereg(.+@.+\..+, $username)) (eregi(^[[:alnum:]]{8,16}$, $password))) { $Query = SELECT email, memberID, pass FROM Login where email='$username'; $Result = mysql_query($Query); $Row = @mysql_fetch_array($Result); if((crypt($password, $Row[pass])) == $Row[pass]) { session_start(); $email = $Row[0]; $memberID = $Row[1]; session_register('email'); session_register('memberID'); //header(Location: http://some.domain.com/PHP/update.php;); This doesn't work... print(script language=\JavaScript\window.location = \http://some.domain.com/PHP/update.php\;;/script); exit; } else { $message = urlencode(The username and password submitted do not match those on file. Please try again.); } } else { $message = urlencode(Please enter your username and password to log in.); } print(script language=\JavaScript\window.location = \http://some.domain.com/HTML/letsboogie22.html\;;/script); exit; ? Hunter Vaughn [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there any reason I can't just use a JavaScript redirect from a PHP login handling script since I can't seem to get the header(Location: URL); function to work? Any security concerns or anything else? As far as I can tell, all calls to header fail as soon as I attain variables based on a POST submission. See example below. ? $username = $_POST[username]; $password = $_POST[password]; if(some username/password format verification) { query the database if($password matches pass in database) { session_start(); $email = $Row[0]; $memberID = $Row[1]; session_register('email'); session_register('memberID');