RE: [PHP] Best way to get PHP5
On Wed, 9 Aug 2006, Chris W. Parker wrote: Jonathan Duncan mailto:[EMAIL PROTECTED] on Wednesday, August 09, 2006 3:55 PM said: If you want to really learn Linux, try Gentoo. If you just want a very good and easy to use Linux, go with SuSE. To keep this related to the question I asked... Do either of the latest builds of these distros have PHP5? Thanks, Chris. I just checked the Gentoo portage tree and it has PHP 5.1.4 in it already. Having it in the portage tree means it is as good as installed. I just checked the SuSE Linux 10.1 package listing and it comes with 5.1.2: http://www.novell.com/products/linuxpackages/suselinux/index_all.html The answer to your question is yes. Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to get PHP5
On Wed, 9 Aug 2006, Chris W. Parker wrote: Hello, Generally (well, actually 100%) I just use whatever version of PHP is included with a certain distro (Redhat pre-Fedora, Fedora Core, CentOS). None of the versions I've used have come with PHP5 and I'd really like to get with the times and use PHP5. I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative things about it in general (FC5). I've never compiled PHP myself so admittedly I'm a bit skeered... Is the recommended path to just go with whatever distro I prefer and then download PHP5 from php.net and install it myself? Thanks, Chris. Yes, I would recommend that. If you are serious about using PHP for a while it would be benefitial to you to understand the installation aspect of the language. If you are comfortable with the command line this should be pretty easy for you. If not it will be a bit harder but still very possible. Here are installation instructions from php.net: http://www.php.net/manual/en/install.unix.php Good luck! Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Best way to get PHP5
On Wed, 9 Aug 2006, Chris W. Parker wrote: Jack Gates mailto:[EMAIL PROTECTED] on Wednesday, August 09, 2006 10:16 AM said: On Wednesday 09 August 2006 12:02, Chris W. Parker wrote: I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some negative things about it in general (FC5). What sort of negative things have you heard in general about (FC5)? Honestly I don't remember. But I've now got a generally negative view of FC5 versus previous versions (last one I used was 4 I think). If you're aware of any FUD that's been spread about it, feel free to speak the truth. If you want to really learn Linux, try Gentoo. If you just want a very good and easy to use Linux, go with SuSE. Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Frameworks - Opinion
On Tue, 1 Aug 2006, Gabe wrote: What's the common consensus as to a solid PHP framework to use for application development? There seems to be a number of them out there, but I'm not sure which one's are the most robust, actively developed, secure, etc etc. Thoughts? I echo others in that there is not yet a common consensus. I have started putting together my own framework as just a common directory structure and code repository from projects that I have worked on. I prefer my own code because I have this bit of OCD about using code that I did not write if I do not fully understand every aspect of it, unless I fully trust the source. I trust PEAR and often use some code from there. Anyway, you asked about frameworks. I have been spending some cycles looking at TYPO3 (http://typo3.com/) and so far it is pretty impressive. I have heard from others that it is quite robust and almost a CMS in itself. However I have not fully explored all of it so I will hold my opinion on it until then. I also hear the learning curve for TYPO3 is very steep but well worth the climb. Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Frameworks - Opinion
On Fri, 4 Aug 2006, Jens Kleikamp wrote: Matt Todd wrote: Because of this, I determined to build my own framework. This was a few months ago, and Canvas[1] was the result of my labor. I produced this framework while working on numerous projects at the university I work at. This allowed me to build an application concurrently with the framework and give it a good benchmark for usability, feature, performance, etc. M.T. 1. http://c.anvas.es/ Please do not recommend stuff like this. It is a funky framework! What do you mean by funky? And why should he not recommend it? Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why Should I Use Zend Optimizer?
I posted this on the Zend.com forums but have not been able to get a response yet. So I decided to ask the people that know. I do not understand the need for an optimizer. What exactly is Zend Optimizer optimizing? If it is changing my code, then how about if I just learn how to code better? Is that all that Zend Optimizer is doing? Making my code better? Instead of making a program to fix all the dumb things that programmers like me do, why not show us what is not working. If post-incrementing is slower than pre-incrementing then I will just start pre-incrementing. What if I already write perfect code? Would I still benefit from having Zend Optimizer on my system? In other words, is Zend Optimizer a program designed to help poor coders have faster running code despite their lack of skill? Or is it also optimizing other things? If so, why are those things not already optimized? Can anyone help me unfold this mystery? I have read quite a bit about what Zend Optimizer is and perhaps I have missed the point. So if there is a document that explains this, please direct me to it. Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloading very large files
I have an application that delivers files to the client browser. These files a very large video files. 250mb+ each. I have two options: 1) I could have PHP deliver the file with fread, or 2) I could have PHP present a link to the file. However, for security purposes, I would rather not have the actual files available. I suppose I could have PHP create temporary symbolic links on the file system that link to the files in question and then remove the links, thus requiring the users to go through an authentication process to retrieve files that are assigned to them. Anyway, downloading such large files causes PHP to balk with size limitation errors. I could increase the size limit and memory limit settings in php.ini, but for file sizes that large, is it recommended? Are there best practice limits on these settings: max_input_time, memory_limit, max_execution_time, etc.? Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloading very large files
Thank you for the input. For now we are just using PHP to create symbolic links to the video files and the links are removed when they are done viewing the video. We are open to other suggest still, but for now, this fills our needs and bypasses putting so much stress on PHP as to put hundreds of mb of files through it. Why secure? A combination of all those reason. Thanks, Jonathan On Mon, 13 Feb 2006, Rory Browne wrote: I've seen this problem many times before, but I'm not sure what solution was found. Possible solutions: Encrypt the file, make it publicly available, and then give the right people the encryption key. Put it behind a .htaccess file allowing only the IP of the correct person - remove the .htaccess entry after a certain lengh of time. Why are the videos secure? Copyright? Privacy? Bandwidth? On 2/13/06, Jonathan Duncan [EMAIL PROTECTED] wrote: I have an application that delivers files to the client browser. These files a very large video files. 250mb+ each. I have two options: 1) I could have PHP deliver the file with fread, or 2) I could have PHP present a link to the file. However, for security purposes, I would rather not have the actual files available. I suppose I could have PHP create temporary symbolic links on the file system that link to the files in question and then remove the links, thus requiring the users to go through an authentication process to retrieve files that are assigned to them. Anyway, downloading such large files causes PHP to balk with size limitation errors. I could increase the size limit and memory limit settings in php.ini, but for file sizes that large, is it recommended? Are there best practice limits on these settings: max_input_time, memory_limit, max_execution_time, etc.? Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP not seeing MySQL functions
I just got a new web server with RedHat Enterprise Linux 4 on it. It came with MySQL 4.1.x and PHP 4.3.9 on it. I uninstalled the MySQL 4 and put MySQL 5 on it. When I run a PHP script that has a DB connection in it I get: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/mysqltest.php on line 5 I check the PHPINFO and see: Configure Command has '--with-mysql=shared,/usr' And dbx supported databases has 'MySQL' However, there is no MySQL section. I checked in the '/etc/php.ini' file and see: [MySQL] mysql.allow_persistent = On mysql.max_persistent = -1 mysql.max_links = -1 mysql.default_port = mysql.default_socket = mysql.default_host = mysql.default_user = mysql.default_password = mysql.connect_timeout = 60 mysql.trace_mode = Off What is missing that would keep me getting the missing functions error? I restarted apache of course. Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
On Tue, 6 Dec 2005, Eric Gorr wrote: Quoting Torgny Bjers [EMAIL PROTECTED]: I recommend Zend Studio if you can afford it since it has a GUI for both Windows and Linux FlameBateAnd for those interested in using a real computer/FlameBate, it's GUI also runs under MacOSX. http://zend.com/store/products/zend-studio/requirements.php Actually, it does not. I installed it on my Mac, hoping to try it out and it would not run because it did not have the move recent Java JRE which is not available for Mac OSX (or was not at the time). I still do not have it running. Although it installed without a hitch. I would be interested in what people use to program PHP on Mac. I currently use TextWrangler and I have tried TextMate, but I am not completely sold on either of them. I use vim quite a bit also. Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
On Thu, 15 Dec 2005, Richard Davey wrote: On 15 Dec 2005, at 18:31, Jonathan Duncan wrote: FlameBateAnd for those interested in using a real computer/FlameBate, it's GUI also runs under MacOSX. http://zend.com/store/products/zend-studio/requirements.php Actually, it does not. I installed it on my Mac, hoping to try it out and it would not run because it did not have the move recent Java JRE which is not available for Mac OSX (or was not at the time). I still do not have it running. Although it installed without a hitch. It was available at the time in a beta format from the Apple web site (a 2 second Google found it for me), and is now available in full release format. I downloaded it prior to installing Zend 5 on my Mac and it works fine. The full update came in via Apple Software Update last week, and it still works fine. There is no reason why Mac owners could not run ZS5 from the day of release. I know that I did. Cheers, Rich One more reason to upgrade to Tiger. I am still on MacOSX 10.3.9 =( Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Something is messing up the php output
I have a site that has this problem every once in a while, and seemingly randomly. It is a database driven site, as indicated by the error. This same page when loaded numerous times will sometimes work just fine, and then sometimes it will give an error message like this: - Warning: mysql_connect(): Unknown MySQL Server Host 'hostn[]me.domain.com' (1) in /usr/local/apache/htdocs/filename.php on line 8 Unknown MySQL Server Host 'hostn[]me.domain.com' (1) - Notice that in the word hostname the 'a' is not an 'a'. It is one of the empty boxes that usually indicates an unknown character. Here I represent it with square brackets for visual effect. When the source is check, there is absolutely nothing wrong with the hostname in the mysql_connect function. As I mentioned, if this page is reloaded it may be fine. After a while it may not have anymore problems for weeks. Or it may come back the next day. When It is happening I do not notice any major server process usage. The mis-interpreted character problem sometimes truncates a word, or just messes up a cerain random characters. I have had this happen on more than one site on more than one server. Does anyone have any idea what this may be? I am even accepting wild guesses at this point. Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Something is messing up the php output
I see where you are coming from and it is a good idea. However, in this particular problem it is not so much DNS related. If I were to use an IP then the error could very well just say this: - Warning: mysql_connect(): Unknown MySQL Server Host '192.1[]8.0.1' (1) in /usr/local/apache/htdocs/filename.php on line 8 Unknown MySQL Server Host '192.1[]8.0.1' (1) - Thanks, Jonathan Matt Babineau [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I bet if you connect using the IP directly it will solve your problem. Thanks, Matt Babineau Criticalcode 858.733.0160 [EMAIL PROTECTED] http://www.criticalcode.com -Original Message- From: Jonathan Duncan [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 22, 2005 6:27 PM To: php-general@lists.php.net Subject: [PHP] Something is messing up the php output I have a site that has this problem every once in a while, and seemingly randomly. It is a database driven site, as indicated by the error. This same page when loaded numerous times will sometimes work just fine, and then sometimes it will give an error message like this: - Warning: mysql_connect(): Unknown MySQL Server Host 'hostn[]me.domain.com' (1) in /usr/local/apache/htdocs/filename.php on line 8 Unknown MySQL Server Host 'hostn[]me.domain.com' (1) - Notice that in the word hostname the 'a' is not an 'a'. It is one of the empty boxes that usually indicates an unknown character. Here I represent it with square brackets for visual effect. When the source is check, there is absolutely nothing wrong with the hostname in the mysql_connect function. As I mentioned, if this page is reloaded it may be fine. After a while it may not have anymore problems for weeks. Or it may come back the next day. When It is happening I do not notice any major server process usage. The mis-interpreted character problem sometimes truncates a word, or just messes up a cerain random characters. I have had this happen on more than one site on more than one server. Does anyone have any idea what this may be? I am even accepting wild guesses at this point. Thanks, Jonathan -- 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] Something is messing up the php output
Yes, it has happened on different servers, none of them is bleeding edge, still using Apache 1.x and PHP 4.3.x. The sites are not using any character sets other than default. The machines are in a heat controlled environment and monitored for change so I would know if there was that kind of problem. One of the sites that I have seen it on is an osCommerce site. Another site is a custom built site. I am inclined to think that because it happens so rarely and when it does happen it is so random that there must be some combination of events that are hard to track as being part of the same problem. Thanks for the brainstorm, you did give me some things to think about. It has since subsided again so I will have to wait for it to happen again before I can troubleshoot more. This makes it very hard. Thanks everyone. If anyone has more ideas I am still open to them. Jonathan Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] WILD GUESS ALERT! Until you said on more than one server I was thinking a heat-related intermittent hardware error corrupting the file read, so a turned into some not-quite-random character... You *SURE* it's on multiple servers?... Are all machines running the same software versions? Are you using multi-byte strings? Those are not quite as pounded on as much as one might like... Have you done anything funky to force libc-glibc upgrade? Or a kernel upgrade? Are you running anything bleeding/leading edge? (Apache 2, PHP 5, mysqli etc) Can you rollback for awhile and test? If you are using Apache 2, are you in that pre-fork mode, or is it running threaded? What PHP Modules are you running? Aha! My wild guesses have lead me to a hypothesis: You *are* using Apache 2 in threaded environment and some PHP Module (or other software) is not thread-safe. *WHICH* one[s] are not thread-safe is totally open to question... It could even be some weird interaction between *TWO* Modules that very rarely exhibits itself by random changing of memory bits. Ugh! Are there any Modules you could get rid of completely and just change the applications to do without? Do you have a test Development box that exhibits this behaviour? Run it and ab stress test it and pound on it with as many different requests in as random an order you can achieve. If you can get the dev box to mis-behave somewhat reliably, try getting rid of one PHP Module after another, and re-test incessantly. Could you roll back to Apache 1.x or at least do that pre-fork thing so you are not using threads on the production server, and see if it goes away? Some of the above questions/implications are mutually exclusive. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php variables in a backtick command
I am trying to run a shell command with backticks. However, I get a parse error. Is it because I have an array variable in there? $result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] $user['name_last']`; Do I need to assign the value to a regular variable before I put it in there? Like this? $pword=$user['password'] $fname =$user['name_first'] $lname =$user['name_last'] $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`; Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php variables in a backtick command
Ah, that is a good idea, putting the command in a variable and then executing the variable. I have doen that before but did not think of it now. Too many things going on. Thanks! Jonathan Rory Browne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure about variable expansion with backticks(I don't use backticks, if necessary I use shell_exec() instead). I'm just after installing a fresh SuSE 9.1, and php is giving me a segfault at the minute, with that particular code, but if you were using double quotes you could: $command = adduser -l=$dist_id -p={$user['password']} --f=\{$user['name_first']} {$user['name_last']}\; bearing in mind that the variables have been {}'ed, and your double quote around $user['name_first'] and ['name_last']) has been escaped to \ you can use shell_exec($command), which is identical to the backtick operation. Having that said, you should consider using alternative program execution instead, instead of using the shell. What do you need the shell for? You might(albeit unlikely) also come across a situation where the shell is something like /bin/false, or /bin/falselogin, or /bin/scponly, or basicly something that doesn't particularly work that well as a shell. Rory On Sat, 11 Dec 2004 18:09:17 -0700, Jonathan Duncan [EMAIL PROTECTED] wrote: I am trying to run a shell command with backticks. However, I get a parse error. Is it because I have an array variable in there? $result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] $user['name_last']`; Do I need to assign the value to a regular variable before I put it in there? Like this? $pword=$user['password'] $fname =$user['name_first'] $lname =$user['name_last'] $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`; Thanks, Jonathan -- 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 variables in a backtick command
The quotes are only for the shell command which does not use quotes around password. Thanks for the feedback. Jonathan Sebastian [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] well $user['password'] has no double quotes around it. - Original Message - From: Jonathan Duncan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 11, 2004 8:09 PM Subject: [PHP] php variables in a backtick command I am trying to run a shell command with backticks. However, I get a parse error. Is it because I have an array variable in there? $result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] $user['name_last']`; Do I need to assign the value to a regular variable before I put it in there? Like this? $pword=$user['password'] $fname =$user['name_first'] $lname =$user['name_last'] $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`; Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php variables in a backtick command
So I tried it that way and it worked, that is annoying though, having to add extra lines to the code and assign the contents of one variable to another. Any way around this? Jonathan Jonathan Duncan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to run a shell command with backticks. However, I get a parse error. Is it because I have an array variable in there? $result = `adduser -l=$dist_id -p=$user['password'] --f=$user['name_first'] $user['name_last']`; Do I need to assign the value to a regular variable before I put it in there? Like this? $pword=$user['password'] $fname =$user['name_first'] $lname =$user['name_last'] $result = `adduser -l=$dist_id -p=$pword --f=$fname $lname`; Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
Richard, Very good point, and you are correct, I am not looking to hire an army and spend tons of time and money on it. I have since rethought this, thanks in part to this thread. I have decided to go with something more secure. Since I have a database of users already for the site on ServerA, I will just set up a cron job on ServerB that runs a script that queries that database and then adds, edits, removes users accordingly. That way the access of the shell is being done always by a trusted system only user. I will put an extra table in my database called something like user_email_account_management_requests and the remote script with check that for any tasks it needs to do. Thanks again to all those who helped me with this. I have learned quite a bit and enjoyed it. Best regards, -- Jonathan Duncan http://www.nacnud.com On Mon, 6 Dec 2004, Richard Lynch wrote: I am looking to do like Hotmail, or Yahoo!, or Mail.com, or any of the other places do. I can go sign up on their site and immediately have an e-mail account that I can start using. No admin has to take the time to create my account for me. You do understand that these hosts have MAJOR PROBLEMS and invest inordinate amounts of resources to users who abuse their services. You're going to be spending a HUGE amount of money/time if you have something as wide-open as those. Their whole schtick is Free Email so it's worth it to them to invest in an army of people to handle the problems. Is it worth it to you? HIGHLY unlikely. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
Ok, so this is what I have done: *-*-*-*-*-*-*-*-*-*-* $idResults = `sudo -u admin ssh [EMAIL PROTECTED] id usertocheck 21`; echo id: (.$idResults.)\r\n.\r\n; if (ereg(no such user, $idResults)) { echo 'id blah!'; } *-*-*-*-*-*-*-*-*-*-* And, here are the results that I get when I access the above code with my browser: *-*-*-*-*-*-*-*-*-*-* id: (id: alain: no such user ) id blah! *-*-*-*-*-*-*-*-*-*-* I have added the webserver user to sudoers which gives that user only the ability to sudo to the admin user and run the ssh command which then allows the webserver user to ssh to the remote machine without a password since I setup secure keys for that user. So what I wanted to do is now working. My question now would be, are there any security concerns with how I am doing this? Aside from doing an id check I will also be doing a remote command to add a user to the remote system (ServerB) from the same PHP script. I will of course escapeshellarg any information my users submit to the script. Thanks, Jonathan Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Gryffyn, Trevor wrote: If it's a un*x system and you have permissions to connect to the SMTP server, you could use the VRFY command to check to see if their email address exists or not maybe: Example of Verifying a User Name Either S: VRFY Smith R: 250 Fred Smith [EMAIL PROTECTED] Or S: VRFY Smith R: 251 User not local; will forward to [EMAIL PROTECTED] Or S: VRFY Jones R: 550 String does not match anything. Or S: VRFY Jones R: 551 User not local; please try [EMAIL PROTECTED] Or S: VRFY Gourzenkyinplatz R: 553 User ambiguous. (examples taken from: http://www.ietf.org/rfc/rfc0821.txt Page 8) I believe that, for performance and security reasons, many/most SMTP servers these days will out and out *LIE* to you about this... The real answer is: There is *NO* *WAY* to do this on a general basis, unless you control the remote machine, or know enough about its setup, to be certain that it will respond correctly. ServerA and ServerB Ah. The original poster probably has control of ServerB. Life is now simplified immensely. This, of course, is because the script is being run as www who has no place to put ssl keys. Could this be solved by having www su to a user who has remote access privileges? Something like this: $idResults = `su admin | ssh [EMAIL PROTECTED] id bigbob 21`; su simply won't let you do that. su requires a TTY to avoid you doing something so incredibly dangerous as this. So, no, that won't work. And you shouldn't be trying to do that anyway. Anyone else doing or done something like this? Sure. I've never done it, but many many many have. One fairly simple thing is to create the 'www' user on ServerA so that they *do* have a home directory where they can store SSH keys. You may need to su to 'www' once, and do some ssh work -- ssh-key-gen or whatever it is. That, however, increases your risk in the event that the www user is compromised on ServerA. Probably the best answer is to attack this from the side of ServerB. You want ServerB to: Only allow ServerA to even ask. Tell ServerA if user X is a valid username. From the point of ServerB, making sure that ServerA is the one asking is fairly simple. You could check the IP (which can be spoofed, but that's fairly difficult) or provide some other means of authentication (SSH/SSL) that ensures that ServerA is really ServerA. Then, ServerB can just check /etc/passwd usernames. Or be even simpler to use a shell command like 'user' (?) or 'groups' to verify that a user is valid. In other words, instead of writing some hacky code on ServerA to try to poke at ServerB to get the answer you want, write some nice clean code on ServerB to provide the answer, WHEN APPROPRIATE. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
Christophe, I see where you are coming from with that, but the purpose of this script is to remove me from the picture completely. I want someone to be able to come sign up on my site and automatically be added as a mail user and other things so that I do not need to do that kind of thing. I am looking to do like Hotmail, or Yahoo!, or Mail.com, or any of the other places do. I can go sign up on their site and immediately have an e-mail account that I can start using. No admin has to take the time to create my account for me. Does that make sense? Does that explain better why I am trying to do this? Has not anyone else wanted that functionality also? Thank you, Jonathan Duncan On Fri, 3 Dec 2004, Christophe Chisogne wrote: Jonathan Duncan wrote: I will also be doing a remote command to add a user to the remote system (ServerB) from the same PHP script. If you want to manage a server via web interface, dont reinvent the wheel. Use webmin, by example. Webmin runs a mini webserver as root (on port 1), and uses modules for managing users, proftp, apache, etc Of course, I dont know what you want to do. Christophe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Page that checks if a user exists on a remote system
This is in reply to both Stefan and Richard, I gave it some brief thought in the past, but brushed it off as not as convenient. However, rethinking about it, it may actually be more secure. H, darn it, now you have me thinking again. Security is a big concern for me. As it is now, the web user has the ability to sudo. But that user can only sudo to one other user, who is limited, and can only run 2 commands as that user. Sooo... while the web user is certainly limited, and the PHP script will be outside of the document root of the web server, and access to that script will be through an include on an SSL connection, there could still be something that I am not thinking of. Adding the people to a database first and having a script run by cron (or some other trigger) running on ServerB that accesses the database that is on ServerA would be a nice firewall and the web user would not need any access rights or the need to sudo. Ok, I am going to break this down and rethink my strategy. Thanks to everyone. Richard, I consider myself a highly security conscious person, but you are making me think more like a criminal, and that is good. Security is very important. I will post back with my results. Thanks, -- Jonathan Duncan http://www.nacnud.com On Fri, 3 Dec 2004, Stefan wrote: Hi! Have you thougt of writing the userdata to a database and running a perl script by cron to do the rest? This would be an interesting opinion for security purpose. Stefan -Ursprüngliche Nachricht- Von: Jonathan Duncan [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 3. Dezember 2004 18:55 An: [EMAIL PROTECTED] Betreff: Re: [PHP] Page that checks if a user exists on a remote system Christophe, I see where you are coming from with that, but the purpose of this script is to remove me from the picture completely. I want someone to be able to come sign up on my site and automatically be added as a mail user and other things so that I do not need to do that kind of thing. I am looking to do like Hotmail, or Yahoo!, or Mail.com, or any of the other places do. I can go sign up on their site and immediately have an e-mail account that I can start using. No admin has to take the time to create my account for me. Does that make sense? Does that explain better why I am trying to do this? Has not anyone else wanted that functionality also? Thank you, Jonathan Duncan On Fri, 3 Dec 2004, Christophe Chisogne wrote: Jonathan Duncan wrote: I will also be doing a remote command to add a user to the remote system (ServerB) from the same PHP script. If you want to manage a server via web interface, dont reinvent the wheel. Use webmin, by example. Webmin runs a mini webserver as root (on port 1), and uses modules for managing users, proftp, apache, etc Of course, I dont know what you want to do. Christophe -- 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] Page that checks if a user exists on a remote system
Jason, Such as? I assume you have something in mind. That would certainly be nice. I am not against considering it. Although I am somewhat tied to sendmail as that is what my hosting provider supports and also what I am familiar with. Jonathan Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Saturday 04 December 2004 02:47, Jonathan Duncan wrote: [snip] rethink my strategy. Thanks to everyone. Richard, I consider myself a highly security conscious person, but you are making me think more like a criminal, and that is good. Security is very important. In that case may I suggest that you use an MTA which does not require system accounts for each and every mail box? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Take that, you hostile sons-of-bitches! -- James Coburn, in the finale of _The_President's_Analyst_ */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Page that checks if a user exists on a remote system
Well, I can honestly say I had not thought of doing it that way. I will keep that as an option. Thanks. Jonathan On Thu, 2 Dec 2004, Gryffyn, Trevor wrote: If it's a un*x system and you have permissions to connect to the SMTP server, you could use the VRFY command to check to see if their email address exists or not maybe: Example of Verifying a User Name Either S: VRFY Smith R: 250 Fred Smith [EMAIL PROTECTED] Or S: VRFY Smith R: 251 User not local; will forward to [EMAIL PROTECTED] Or S: VRFY Jones R: 550 String does not match anything. Or S: VRFY Jones R: 551 User not local; please try [EMAIL PROTECTED] Or S: VRFY Gourzenkyinplatz R: 553 User ambiguous. (examples taken from: http://www.ietf.org/rfc/rfc0821.txt Page 8) Just a thought. -TG -Original Message- From: news.php.net [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 7:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Page that checks if a user exists on a remote system I have two servers: ServerA and ServerB. One server serves web pages, the other serves mail. I am making a web page on ServerA that will access ServerB to find out if a users exists and if not then add that user to ServerB with information collected from the web page on ServerA. I have this in a php file: $idResults = `ssh [EMAIL PROTECTED] id bigbob 21`; echo id: (.$idResults.)\r\n.\r\n; if (ereg(no such user, $idResults)) { echo 'username is available!'; } When I access the page I get: Could not create directory '/nonexistent/.ssh'. Host key verification failed. This, of course, is because the script is being run as www who has no place to put ssl keys. Could this be solved by having www su to a user who has remote access privileges? Something like this: $idResults = `su admin | ssh [EMAIL PROTECTED] id bigbob 21`; echo id: (.$idResults.)\r\n.\r\n; if (ereg(no such user, $idResults)) { echo 'username is available!'; // function addUserToServerB(vars); } Anyone else doing or done something like this? Thanks, -- Jonathan Duncan http://www.nacnud.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
Perhaps this gets more into server administration, but it is mixed so much into the php script, which is why I am asking it here. Yes, sudo was one of my first thoughts. As far as the implementation goes though. How do you work the remote access bit? Using ssh do you use the ssl cert switch so that the www user can shell into a remote machine? Or does the sudo process actually make www the root user for a certain command and can then shell into a remote machine using the root ssl cert? Or can sudo make www into a user that can shell into a remote machine? I am still becoming familiar with sudo. Thanks, Jonathan Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 1 Dec 2004 17:57:28 -0700, news.php.net [EMAIL PROTECTED] wrote: Anyone else doing or done something like this? I use sudo when my web server needs temporary elevated permissions. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
I have put this in my sudoers file using visudo to edit it: www ALL = NOPASSWD: /usr/local/bin/sudo puser, (puser) NOPASSWD: /usr/bin/ssh /usr/bin/id However the www user is still being asked for a password. Is this too off topic for this list? Jonathan Jonathan Duncan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Perhaps this gets more into server administration, but it is mixed so much into the php script, which is why I am asking it here. Yes, sudo was one of my first thoughts. As far as the implementation goes though. How do you work the remote access bit? Using ssh do you use the ssl cert switch so that the www user can shell into a remote machine? Or does the sudo process actually make www the root user for a certain command and can then shell into a remote machine using the root ssl cert? Or can sudo make www into a user that can shell into a remote machine? I am still becoming familiar with sudo. Thanks, Jonathan Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 1 Dec 2004 17:57:28 -0700, news.php.net [EMAIL PROTECTED] wrote: Anyone else doing or done something like this? I use sudo when my web server needs temporary elevated permissions. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page that checks if a user exists on a remote system
Looks like I was missing a comma after the ssh command and before the id command. Jonathan Jonathan Duncan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have put this in my sudoers file using visudo to edit it: www ALL = NOPASSWD: /usr/local/bin/sudo puser, (puser) NOPASSWD: /usr/bin/ssh /usr/bin/id However the www user is still being asked for a password. Is this too off topic for this list? Jonathan Jonathan Duncan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Perhaps this gets more into server administration, but it is mixed so much into the php script, which is why I am asking it here. Yes, sudo was one of my first thoughts. As far as the implementation goes though. How do you work the remote access bit? Using ssh do you use the ssl cert switch so that the www user can shell into a remote machine? Or does the sudo process actually make www the root user for a certain command and can then shell into a remote machine using the root ssl cert? Or can sudo make www into a user that can shell into a remote machine? I am still becoming familiar with sudo. Thanks, Jonathan Greg Donald [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 1 Dec 2004 17:57:28 -0700, news.php.net [EMAIL PROTECTED] wrote: Anyone else doing or done something like this? I use sudo when my web server needs temporary elevated permissions. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Blank Page instead of Errors
I am baffled. I really hope someone can save me. (PHP 4.3.4) I am getting blank pages (or partial blank pages if my HTML comes before the PHP) instead of errors. I know there are errors on the page because I have specifically put parse errors in my code to see if the server would give me errors, but instead all I get are blank pages. I have checked the PHP.INI file and I see this: error_reporting = E_ALL ~E_NOTICE display_errors = On I have included different renditions of error_reporting at the top of my script: error_reporting(E_ALL) error_reporting(E_ALL | E_PARSE | E_NOTICE) error_reporting(E_ALL E_PARSE E_NOTICE) ... and some others. Still nothing. Is there something that I am missing? Why can I not see any error messages? Thank you, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Errors running PHP from command line
Thanks. Turns out I just needed to comment some things out of my php.ini. Jonathan Jake McHenry [EMAIL PROTECTED] said: -Original Message- From: Jonathan Duncan [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 7:04 PM To: [EMAIL PROTECTED] Subject: [PHP] Errors running PHP from command line I run a php script from my shell prompt and get these errors, although the script still seems to function properly. Any idea why? (PHP Version 4, FreeBSD) localhost # ./scriptfile.php PHP Warning: Function registration failed - duplicate name - textdomain in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - gettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - _ in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dgettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dcgettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - bindtextdomain in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - ngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dcngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - bind_textdomain_codeset in Unknown on line 0 PHP Warning: gettext: Unable to register functions, unable to load in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/chasen.so' - Cannot open quot;/usr/local/lib/php/extensions/current/chasen.soquot; in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/kakasi.so' - Cannot open quot;/usr/local/lib/php/extensions/current/kakasi.soquot; in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/namazu.so' - Cannot open quot;/usr/local/lib/php/extensions/current/namazu.soquot; in Unknown on line 0 localhost # Thanks, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I used to get this, I would have a page and a half (about 3 times what you posted here) of errors when I would try to run from the command line. I never did figure it out, but they disappeared when I upgraded php. Sorry, not much of a help. Thanks, Jake McHenry Nittany Travel MIS Coordinator http://www.nittanytravel.com -- Jonathan Duncan Administrator 801.376.7796 JKD Web Magic http://www.jkdwebmagic.com Web Site Hosting and Design Brought to you by nacnudMail using TWIG. http://www.nacnud.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Errors running PHP from command line
I run a php script from my shell prompt and get these errors, although the script still seems to function properly. Any idea why? (PHP Version 4, FreeBSD) localhost # ./scriptfile.php PHP Warning: Function registration failed - duplicate name - textdomain in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - gettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - _ in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dgettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dcgettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - bindtextdomain in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - ngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - dcngettext in Unknown on line 0 PHP Warning: Function registration failed - duplicate name - bind_textdomain_codeset in Unknown on line 0 PHP Warning: gettext: Unable to register functions, unable to load in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/chasen.so' - Cannot open quot;/usr/local/lib/php/extensions/current/chasen.soquot; in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/kakasi.so' - Cannot open quot;/usr/local/lib/php/extensions/current/kakasi.soquot; in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/lib/php/extensions/current/namazu.so' - Cannot open quot;/usr/local/lib/php/extensions/current/namazu.soquot; in Unknown on line 0 localhost # Thanks, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header won't redirect
This is code that I have in my index that check whether or not SSL is being used when accessing certain pages and if not then it redirects to the same address but with SSL. if ($pagename==login || $pagename==signup || $pagename==checkout) { if (!$HTTPS) { //header(Location: https://.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].?pagename=$pagename); exit; } } This used to work before I upgraded my PHP. Now when I click on a link that matches my SSL checker it just hangs: http://www.routerbitworld.com/index.php?pagename=checkout If I change the header to redirect to a location without any variable directive like this http://www.routerbitworld.com/index.php ...works fine. Why can't I send a variable this way? Thanks, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Brain cramp with arrays
Mike, Have you looked at the Next: http://us2.php.net/manual/en/function.next.php and Previous: http://us2.php.net/manual/en/function.prev.php ... functions? Regards, Jonathan Duncan Mike Morton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am having a total brain cramp with this array problem (may have to do with the pressure change from the hurricane - but whatever ;) ) $helpsystem[onlineusignuphelp_username]='The username that you choose must be more than 5 characters and 20 or less characters in length. The username must contain only numbers and letters.'; $helpsystem[onlineusignuphelp_password]='The password that you choose must be more than 5 characters and 26 or less characters in length. The username may contain only numbers,letters, and the following characters:br! @ # % ^ *'; I am building a help system of sorts. I have the following 2 array members above (set exactly as such). When I call the page it displays like: Print $helpsystem[$_GET[tip]] I would like to display a next and previous link to help items where possible, the problem that I am having is figureing out how to get the next and previous indexes. I can get the current key with the key() function, and the text for the next and previous using next() and and prev() but because the help is called by the key, I need the index to call the array item in the url: Help.php?tip=onlinusignuphelp_password I cannot seem to find a way to get even the current index number (i.e. 0) so that I can add and subtract one to that index number... Can anyone help out with a pointer on how to get the next and prev keys? Thanks ;) -- Cheers Mike Morton * * Tel: 905-465-1263 * Email: [EMAIL PROTECTED] * Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple. - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Header won't redirect
Marek and Rob, Doh! That was it. I am still finding things that I used to assign globally. It is a good thing, but it makes for a bit of work. Thanks to Jay too. I appreciate everyone's help. Have a good one, Jonathan Duncan Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] And what about $_SERVER[HTTPS], are you using it? PHP wrote: Jay, good guess, but wrong! While register_globals does equal off, I am using $_GET['pagename'] to assign the value to $pagename before the snippet of code that I sent. Sorry I didn't mention that earlier. I tried putting the _GET in my header redirection directly, but that didn't help. Any other ideas? Anyone else have an idea? Thanks, Jonathan Duncan Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] This used to work before I upgraded my PHP. [/snip] Let me guess, you upgraded without actually reading the README or update notes. I am going to guess that register_globals = off in php.ini. You can either fix the variables $_GET['pagename'] or turn RG back on. Jay Blanchard Jonathan Duncan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This is code that I have in my index that check whether or not SSL is being used when accessing certain pages and if not then it redirects to the same address but with SSL. if ($pagename==login || $pagename==signup || $pagename==checkout) { if (!$HTTPS) { //header(Location: https://.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].?pagename=$pagename); exit; } } This used to work before I upgraded my PHP. Now when I click on a link that matches my SSL checker it just hangs: http://www.routerbitworld.com/index.php?pagename=checkout If I change the header to redirect to a location without any variable directive like this http://www.routerbitworld.com/index.php ...works fine. Why can't I send a variable this way? Thanks, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Header won't redirect
Jay, Try replying to the group so that your contributions stay with the thread instead of being orphaned and lost. Regards, Jonathan Duncan Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] Jay, good guess, but wrong! While register_globals does equal off, I am using $_GET['pagename'] to assign the value to $pagename before the snippet of code that I sent. Sorry I didn't mention that earlier. I tried putting the _GET in my header redirection directly, but that didn't help. Any other ideas? Anyone else have an idea? [/snip] Can we see the line of code where you are making the assignment? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Header won't redirect
Perhaps it is just Outlook Express but many of your replies are showing as ophans. Jonathan Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] Try replying to the group so that your contributions stay with the thread instead of being orphaned and lost. [/snip] I always do, did something weird happen? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-Dimensional Arrays
Yeah, you rock, that works great. Not to mention you have a great name. Jonathan Duncan Jonathan Sharp [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... try doing this for each item: $cartArray[] = array('itemnumber' = $itemnumber, 'brand' = $brand, 'quantity' = $itemqty, 'name' = $itemname); -js Jonathan Duncan wrote: I am trying to create an array to hold shopping cart information. The array I am using is called cartArray. What I want to do is to define a sub-array of cartArray with the information from one product. Then the next time a product is added it appends then new information as a second sub-array to cartArray and so forth. Following is some code I have been using to test with and so far PHP will let me use .= to append but when I try to call it back with print_r or echo array[][] only the first entry is returned. Any ideas what I am doing wrong? $brand=Brand1; $itemnumber=456789; $itemname=Some Item Name; $itemqty=3; $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; $brand=Brand2; $itemnumber=123456; $itemname=Another Item Name; $itemqty=9; array_push($cartArray, array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; echo $cartArray[0][0].BRBR; Thank you, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing both static and dynamic modules
Ah, that makes sense. Thanks Tom and David. Jonathan Tom Rogers [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Wednesday, October 9, 2002, 1:24:31 AM, you wrote: JD In the INSTALL file notes for PHP is says: JD 1: Only install either the static module or the dynamic one. Do not JDinstall both. JD No reasoning is given for this statement. Does anyone know what the reason JD for this is? JD The reason I want to know is because I run both the Apache module and the JD static cgi module on my server and I haven't had any problems. I have the JD cgi module for running php scripts as cron jobs. JD Anyone know why the statement? JD Thanks, JD Jonathan Duncan They are not talking about the cgi version, they mean don't compile php into apache as a permanent module and also try to load it as a dynamic one at the same time cgi is treated as a completely seperate program so it can co-exist with an internal apache php module. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi-Dimensional Arrays
I am trying to create an array to hold shopping cart information. The array I am using is called cartArray. What I want to do is to define a sub-array of cartArray with the information from one product. Then the next time a product is added it appends then new information as a second sub-array to cartArray and so forth. Following is some code I have been using to test with and so far PHP will let me use .= to append but when I try to call it back with print_r or echo array[][] only the first entry is returned. Any ideas what I am doing wrong? $brand=Brand1; $itemnumber=456789; $itemname=Some Item Name; $itemqty=3; $cartArray[] .= array(0=array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; $brand=Brand2; $itemnumber=123456; $itemname=Another Item Name; $itemqty=9; array_push($cartArray, array($itemnumber=$brand, $itemqty, $itemname)); print_r($cartArray).BRBR; echo $cartArray[0][0].BRBR; Thank you, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installing both static and dynamic modules
In the INSTALL file notes for PHP is says: 1: Only install either the static module or the dynamic one. Do not install both. No reasoning is given for this statement. Does anyone know what the reason for this is? The reason I want to know is because I run both the Apache module and the static cgi module on my server and I haven't had any problems. I have the cgi module for running php scripts as cron jobs. Anyone know why the statement? Thanks, Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql_num_rows error
Omar, I would first take the select statement and try running it in mysql to make sure it actually runs (substituting a valid value for the variable of course). Then if it has problems you can see what error messages mysql gives you. Good Luck, Jonathan Duncan Omar Campos [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have a file. I'll paste from line 32 to 34 ? . $sql = select USUARIO from docente where USUARIO = '$usuario'; $result = mysql_query($sql, $link); if (mysql_num_rows($result) == 1) { // line 34 ? I get the next warning: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/olimpiad/public_html/base/alta1.php on line 34 I'm running the script on a linux server. could someone help me. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse an email message for content
I am trying to display on a web page a daily message from a mailing list that I am on. What I want is to have a script run on my server each day at a certain time that reads the mail file that contains the daily email message, takes the Article Titles and makes them the link text to be used with the link that is provided and then have the article abstract listed below. Can anyone point me in the correct direction on how I can learn how to do this? Thank you very much, Jonathan Duncan The daily email message I get comes in the following format: *-*-*-* Start Email Message *-*-*-* EMAIL HEADERS Bulleted list of article titles -article 1 -article 2 = (That is 5 equal characters) Article 1 Title See http://some.server.com/path/to/article.html a href=http://some.server.com/path/to/article.html;Link/a See http://additional.server.com/path/to/article.html a href=http://additional.server.com/path/to/article.html;Link/a Article 1 abstract. This gives a brief excerpt of the article. = (That is 5 equal characters) Article 2 Title See http://some.server.com/path/to/article.html a href=http://some.server.com/path/to/article.html;Link/a See http://additional.server.com/path/to/article.html a href=http://additional.server.com/path/to/article.html;Link/a Article 2 abstract. This gives a brief excerpt of the article. - Copyright text ends the message -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse an email message for content
Ed, Thanks for the reply. Actually, I have the module version and the cgi version of PHP running on my server. I have another script that I run daily, but that is a different beast with my own content. Also, I know about egrep and preg_egrep, great functions. However, I am looking for an idea on how to actually read the email files. I have been reading about fread for reading the file and then I have considered doing an fseek to start reading where the email headers stop, and then explodeing the contents of the file separated by the = delimiter that comes in the message. However, I do not know where to start. Any pointers? Thanks, Jonathan Duncan Ed Lazor [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You'll need to have a cgi version of PHP to use in cronjobs and you'll need to use http://www.php.net/manual/en/function.preg-grep.php Good luck =) -Original Message- From: Jonathan Duncan [mailto:[EMAIL PROTECTED]] Sent: Monday, June 10, 2002 12:48 PM To: [EMAIL PROTECTED] Subject: [PHP] Parse an email message for content I am trying to display on a web page a daily message from a mailing list that I am on. What I want is to have a script run on my server each day at a certain time that reads the mail file that contains the daily email message, takes the Article Titles and makes them the link text to be used with the link that is provided and then have the article abstract listed below. Can anyone point me in the correct direction on how I can learn how to do this? Thank you very much, Jonathan Duncan The daily email message I get comes in the following format: *-*-*-* Start Email Message *-*-*-* EMAIL HEADERS Bulleted list of article titles -article 1 -article 2 = (That is 5 equal characters) Article 1 Title See http://some.server.com/path/to/article.html a href=http://some.server.com/path/to/article.html;Link/a See http://additional.server.com/path/to/article.html a href=http://additional.server.com/path/to/article.html;Link/a Article 1 abstract. This gives a brief excerpt of the article. = (That is 5 equal characters) Article 2 Title See http://some.server.com/path/to/article.html a href=http://some.server.com/path/to/article.html;Link/a See http://additional.server.com/path/to/article.html a href=http://additional.server.com/path/to/article.html;Link/a Article 2 abstract. This gives a brief excerpt of the article. - Copyright text ends the message -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse an email message for content
Michael, Wow, correct you are: http://www.php.net/manual/en/ref.mailparse.php Thank you, I will definitely see what that has to offer me. Jonathan Duncan Michael Geier [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... while not documented, PHP now has the mail-parse functions (see documentation for function list) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Processing Code created on the fly
I am trying to create an HTML Table which has TH headers which are different depending upon the link clicked to access the page. Also, the content of the TD's below the headers would be different depending on the headers and depending on the link clicked. I have sorted out many of the details, but one eludes me. Attached is an example that I have created to try to prove my point. In it you will first see two variables that have been created inside of a function. The function is called with certain values and these variables are created and populated with PHP code that needs to be evaluated at a point later in the file that calls the function. Next you will see a WHILE statement that should take the contents of the those variables and evaluate those contents as if they had been hard-coded in place of the variables. So far, when I run the script as is it simply prints the contents of the variables, which is raw PHP code, but does not process it. The results is that the raw PHP code that is in the variables doesn't get process, but is output at text on the resulting HTML page. Can anyone help me figure this out? I would really appreciate it. Thanks in advance, Jonathan Duncan begin 666 example.php M/#\-E1H97-E('9AFEA8FQER!AF4]P=6QA=5D(%N9!AW-I9VYE M9!I;B!A(9U;F-T:6]N.@T**%1H:7,:7,:G5S=!A;B!E%MQE+B M26X@86-T=6%L:71Y('1H97-E('9AFEA8FQEPT*87)E('!O'5L871E9!U MVEN9R!O=AEB!M96%NRXI#0HM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2T-B1O=AEG9AG, M/2!AG)A2)'-EG9I8V4/2 DW%LF5S=6QT6R=S97)V:6-E)UT[#0H) M0D)21M7V%M;W5N= ](1S6QR97-U;'1;)VU?86UO=6YT)UT[#0H)0D) M21P86ED=AR=2 ](1S6QR97-U;'1;)W!A:61T:')U)UT[#0H)0D)21A M;6]U;G1D=64/2 DW%LF5S=6QT6R=A;6]U;G1D=64G73LI#0H-B1T86)L M961A=$/2!AG)A2@\5$0^)%C8V]U;G0\+U1$/T*0D)2 (#Q41#XD MV5R=FEC93PO5$0^*0T*#0H-T*5AIR!IR!F:6QE('1H870@8V%L;', M=AE(%B;W9E(9U;F-T:6]N.@T**%1H92!L:6YER!W:71H('1H92 JR!A MF4W5P]S960@=\@=%K90T*=AE(1A=$@9G)O;2!T:4@=F%R:6%B M;5S(%N9!T:5N('!R;V-EW,-G1H96T@87,:68@=AE2!W97)E('!A MG0;V8@=AE(-O94N*0T*+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM M+2TM+2TM+2TM+2TM+2TM+2T-G=H:6QE(DW%LF5S=6QT(#T;7ES6Q? M9F5T8VA?87)R87DH)')EW5L=DI('L-DD:60/2 DW%LF5S=6QT6R=I M9==.PT*21A8V-O=6YT(#T)'-Q;')EW5L=%LG86-C;W5N===.PT**B M( D=AE9G5N8W1I;VXM/F]T:5R=F%RSL-DD96UA:6P/2 DW%LF5S M=6QT6R=E;6%I;==.PT*21T97)MR ](1S6QR97-U;'1;)W1EFUS)UT[ M#0H))%C8V]U;G1?;ES= N/2 B/%12($-,05-3/5PB)]D9]R979E;EPB M/T*0D)0D(#Q41!!3$E'3CU(F-E;G1EEPB/CQ!($A2148]7)E9ET M86-C;W5N=YP:' _:60])ED)F5D:70]65S7(^/$E-1R!34D,]7)E9ET M8G5T=]N+F=I9EPB($)/4D1%4CU(C!(CX\+T$^/]41#X-BH( ( M( ( ( ( ( )'1H969U;F-T:6]N+3YT86)L961A=$[#0H)0D) M2 /%1$($%,24=./5PB8V5N=5R7(^70D;5]A;6]U;G0\+U1$/T*0D) M0D(#Q41#X\02!(4D5/5PB7(;VYC;EC:SU(G=I;F1O=RYO5N*=P M87EM96YTRYP:' G+=P87EV:65W)RPG=VED=]-3 P+AE:6=H=#TU,# L M=]O;)ACUN;RQL;V-A=EO;CUN;RQD:7)E8W1OFEESUN;RQS=%T=7,] M;F\LV-R;VQL8F%RSUN;RQR97-IF%B;4];F\L;65N=6)ACUN;RI.R!R M971UFX@9F%LV5(B D;V5L:6YKW1Y;4^)'!A:61T:')U/]!/CPO5$0^ M#0H)0D)2 /%1$($%,24=./5PB8V5N=5R7(^70D86UO=6YT9'5E/]4 M1#X-D)0D)( \5$0^/$$@2%)%1CU(FUA:6QT;SHD96UA:6Q(B D;V5L M:6YKW1Y;4^)5M86EL/]!/CPO5$0^#0H)0D)2 /%1$($%,24=./5PB ?8V5N=5R7(^)'1EFUS/]41#X\+U12/B([#0H_/`` ` end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Processing Code created on the fly
Jason, That is a good point and that being the case, following is my code. Thanks, Jonathan Duncan *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ? These variables are populated and assigned in a function: (This is just an example. In actuality these variables are populated using other means.) - $othervars = $service = $sqlresult['service']; $m_amount = $sqlresult['m_amount']; $paidthru = $sqlresult['paidthru']; $amountdue = $sqlresult['amountdue'];; $tabledata = TD$account/TD TD$service/TD; This is file that calls the above function: (The lines with the *s are supposed to take the data from the variables and then process them as if they were part of the code.) while ($sqlresult = mysql_fetch_array($result)) { $id = $sqlresult['id']; $account = $sqlresult['account']; *$thefunction-othervars; $email = $sqlresult['email']; $terms = $sqlresult['terms']; $account_list .= TR CLASS=\$oddoreven\ TD ALIGN=\center\A HREF=\editaccount.php?id=$idedit=yes\image/A/TD * $thefunction-tabledata; TD ALIGN=\center\\$$m_amount/TD TDA HREF=\somefile.php\$paidthru/A/TD TD ALIGN=\center\\$$amountdue/TD TDA HREF=\mailto:$email\; $oelinkstyle$email/A/TD TD ALIGN=\center\$terms/TD/TR; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Processing Code created on the fly
Yeah, I have played with the eval function a bit, but it didn't seem to help much. Then again, I haven't ever used the eval function before so I may not know how to properly implement it. I have read the page for eval on php.net several times as well as the very helpful examples, but whenever I use eval, it just prints out the same stuff. By same stuff I mean wether I use eval or just the variable by itself it just prints out the contents of the variable. In the web page source it looks as if the contents were merely echoed because it still has the $'s and variable names. Any other ideas or examples on how to implement eval on this? Thanks for the help, Jonathan Duncan Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Saturday 30 March 2002 11:16, Jonathan Duncan wrote: ? These variables are populated and assigned in a function: (This is just an example. In actuality these variables are populated using other means.) - $othervars = $service = $sqlresult['service']; $m_amount = $sqlresult['m_amount']; $paidthru = $sqlresult['paidthru']; $amountdue = $sqlresult['amountdue'];; $tabledata = TD$account/TD TD$service/TD; This is file that calls the above function: (The lines with the *s are supposed to take the data from the variables and then process them as if they were part of the code.) while ($sqlresult = mysql_fetch_array($result)) { $id = $sqlresult['id']; $account = $sqlresult['account']; *$thefunction-othervars; $email = $sqlresult['email']; $terms = $sqlresult['terms']; $account_list .= TR CLASS=\$oddoreven\ TD ALIGN=\center\A HREF=\editaccount.php?id=$idedit=yes\image/A/TD * $thefunction-tabledata; TD ALIGN=\center\\$$m_amount/TD TDA HREF=\somefile.php\$paidthru/A/TD TD ALIGN=\center\\$$amountdue/TD TDA HREF=\mailto:$email\; $oelinkstyle$email/A/TD TD ALIGN=\center\$terms/TD/TR; ? You need to check out the eval() function. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The real trouble with reality is that there's no background music. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamically creating PHP before it is executed
I am trying to figure out a way to dynamically create some lines of PHP code and then have it executed. This is because I want a page to display different columns in a table depending on whatever link is clicked. There are hundreds of different combinations of column headings so I don't want to make a different PHP page that is formated for each different combination. The column headings are stored in a database. So far what I have come up with is to have a starting page, that takes the value of the link that is clicked, it queries the database for that value and then does a while statement to make all the TD's for the different columns. Each TD is populated with a different variable, one for each column header. Each iteration I append to a variable to hold all of these TD's. Then I write the contents of that variable to a temporary include file and call the page that will display the table. That table then includes those TD's from the include file I wrote them to and executes the PHP that runs another query on the database and fills in the variables in those TD's. This seems like a lot of work. Does what I am trying to do make sense to anyone? Does anyone have any idea how to do this an easier way? Thanks Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamically creating PHP before it is executed
Bogdan, Thank you for your comment, it actually made me think of a possible solution for something else I am working on. However, it is just as I thought, I am being too vague. I am most likely making my whole situation more complicated than I need. Another idea is just to do a select * and run the whole shebang through an IF/ELSE series to determine which headers are being used. However, to remain on my current train of thought, here is a snippet of my code: include(inc/dbconnect.inc); $sql = select columns from tablename where id=$someid; $sqlresult = mysql_query($sql, $connection) or die(Couldn't execute query. (7)); $columns_array = explode(,, $sqlresults['columns']); while (list($col) = each($columns_array)) { $sql = select coltitle from FreudColumns where colid='$col'; $result = mysql_query($sql, $connection) or die(Couldn't execute query. (12)); $ch = mysql_fetch_array($result); // Set the column headers $headers .= TH CLASS=\hlink\$ch['coltitle']/TH; // Set the item variables $setitemvar .= \$$col = \$isr['$col'];; // Set the measurement columns $setitem .= TD CLASS=\\$itemclass\\$$col/TD; } Afterwhich I write $headers to a file, $setitemvar to a file, $setitem to a file and call the page that is supposed to include these files I have just writed so that the PHP code that I have just dynamically written will then execute and the variables will be replaced. Does this make any more sense? Thank you, Jonathan Duncan Bogdan Stancescu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I don't quite understand why you chose such a complicated solution - I may be missing something, in which case sorry for wasting your time. But why don't you just dynamically build the select statement and then use the whatever_fetch_array() -- and walk that array instead? Just my 2c Bogdan Jonathan Duncan wrote: I am trying to figure out a way to dynamically create some lines of PHP code and then have it executed. This is because I want a page to display different columns in a table depending on whatever link is clicked. There are hundreds of different combinations of column headings so I don't want to make a different PHP page that is formated for each different combination. The column headings are stored in a database. So far what I have come up with is to have a starting page, that takes the value of the link that is clicked, it queries the database for that value and then does a while statement to make all the TD's for the different columns. Each TD is populated with a different variable, one for each column header. Each iteration I append to a variable to hold all of these TD's. Then I write the contents of that variable to a temporary include file and call the page that will display the table. That table then includes those TD's from the include file I wrote them to and executes the PHP that runs another query on the database and fills in the variables in those TD's. This seems like a lot of work. Does what I am trying to do make sense to anyone? Does anyone have any idea how to do this an easier way? Thanks Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamically creating PHP before it is executed
Sam, The questions you write are good. I am not sure why they can't. I just assumed that if I make lines of code like: TD CLASS=\\$itemclass\\$$col/TD and populate them like: TD CLASS=$itemclass$column1/TD TD CLASS=$itemclass$column2/TD TD CLASS=$itemclass$column3/TD that I would have to then evaluate them on a different page. Am I incorrect? Thanks, Jonathan Duncan - Original Message - From: Samuel Ottenhoff [EMAIL PROTECTED] To: Jonathan Duncan [EMAIL PROTECTED] Sent: Friday, March 08, 2002 10:23 PM Subject: Re: [PHP] Dynamically creating PHP before it is executed You make sense until the last paragraph. It sounds like you are making this way more complicated than it need be. Why write these out to files and then include them? Why not just echo your results out to the browser? Why can't all of this code be contained within one PHP page? Sam Jonathan Duncan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Bogdan, Thank you for your comment, it actually made me think of a possible solution for something else I am working on. However, it is just as I thought, I am being too vague. I am most likely making my whole situation more complicated than I need. Another idea is just to do a select * and run the whole shebang through an IF/ELSE series to determine which headers are being used. However, to remain on my current train of thought, here is a snippet of my code: include(inc/dbconnect.inc); $sql = select columns from tablename where id=$someid; $sqlresult = mysql_query($sql, $connection) or die(Couldn't execute query. (7)); $columns_array = explode(,, $sqlresults['columns']); while (list($col) = each($columns_array)) { $sql = select coltitle from FreudColumns where colid='$col'; $result = mysql_query($sql, $connection) or die(Couldn't execute query. (12)); $ch = mysql_fetch_array($result); // Set the column headers $headers .= TH CLASS=\hlink\$ch['coltitle']/TH; // Set the item variables $setitemvar .= \$$col = \$isr['$col'];; // Set the measurement columns $setitem .= TD CLASS=\\$itemclass\\$$col/TD; } Afterwhich I write $headers to a file, $setitemvar to a file, $setitem to a file and call the page that is supposed to include these files I have just writed so that the PHP code that I have just dynamically written will then execute and the variables will be replaced. Does this make any more sense? Thank you, Jonathan Duncan Bogdan Stancescu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I don't quite understand why you chose such a complicated solution - I may be missing something, in which case sorry for wasting your time. But why don't you just dynamically build the select statement and then use the whatever_fetch_array() -- and walk that array instead? Just my 2c Bogdan Jonathan Duncan wrote: I am trying to figure out a way to dynamically create some lines of PHP code and then have it executed. This is because I want a page to display different columns in a table depending on whatever link is clicked. There are hundreds of different combinations of column headings so I don't want to make a different PHP page that is formated for each different combination. The column headings are stored in a database. So far what I have come up with is to have a starting page, that takes the value of the link that is clicked, it queries the database for that value and then does a while statement to make all the TD's for the different columns. Each TD is populated with a different variable, one for each column header. Each iteration I append to a variable to hold all of these TD's. Then I write the contents of that variable to a temporary include file and call the page that will display the table. That table then includes those TD's from the include file I wrote them to and executes the PHP that runs another query on the database and fills in the variables in those TD's. This seems like a lot of work. Does what I am trying to do make sense to anyone? Does anyone have any idea how to do this an easier way? Thanks Jonathan Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing Content
That is perfect, thank you Philip and Erik. I forgot what a great resource DevShed is. Thanks again, Jonathan Duncan Erik Price [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]; On Monday, March 4, 2002, at 06:10 PM, Jonathan Duncan wrote: I want to make a web site that displays news headlines from my favorite news sites. The way that you're thinking of doing it (parsing via regexes from other site's HTML) is the Long Way Around. Why not do it the way the pros do it? This topic is a current front page headline at Developer Shed (www.devshed.com). Here is the link to the tutorial on this very topic: http://www.devshed.com/Server_Side/PHP/PHPRDF/page1.html You get to teach yourself a bit about XML along the way. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing Content
I want to make a web site that displays news headlines from my favorite news sites So the theory is that I fopen their web page, fread the contents of the page, look for the sections that have the news headlines (with regex I assume) and their href link information, paste that into an include file and call it when my page loads Sounds simple enough right? The part I don't yet know how to do is the part where I parse the web page that I have read from the news site So what I think I need to know is how to pinpoint the section with the headline links in it, take only those links and their text and paste them into a new file This project may be bigger than a bread box, so any ideas or pointers to resources that could help me learn how to do this would much appreciated Thank you, Jonathan Duncan -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp