[PHP] compiling with stronghold
Anyone know of docs in place for compiling php4 under stronghold? Its apache based, however I was hoping that someone had put some doc into place specific to this webserver. Thanks- charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] IMLIB
Hello, Somebody know how to make IMLIB library compile into php ? i tried --with, --enable, but doesn't work ! Thanks. -- Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] group comparision
i have a php script that has three variables that could be set to "1" depending on the values of a form being sent to the .php file. $add $remove $view i need to do some error control in my script to make certain that one and only one of these is set to "1". i am coming up with a very long control structure: if (($add="1") && ($remove="1") || ($add="1") && ($view="1") || etc...)) is there a shorter method to do this? and can i break this up onto multiple lines to make my code a bit cleaner? can i do something like: if ( ($add="1") && ($remove="1") || ($add="1") && ($view="1") || ($remove="1") && ($view="1") ) { Thanks! -Charles -- ** There are two major products to come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] group comparision
I don't think this is quite what I am looking for because I am hoping to issue an error message if more than one variable has a value of one. Sorry for not including this as a stipulation. Thanks -Charles On Thu, 17 May 2001, elias wrote: > I understand that you want to check if: > > i need to do some error control in my script to make certain that one and > > only one of these is set to "1". i am coming up with a very long > > control structure: > "One and Only One" > okay, ... > > if ($add == "1") { // do the add job } > elseif ($remove == "1") { // } > elseif ($view == "1") { // } > > -elias > > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > i have a php script that has three variables that could be set to "1" > > depending on the values of a form being sent to the .php file. > > > > $add > > $remove > > $view > > > > i need to do some error control in my script to make certain that one and > > only one of these is set to "1". i am coming up with a very long > > control structure: > > > > if (($add="1") && ($remove="1") || ($add="1") && ($view="1") || etc...)) > > > > is there a shorter method to do this? and can i break this up onto > > multiple lines to make my code a bit cleaner? can i do something like: > > > > if ( > >($add="1") && ($remove="1") || > >($add="1") && ($view="1") || > >($remove="1") && ($view="1") > >) { > > > > > > Thanks! -Charles > > > > > > -- > > ** > > There are two major products to come out of Berkeley: > > LSD and UNIX. We don't believe this to be a coincidence. > > ** > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- ** There are two major products to come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] while loops [ newbie ]
be forewarned that a bash fan is writing this message with little to no perl/c++ experience. i have a file $file that is full of usernames and descriptions, one per line. i have another variable $username that i would like to compare against each line in the file and remove the line that matches the username field identically. $filename charles routers craig systems tonyportmasters i would think that a while loop could do this and possibly write the output, minus the line i want to take away to a temp file and then copy it over. in bash i would use a statement like: while read i; do < blah > done < $filename > $filename.tmp however i am not certain how to read in the contents of a file for comparison within a while loop. this is just going to be an uphill thread since my next question will be for the < blah > portion :) thanks in advance -charles -- ** There are two major products to come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] OOP Problem
Hi, i have create a simple php class to learn how to oop programming, like this: class mysqldb { var $dbconn; function OpenCon($DBHOST,$DBUSER,$DBPASS){ $this->dbconn = mysql_connect($DBHOST,$DBUSER,$DBPASS); } } this is a simple example... but when i inherit the class, php give me a error, call to undefined function: mysql_connect() php think that mysql_connect is my private function ? Charles Ps. sorry my poor english -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP 5.4 new output control API callback buffer
Hi, I'm just wondering, what is the right output of below code should be ob_start(function($o) { fwrite(STDERR, $o); }); echo 'hello'; ob_end_clean(); Does it should print "hello" or does it should print nothing? In PHP 5.3, it prints hello, but in 5.4.0 it prints nothing. Looking at the C code of PHP 5.4, it explicitly discards the output buffer before calling the callback, except when flushing or when using the internal callback handler. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] no traffic
On Tue, Mar 6, 2012 at 8:55 PM, Lawrence Decker wrote: > I've been playing with PHP for about 6 years and I have no idea why this is > happening... I've been writing a script to auth to AD. When I run the > script on my dev box, nothing. I have wireshark running in the background > on the dev box, I can see the script's traffic go out and hit the DNS > server but no other traffic. Command line, no problem talking to other > hosts with whatever port I'm trying to hit. On my box, all the scripts > work fine. LDAP is enabled, but I can't hit ANY port other than DNS and if > I use the IP in the script, I see no traffic. Both are FC16-64 patched as > of last week. I matched line-by-line in the phpinfo() on my box and the dev > box - no difference. Used this script to try any port open on other hosts > but no traffic shows up in wireshark!! Any ideas Have you checked that it's not a firewall problem? e.g. by running # telnet server-ip ldap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] no traffic
On Tue, Mar 6, 2012 at 8:55 PM, Lawrence Decker wrote: > I've been playing with PHP for about 6 years and I have no idea why this is > happening... I've been writing a script to auth to AD. When I run the > script on my dev box, nothing. I have wireshark running in the background > on the dev box, I can see the script's traffic go out and hit the DNS > server but no other traffic. Command line, no problem talking to other > hosts with whatever port I'm trying to hit. On my box, all the scripts > work fine. LDAP is enabled, but I can't hit ANY port other than DNS and if > I use the IP in the script, I see no traffic. Both are FC16-64 patched as > of last week. I matched line-by-line in the phpinfo() on my box and the dev > box - no difference. Used this script to try any port open on other hosts > but no traffic shows up in wireshark!! Any ideas Do you have selinux enabled on your dev box? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick wrote: > $date = new DateTime($year . '-' . $current_month . '-1'); > $date->add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to > the date-instance (haven't tried that with the 30th of Jan ... would > be kind-of interesting) > > $days_in_current_month = $date->format('j'); // Get the date of the month I think you'd need to subtract it with 1 day date_create(date('Y-m'))->add(new DateInterval('P1M'))->sub(new DateInterval('P1D'))->format('d'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Fri, Mar 9, 2012 at 9:23 AM, Tedd Sperling wrote: > On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: > On Mar 8, 2012 6:14 PM, "Tedd Sperling" wrote: >> >> > Side-point: I find it interesting that getdate() has all sorts of neat >> > descriptions for the current month (such as, what weekday a numbered day >> > is), but lacks how many days are in the month. Doesn't that seem odd? >> >> Oh, I see what you're saying now. Well, using getdate(), how else would you >> think to pass the parameter to get the last day other than using the current >> month and the last day (which would then obviously be overkill, of course). > > Well.. you could use any number that exceeds 31 -- or -- as I would have > suggested if it had been up to me, zero day would provide the number of days > in *that* month rather than the number of days in the previous month, which > was the point of my post. > >> All of this aside, though, you may instead want to use something along the >> lines of date('d',strtotime('last day of this month')); in tandem with your >> date formatting. > > That's a good idea, but > >> date('d',strtotime('last day of this month')); > > > gives me the number of days in *this* month, but not the next, or previous, > month. > > I need the result to be whatever date was selected -- something like: > > $number_days = date('d',strtotime('last day of April, 2014')); > > But that doesn't work. > > You see, I need something that makes sense to students. The idea that you > have to use the zero day (whatever that is) of the next month to see how many > days there are in this month is strange and confusing -- again my point. > > Thus far, the following looks better than what I came up with:: > > $what_date = getdate(mktime(0, 0, 0, $mon, 32, $year)); > $days_in_month = 32 - $what_date['mday']; > > But it's still strange. > > I was using: > > // get the last day of the month > $cont = true; > $tday = 27; > while (($tday <= 32) && ($cont)) > { > $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); > if ($tdate["mon"] != $mon) > { > $lastday = $tday - 1; > $cont = false; > } > $tday++; > } > > It made sense, but was too long. I figured there should be something better > and easier to explain -- but I'm still looking. function count_days($month, $year) { return (mktime(0, 0, 0, $month+1, 1, $year) - mktime(0, 0, 0, $month, 1, $year))/86400; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling wrote: > On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >>> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >>> But why does anyone have to use the next month to figure out how >>> many days there are are in this month? Do you see my point? >> >> Actually, no. To figure this out, somewhere along the line you've >> got to know where the last day of this month / first day of next >> month boundary lies, so I don't see how you can ever find the number >> of days in a month without bringing the start of next month into it >> somehow. (Even if it's implicitly be getting someone else's clever >> code to figure out 'last day of this month'!) > > Well no, I don't need to know the first day of next month to know the last > day of this month. That's like saying "I need to know who is going to stand > at the 'end of the line' NEXT before I can tell who is standing at the 'end > of the' line NOW." The number of days in each month is fixed, except for february. If that's what you want, why don't make a table of the number of days in each month, and check for the special case of leap year. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling wrote: > On Mar 9, 2012, at 11:17 AM, Charles wrote: > >> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling >> wrote: >>> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >>>>> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >>>>> But why does anyone have to use the next month to figure out how >>>>> many days there are are in this month? Do you see my point? >>>> >>>> Actually, no. To figure this out, somewhere along the line you've >>>> got to know where the last day of this month / first day of next >>>> month boundary lies, so I don't see how you can ever find the number >>>> of days in a month without bringing the start of next month into it >>>> somehow. (Even if it's implicitly be getting someone else's clever >>>> code to figure out 'last day of this month'!) >>> >>> Well no, I don't need to know the first day of next month to know the last >>> day of this month. That's like saying "I need to know who is going to stand >>> at the 'end of the line' NEXT before I can tell who is standing at the 'end >>> of the' line NOW." >> >> The number of days in each month is fixed, except for february. If >> that's what you want, why don't make a table of the number of days in >> each month, and check for the special case of leap year. > > No offense, but that's not the point. A look-up table would work, but why > when there are all sorts of built-in functions that will? You just said yourself that "I don't need to know the first day of next month to know the last day of this month", and AFAIK there is no such function in PHP to get the number of days without accessing the last second in the month. Besides, showing how it is done is part of education. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Sat, Mar 10, 2012 at 12:52 AM, Charles wrote: > On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling > wrote: >> On Mar 9, 2012, at 11:17 AM, Charles wrote: >> >>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling >>> wrote: >>>> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >>>>>> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >>>>>> But why does anyone have to use the next month to figure out how >>>>>> many days there are are in this month? Do you see my point? >>>>> >>>>> Actually, no. To figure this out, somewhere along the line you've >>>>> got to know where the last day of this month / first day of next >>>>> month boundary lies, so I don't see how you can ever find the number >>>>> of days in a month without bringing the start of next month into it >>>>> somehow. (Even if it's implicitly be getting someone else's clever >>>>> code to figure out 'last day of this month'!) >>>> >>>> Well no, I don't need to know the first day of next month to know the last >>>> day of this month. That's like saying "I need to know who is going to >>>> stand at the 'end of the line' NEXT before I can tell who is standing at >>>> the 'end of the' line NOW." >>> >>> The number of days in each month is fixed, except for february. If >>> that's what you want, why don't make a table of the number of days in >>> each month, and check for the special case of leap year. >> >> No offense, but that's not the point. A look-up table would work, but why >> when there are all sorts of built-in functions that will? > > You just said yourself that "I don't need to know the first day of > next month to know the last day of this month", and AFAIK there is no > such function in PHP to get the number of days > without accessing the last second in the month. Besides, showing how > it is done is part of education. Unless, of course you install the "calendar" extension, of which it will provides just the required function http://php.net/manual/en/function.cal-days-in-month.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function mktime() documentation question
On Sat, Mar 10, 2012 at 12:57 AM, Charles wrote: > On Sat, Mar 10, 2012 at 12:52 AM, Charles wrote: >> On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling >> wrote: >>> On Mar 9, 2012, at 11:17 AM, Charles wrote: >>> >>>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling >>>> wrote: >>>>> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >>>>>>> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >>>>>>> But why does anyone have to use the next month to figure out how >>>>>>> many days there are are in this month? Do you see my point? >>>>>> >>>>>> Actually, no. To figure this out, somewhere along the line you've >>>>>> got to know where the last day of this month / first day of next >>>>>> month boundary lies, so I don't see how you can ever find the number >>>>>> of days in a month without bringing the start of next month into it >>>>>> somehow. (Even if it's implicitly be getting someone else's clever >>>>>> code to figure out 'last day of this month'!) >>>>> >>>>> Well no, I don't need to know the first day of next month to know the >>>>> last day of this month. That's like saying "I need to know who is going >>>>> to stand at the 'end of the line' NEXT before I can tell who is standing >>>>> at the 'end of the' line NOW." >>>> >>>> The number of days in each month is fixed, except for february. If >>>> that's what you want, why don't make a table of the number of days in >>>> each month, and check for the special case of leap year. >>> >>> No offense, but that's not the point. A look-up table would work, but why >>> when there are all sorts of built-in functions that will? >> >> You just said yourself that "I don't need to know the first day of >> next month to know the last day of this month", and AFAIK there is no >> such function in PHP to get the number of days >> without accessing the last second in the month. Besides, showing how >> it is done is part of education. > > Unless, of course you install the "calendar" extension, of which it > will provides just the required function > > http://php.net/manual/en/function.cal-days-in-month.php Okay, scratch that, the standard function works fine $number_of_days = idate('t', strtotime($year.'-'.$month)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bug with "+" sign when using CLI?
I'm using the CLI script shown below to parse and show all argv variables passed to it. ## -rwxr-xr-x1 nobody nobody plusbug.php ## #!/usr/bin/php -q ### END ## Command being entered: ./plusbug.php 'something+something' Output: Array ( [0] => ./plusbug.php [1] => something [2] => something ) I found nothing about a + splitting argument variables anywhere in the CLI documentation though I know this is a CGI characteristic. I've tried escaping the + character to no avail. I need to pass a string with a + character in it, anyone know anything I can do other than repopulating the character back into the string within the php script which would make what I'm trying to accomplish very difficult. In the php.ini I have: register_globals = On register_argc_argv = On Note: If I have either of these turned off, I am not even able to pick-up the arguments passed to the script whether I use $argv or $_SERVER['argv']. PHP Version: 4.2.3 Regards, Bronson_AT_udatasystems.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problems with header
It looks like your trying to do something before redirecting the user. Try the below near the end of your script so everything completes before redirecting them. Echo "; Bronson_AT_udatasystems.com -Original Message- From: Carlos Alberto Pinto Hurtado [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Problems with header I'm use header("Location: http://www.ica.gov.co/contratacion/RObs_borradores?control=1";); but the answer is Warning Cannont add header information - headers already send by (output started at G:\Intranet\common\mail.php:36) in G:\Intranet\common\mail.php on line 37 Carlos Alberto Pinto Hurtado IT ICA (57 1) 2322181 (57 1) 2324698 Movil.(57 3) 310 6184251 -- 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] html output from system() command
If you try viewing the source of the webpage it will probably show up correctly. If this is the case, try putting the output into a variable and passing it to the nl2br() function. Echo nl2br($commandoutput); And/or make your way to http://www.php.net/manual/en/function.nl2br.php Bronson_AT_udatasystems.com -Original Message- From: Clay Stuckey [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:41 PM To: Php Subject: [PHP] html output from system() command When I execute: system('who'); I get the output to the screen but it is all concatenated together like this: root pts/0 Dec 6 15:31 (34-218-228-130.arpa.kmail.net) sneakytrick pts/1 Dec 6 10:22 (34-218-228-130.arpa.kmail.net) How can I make it look like: root pts/0 Dec 6 15:31 (34-218-228-130.arpa.kmail.net) sneakytrick pts/1 Dec 6 10:22 (34-218-228-130.arpa.kmail.net) -- Clay Stuckey - RHCE, CCNA, MCSE Charleston Housing Authority - MIS Manager [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
RE: [PHP] Mail(): How much time?
There are a couple of spots it may be slowing down depending on how your doing things. I have a mysql database and submit one query in which I hold all the data in an array. Then I loop through the array so I do not need to send multiple queries. I use something like the following, though I like to stay away from the mail() function, especially when sending a lot of emails. $Subject = "This is the subject"; $Message = "This is the message\nand with a second line"; $Query_Result = mysql_query("SELECT `EID`, `Email`, FROM `Emails_Main`") or die (mysql_error()); while ($CurrentRow = mysql_fetch_row($Query_Result)){ mail($CurrentRow[1], $Subject, $Message, "From: [EMAIL PROTECTED]\r\n"); } Hope this helps. Bronson_AT_udatasystems.com -Original Message- From: rolf vreijdenberger [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 3:53 PM To: [EMAIL PROTECTED] Subject: [PHP] Mail(): How much time? Hi, I am getting all my emailadresses for my mailinglist out of a database in a loop, and in that same loop I personalize the email by adding the name and a personal URL (script.php?email=youremail). In that loop I then send the email. This whole process takes about 0.5 to 2 seconds per adress. This seems quite long to me. It can't be the database query or the if conditions in the loop, so why is this taking so long?? I don't have any problems with script execution time as I increment it in every iteration. This is not a nice solution though. I am also wondering how many adresses you can put in one subject, Cc or Bcc field? thanks in advance -- Rolf Vreijdenberger De Pannekoek en De Kale Maystraat 6 2593 VW Den Haag T: 06-24245719 E: [EMAIL PROTECTED] W: www.depannekoekendekale.nl -- 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] JOIN for FREE ... Learn and Earn
Hello: My name is Charles Cedeno. I am now focusing in one online opportunity.I have tried several of these opportunities full of hype promising us thousands of dollars every month. I would get all excited and run to my family and friends with another "Great Money Maker ". It is a sad fact that many people who are in need of additional income, are being victimized by these fly by night scam artists. As a result of trying all these opportunities, I finally found the company which is true to their words. Not full of hype, but consistently send me the monthly check. They have given me the best compensation plan with their high % commission. I didn't have to perform some juggling act to maintain some 60 to 40% balance in my legs. It is not a pyramid, so there are no legs. It is not one of those binary compensation plan failures either. Everyone earns commissions here. They are providing a real service not the one that simply transfers wealth from the new signups to the people at the top. When you join, you will have a team of up line sponsors who will help you succeed every step of the way. Instead of being left alone, you will be guided step by step by real people, not those auto responders. Only you can make your own success together with the help of your sponsors. If you have 2 to 3 hours a day, you will be able to earn a full income in a few months. And there is absolutely no limit as to how much you can earn. It is designed to gain momentum after some time. But I prefer to avoid such statements as "You will get rich". I read it everywhere and will not allow myself to sound like them. I experienced it personally, you can be comfortable. To get your FREE membership ID, send email to [EMAIL PROTECTED] and put "REGISTER ME FOR FREE" in the subject and your full name in the body of your email. Also include the statement below in the body of your email. "By submitting a request for a FREE DHS Club membership I agree to receive emails from DHS Club for both their Consumer and Business Opportunities." I will then register you into the system. You will receive a confirmation email asking you to verify. Open it up and activate your free membership immediately. Then set back and watch as your new business explodes. Best regards, Charles Cedeno Note: You don't need to request for removal. This is a one-time email. Your email address will be automatically de-activated in our list if you don't respond to this mail. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date range assistance needed
Here is my current query: $qAnnouncement = 'SELECT id,headline FROM tbl_funding WHERE 1 AND ((UNIX_TIMESTAMP (datestamp) >= ' . strtotime($attributes[startdate]) . ') AND (UNIX_TIMESTAMP (datestamp) <= ' . strtotime($attributes[startdate]) . ')) LIMIT 0, 30'; Where datestamp is set in MySQL with a timestamp(14) and $attributes[startdate] and $attributes[enddate] are in the format mm/dd/ My query does not return any results. I know there must be something wrong, can anyone point it out? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dealing with dates
Hi all, I posted earlier with some date questions, but realized I could probably do better with my question presented as such. I need to save the time date and time of posting for the records in a table. I then need to be able to search via a startdate and enddate text field where the user will be entering the date ranges as mm/dd/. What is the best way to handle adding the date to the MySQL record, and also how to search for that date based on a range in the above stated format? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] inserting date() into MySQL
If I am going to use date('U') to insert an epoch timestamp into a mysql table, what is the appropriate field type to use? thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload and permissions
I have a form which uploads a file to my server. The files that are uploaded will be .doc files and will need to be able to be downloaded from a web page. My script works locally - I have tested it well files upload etc., but I am moving it to a commercial web server and am not sure what permissions should be set like for this directory. I have tried my script and gotten the files to upload but when the script tries to move them to the directory where I want to keep them I get a permission denied error. I have played with it - changing permissions and the only one that works is chmod 777 - not sure if this is good or not - pretty new to unix administration stuff. What do you all suggest? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Alias and PHP
Hi all, I have this query: SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id AND x.area_2 = b.id I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo the values for a.id and b.id? Thnks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Alias and PHP
Thanks for the help. Almost there. Here is what I have: SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b FROM tbl_funding x, tbl_dra a, tbl_dra b GROUP BY x.id LIMIT 0 , 30 The problem is that $array[area_a] and $array[area_b] display the same info. On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote: Hi all, I have this query: SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id AND x.area_2 = b.id I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo the values for a.id and b.id? Thnks Charles I presume you mean area_name... Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1 x, tbl_2 a, tbl_2 b Then you can refer to the columns as $array['area_a'] and $array['area_b'] HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Alias and PHP
Thanks for all the suggestions, I have tried all and more and still can't get this quite right. If there is a better forum for these question, please point me to it and I will take this somewhat off topic thread elsewhere. My table structure is like so: tbl_1 idarea_1area_2 1 2 3 2 1 2 3 5 0 tbl_2 id area_name 1 funding 2 research 3 new 4 ongoing 5 other So, I need to display all the records in tbl_1 and show the values for the fields area_1 and area_2 as their area_name field from tbl_2. I must display each record from tbl_1 only once. I know I am close, but I just can't get this to work. The closest I have gotten is this: SELECT DISTINCT a.area_name area_a, b.area_name area_b FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id OR x.area_2 = b.id GROUP BY x.id But this ALWAYS returns the area_name (funding) in the value of area_b (have no idea why) Thanks for any help. It is appreciated. - Charles On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote: Then the information in the DB is the same. Jim - Original Message ----- From: "Charles Kline" <[EMAIL PROTECTED]> To: "Rich Gray" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 07, 2003 10:03 AM Subject: Re: [PHP] MySQL Alias and PHP Thanks for the help. Almost there. Here is what I have: SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b FROM tbl_funding x, tbl_dra a, tbl_dra b GROUP BY x.id LIMIT 0 , 30 The problem is that $array[area_a] and $array[area_b] display the same info. On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote: Hi all, I have this query: SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id AND x.area_2 = b.id I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo the values for a.id and b.id? Thnks Charles I presume you mean area_name... Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1 x, tbl_2 a, tbl_2 b Then you can refer to the columns as $array['area_a'] and $array['area_b'] HTH Rich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL Alias and PHP
Wow. That is ALMOST it. The only thing is it does not return the record with a 0 in tbl_1.area_2 - can you think of a workaround? Thanks for the help, Charles On Friday, March 7, 2003, at 06:39 PM, Barajas, Arturo wrote: Let's see: SELECT tbl_1.area_1, areas1.area_name, tbl_1.area_2, areas2.area_name FROM tbl_1 INNER JOIN tbl_2 areas1 ON tbl_1.area_1 = areas1.id INNER JOIN tbl_2 areas2 ON tbl_1.area_2 = areas2.id Maybe if you tinker a little on the sentence. I don't have a place to test it right now. -- Un gran saludo/Big regards... Arturo Barajas, IT/Systems PPG MX (SJDR) (427) 271-9918, x448 -Original Message----- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Viernes, 07 de Marzo de 2003 04:09 p.m. To: Jim Lucas Cc: [EMAIL PROTECTED] Subject: Re: [PHP] MySQL Alias and PHP Thanks for all the suggestions, I have tried all and more and still can't get this quite right. If there is a better forum for these question, please point me to it and I will take this somewhat off topic thread elsewhere. My table structure is like so: tbl_1 idarea_1area_2 1 2 3 2 1 2 3 5 0 tbl_2 id area_name 1 funding 2 research 3 new 4 ongoing 5 other So, I need to display all the records in tbl_1 and show the values for the fields area_1 and area_2 as their area_name field from tbl_2. I must display each record from tbl_1 only once. I know I am close, but I just can't get this to work. The closest I have gotten is this: SELECT DISTINCT a.area_name area_a, b.area_name area_b FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id OR x.area_2 = b.id GROUP BY x.id But this ALWAYS returns the area_name (funding) in the value of area_b (have no idea why) Thanks for any help. It is appreciated. - Charles On Friday, March 7, 2003, at 01:42 PM, Jim Lucas wrote: Then the information in the DB is the same. Jim - Original Message - From: "Charles Kline" <[EMAIL PROTECTED]> To: "Rich Gray" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, March 07, 2003 10:03 AM Subject: Re: [PHP] MySQL Alias and PHP Thanks for the help. Almost there. Here is what I have: SELECT x.id, x.headline, x.description, a.area area_a, b.area area_b FROM tbl_funding x, tbl_dra a, tbl_dra b GROUP BY x.id LIMIT 0 , 30 The problem is that $array[area_a] and $array[area_b] display the same info. On Friday, March 7, 2003, at 11:09 AM, Rich Gray wrote: Hi all, I have this query: SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b WHERE x.area_1 = a.id AND x.area_2 = b.id I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo the values for a.id and b.id? Thnks Charles I presume you mean area_name... Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1 x, tbl_2 a, tbl_2 b Then you can refer to the columns as $array['area_a'] and $array['area_b'] HTH Rich -- 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 -- 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] file_exists() question
Can anyone tell me why this code does not return true when the file in the directory cherpdocs/ with the file (which I see as being there) does exist? if(file_exists('cherpdocs/$annrow[id].doc')){ echo "Funding details paper"; } This is a path relative to the file calling it, should it be otherwise? Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP with CGI WRAP
Can anyone point me to a good resource on how to run PHP with CGI Wrap? I am hosting a site that is under development at Pair networks and they have their own cgi-wrapper and I need to move this site to another server that probably does not have their own flavor of this. Any help would be appreciated. Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with string comparison
I am trying to get this sql query to work and am getting the error "Insufficient data supplied". Can anyone help with this? $sql = "SELECT id, concat(fname, ' ', lname, ' ', degree1) name FROM tbl_personnel "WHERE name LIKE \'%"; $sql .= $attributes['nametofind']; $sql .= "%\' ORDER BY lname ASC"; What I am trying to do is allow the user to find a personnel record that contains the name to find. Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with string comparison
On Thursday, March 13, 2003, at 05:08 PM, Ernest E Vogelsinger wrote: - if your query is exactly as you sent it here you're missing a comma after the closing bracket of "concat()", just before "name" name is supposed to be an alias for the concatenated values of fname,lname,mname. Let me try to say what I am trying to do. I have a table of people and have the names saved in fields: fname, lname, mname. I want to have a search field where the user can find a persons record by typing in all or part of their name. What would this kind of query look like? Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MySQL Full Text Search Problem
Hi all, My first try at MySQL Full Text Search and it is not behaving ;) Here is what I have for my query string: $sql = "SELECT id, concat(fname, ' ', lname, ' ', degree1) as name". " FROM tbl_personnel WHERE MATCH (fname,lname) AGAINST ('" . $attributes['searchstring'] . "')"; This works pretty good. The only problem is it only works if there is an exact match for either the first name (fname) or last name. For example. In tbl_personnel there are 5 people with the first name Christine. If I pass Chris to this query in $attributes['searchstring'] I get 0 results. If I pass Christine I get all 5. What do I need to modify to make this work? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie MySQL INSERT Q
Can I have a single SQL string do INSERTS into multiple tables? Like: sql="INSERT INTO tbl_1 (id, email_address_1) VALUES ($v_personid, '$v_email'); INSERT INTO tbl_2 (person_id, interest_id) VALUES ($v_personid, $v_int1);"; Or do I need to break them up and use two of these? $result = $db->query($sql) Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to convert an array to variables?
Hi all, I have an array that gives me this when I do: print_r($my_array); Array ( [0] => Array ( [dra_id] => 5 ) [1] => Array ( [dra_id] => 8 ) [2] => Array ( [dra_id] => 9 ) ) using a foreach() I want to create a variable with a unique incremental name for each of the values. for example: $dra_1 = 5; $dra_2 = 8; $dra_3 = 9; How would I do this? A variable that has a variable name based on a counter in the loop? Not sure the syntax for that. Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP User Groups
Hi all, Is or has anyone here been part of or started a PHP user group? I am thinking it would be a great thing to get started in my area (maybe one already exists?) and I was looking for suggestions on how to go about it and things to know before getting started, etc. BTW. I live in Southern New Jersey (USA) Please feel free to contact me off list. Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to convert an array to variables?
Tom, This seems like what I need exactly, but I am having a bit of trouble getting it to work. Here is how I have worked around this, but I know there is a 'real' way to do this. Any thoughts? I had to set the variables, or should I just use the variables as ${dra_0} etc.? // get the values for the default dra from array while(list($key,$val) = each($r_p_dras)){ $n = "dra_$key"; echo $n; $$n = $val['dra_id']; } $dra_a = "${dra_0}"; $dra_b = "${dra_1}"; $dra_c = "${dra_2}"; $dra_d = "${dra_3}"; $dra_e = "${dra_4}"; On Saturday, March 15, 2003, at 02:08 PM, Tom Rogers wrote: Hi, Sunday, March 16, 2003, 4:52:10 AM, you wrote: CK> Hi all, CK> I have an array that gives me this when I do: CK> print_r($my_array); CK> Array CK> ( CK> [0] => Array CK> ( CK> [dra_id] => 5 CK> ) CK> [1] => Array CK> ( CK> [dra_id] => 8 CK> ) CK> [2] => Array CK> ( CK> [dra_id] => 9 CK> ) CK> ) CK> using a foreach() I want to create a variable with a unique incremental CK> name for each of the values. CK> for example: CK> $dra_1 = 5; CK> $dra_2 = 8; CK> $dra_3 = 9; CK> How would I do this? A variable that has a variable name based on a CK> counter in the loop? Not sure the syntax for that. CK> Thanks CK> Charles something like this... while(list($key,$val) = each($my_array)){ $n = 'dra_'.$key+1; $$n = $val['dra_id']; } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload Stuff ... well kinda.
Check the permissions on the directory you are trying to upload your files. The host I am using required me to either chmod the upload directory to 777 (not what I wanted to do) or run PHP with cgi-wrap enabled - this allowed my PHP application to run as the user and therefore had permission to write to a directory. Check with the host on this. - Charles On Saturday, March 15, 2003, at 09:53 PM, Philip J. Newman wrote: RIghto then. Just make a nice website, on my windows box and everything and when i moved it to the live server, the things that didn't work where file uploads. What (if any) settings do i have to use for a Linux dir .. to allow access for the file to be uploaded? -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- Friends are like stars You can't allways see them, but they are always there. -- Websites: PhilipNZ.com - Design. http://www.philipnz.com/ [EMAIL PROTECTED] Philip's Domain // Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Vital Kiwi / NEWMAN.NET.NZ. http://www.newman.net.nz/ [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
Re: [PHP] building a large-scale application using oop
Not sure how to answer your question as I am real new to PHP, but you may want to look at PEAR if you have not done so. I know there are libraries that folks have been talking about recently that handle just these sorts of things. If you don't use them - you may find your answers by looking at the sources. - Charles On Sunday, March 16, 2003, at 12:57 PM, [EMAIL PROTECTED] wrote: Hi, I am currently working on transforming a rather large software package to oop. I do have a few years of experience with php, but just started to use oop. One of the first question that arose was how to handle configuration vars. These should ideally be stored in a file: $db_user = "user"; $db_password ="secret"; etc. ?> Now, I have to access these vars from a class. class database { var $db_user; var $db_password; function connect() { } } What is the best way to access these variables? I want to avoid global vars. I also don't like to set the vars using $object->db_user = $db_user; every time I use it. Also, is there any large open-source php - application which could serve as an example of best practice? best regards, Raul -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage! -- 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 & MS Exchange Server problem
Hello All--- I'm having some trouble getting PHP to communicate with my Windows 2000 MS Exchange Server... I'm running PHP 4.3.2 on a Win2000 machine serving with Apache 1.3. The code I'm using is: $mbox = imap_open("{x.x.x.x:143}","admin","adminpass", OP_HALFOPEN); $err = imap_errors(); while (list($key, $val) = each($err)) print imap_utf7_decode($val)."\n"; $alrt = imap_alerts(); while (list($key, $val) = each($alrt)) print imap_utf7_decode($val)."\n"; This yields the error: Warning: imap_open(): Couldn't open stream {x.x.x.x:143} in c:\apache\apache\htdocs\sdimail.php on line 11 Connection refused If I change the imap_open command to use {x.x.x.x:143\} as the host, I get a different error: Warning: imap_open(): Couldn't open stream {x.x.x.x:143\} in c:\apache\apache\htdocs\sdimail.php on line 11 Can't open mailbox {192.168.0.3:143\}: invalid remote specification which makes me suspect that I am actually able to connect but PHP isn't finding anything it likes (what is it looking for?) can anyone help me with this or at least point me towards a tutorial on using PHP with MS Exchange? Thanks in advance for your help, -Charlie [EMAIL PROTECTED]
Re: [PHP] File System
On Monday, March 17, 2003, at 12:58 AM, Philip J. Newman wrote: How do i delete a file ... ? kill?? dele *srugs* -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- 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] File System
$result = unlink("file.txt") or die("Operation failed!'); On Monday, March 17, 2003, at 12:58 AM, Philip J. Newman wrote: How do i delete a file ... ? kill?? dele *srugs* -- Philip J. Newman. Head Developer [EMAIL PROTECTED] +64 (9) 576 9491 +64 021-048-3999 -- 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] stripping slashes before insert behaving badly
Hi all, I am inserting data from a form into a mySQL database. I am using addslashes to escape things like ' in the data input (this is actually being done in PEAR (HTML_QuickForm). The weird thing is that the data gets written into the table like: what\'s your problem? WITH the slash. I am not sure what to modify to fix this so the literal slash is not written. Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re: variables with ""
php has a function stripslashes() you could try using. - charles On Monday, March 17, 2003, at 10:11 AM, Ian A. Gray wrote: Using the \ or using single quotes instead of double is great. However I am now finding a problem if someone inputs either single or double quotes on a form which uses php. The user inputs for example: I\ve performed many roles including "Figaro", "Dandini" and 'Wotan' becomes: I\'ve performed many roles including \"Figaro\", \"Dandini\" and \'Wotan\' Is there a simple way of getting rid of the annoying backslash(\) from a the contents of a variable? Many thanks, Ian Gray = - Ian A. Gray Manchester, UK Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: +44 (0) 7900 996 328 US Fax no.: 707-885-3582 E-mail: [EMAIL PROTECTED] - Websites: www.baritone.uk.com (performance) & www.vocalstudio.co.uk (Tuition) - __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripping slashes before insert behaving badly
John, You are right, something was adding the additional slash. I removed the addslashes() and it fixed the problem. Something I am doing must already be handling that... will step through the code AGAIN and see if I can find it. - Charles On Monday, March 17, 2003, at 12:19 PM, John W. Holmes wrote: I am inserting data from a form into a mySQL database. I am using addslashes to escape things like ' in the data input (this is actually being done in PEAR (HTML_QuickForm). The weird thing is that the data gets written into the table like: what\'s your problem? WITH the slash. I am not sure what to modify to fix this so the literal slash is not written. You're running addslashes() twice, somehow. Magic_quotes_gpc is probably on and you're escaping the data again. I would think PEAR would account for that, but I guess not. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is the difference: include()
What is the difference as in... why one or the other? include('somefile.php'); include("somefile.php"); Just wondering... - ck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the difference: include()
perfect. thanks for the explanation. cheers, charles On Monday, March 17, 2003, at 02:01 PM, Pete James wrote: Only that you can embed vars in the second one. if $foo='bar'; include('somefile_{$foo}'); will include the file 'somefile{$foo}', where include("somefile_{$foo}"); will include the file 'somefile_bar' HTH. Charles Kline wrote: What is the difference as in... why one or the other? include('somefile.php'); include("somefile.php"); Just wondering... - ck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strstr() question
What is the expected return when using strtr() to compare a string to an empty string? example: $myval = strstr('bob', ''); Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Does PHP run better under any specific unix os?
Just wondering. I am trying to decide whether to build a FreeBSD server or other... open to suggestions Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anybody have any thoughts on Smarty?
Was reading this and it sounds really cool. I do work as a consultant to designers and thought this may be a good way to improve work flow? I have read mixed thoughts on this, but was wondering what this list thought? Anyone using it? Real world? http://www.zend.com/zend/tut/tutorial-cezar.php Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date question
Hi all, I have a form where users will be adding publication dates for uploaded files. I want to store the date in mySQL as date('U') format. If the date is entered as mm/dd/ - will the date function know this or is there some way of 'telling' php how the date to be converted is formatted, if you all get what I am saying... Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php, mysql, and method question
hi all, i have a question about a good method of handling this challenge. i have a table that contains articles. i have another table which contains the order 1 - 9 that i would like to display them in. this part is done, and is not a problem. here is where I am not sure how to proceed. 1. tbl_display_order - can only have 9 records in it (or do i just ignore anything beyond 9?) 2. when a new article is added to tbl_display_order - it needs to get the field that contains it's order set to 1 so it shows up first when I display the articles, and all the other articles need to have their order number incremented. Maybe there is a better way to do this? Just not sure. Maybe not with a database at all? Thanks for suggestions. Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] To use PEAR::DB or the PHP database functions
Pear is really nice. I am very happy with it. - Charles On Thursday, March 20, 2003, at 02:56 PM, Merritt, Dave wrote: All, I've always used MySQL databases and the MySQL functions in PHP for my code in the past. However, I'm now working on a project that I want the project to be able to be database independent so that the user of the project can use whatever database he/she wishes. I'm looking primarily at providing support for MySQL, PostgreSQL, Oracle, & SQL Server databases. What's the general consensus on how to handle this? Do I need to look at using PEAR::DB so that the type of database is "hidden" from my code or would I look at writing different include files for each database type and each of the include files use the relevant PHP functions? Or some other totally different way? Thanks Dave Merritt [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
Re: [PHP] Validation of Numeric string sent in a form
is_numeric(yoursting); this returns true if string is a number On Thursday, March 20, 2003, at 08:32 PM, Orlando Pozo wrote: Hello all, I am Orlando Pozo How could I verify if a variable is a "Numeric string"? , I need help in this; for example when I submit a form, all texts fields are sent in strings, if you need to verify that the string is all numeric, How could I verify?, thanks for your help. - Do You Yahoo!? Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo. Visíta Yahoo! Noticias. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing results from mySQL query
Hi everyone, I have ALMOST gotten this working (mySQL part works). I have gotten the advice that this is easier to do in PHP then to try and make this query work in mySQL. Here is the query and a sampling of the current results (from phpMyAdmin) SELECT p.fname, p.lname, w.web_link, a.dra_id, dra.area, t.title FROM tbl_personnel p LEFT JOIN tbl_personnel_weblinks w ON p.id = w.person_id LEFT JOIN tbl_personnel_dras a ON p.id = a.person_id LEFT JOIN tbl_dra dra ON a.dra_id = dra.id LEFT JOIN tbl_personnel_titles t ON p.id = t.person_id; Because some of these people have multiple records in tbl_personnel_dras AND in tbl_personnel_titles - I get many repeats of each person (one for every combo). I was told this would be really messy to deal with in SQL (though I am open) - but I have no idea where to start in PHP. I would like to display the data to the web like: fname lname title(s) - (this would be the list of titles for this person) Areas: area, area, area (this would be the list of areas in one place as opposed to making the record repeat) Thank you for any help. The above query returns something like this (the first set are the column names): fname lname web_link dra_id area title Jeffrey Whittle NULL NULL NULL Investigator Jeffrey Whittle NULL NULL NULL Staff Physician Adam Gordon NULL 5 Mental Illness Staff Physician Adam Gordon NULL 5 Mental Illness Assistant Professor of Medicine Adam Gordon NULL 5 Mental Illness Investigator, VISN4 Mental Illness Research, Educa... Adam Gordon NULL 5 Mental Illness Investigator, Center for Research on Health Care Adam Gordon NULL 5 Mental Illness Investigator Adam Gordon NULL 8 Special (Underserved, High Risk) Populations Staff Physician Adam Gordon NULL 8 Special (Underserved, High Risk) Populations Assistant Professor of Medicine Adam Gordon NULL 8 Special (Underserved, High Risk) Populations Investigator, VISN4 Mental Illness Research, Educa... Adam Gordon NULL 8 Special (Underserved, High Risk) Populations Investigator, Center for Research on Health Care Adam Gordon NULL 8 Special (Underserved, High Risk) Populations Investigator -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] prepare() and execute()
hi Could anyone give me an example of a prepare() and execute() that retrieves a simple dataset as an associative array and then prints it to the screen? I can only seem to find examples that do an INSERT and I am having trouble doing the translation. Thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic Form
If the page does not submit between changes, PHP will not be much help, that would be JavaScript's job. You could use PHP to prepare the arrays that JavaScript will use to accomplish this. - Charles On Monday, March 24, 2003, at 11:32 AM, Keven Jones wrote: Hi, Can someone tell me if I can use php to accomplish the following: I would like to create a form that can: A. Total the sum of a certain number of numerical fields, Before the user clicks submit B. Automatically fill in sections of a form based on selections made by the user. As an example, if my user selects option A, then a certain numerical code is filled into a given section of the form. We are just trying to make the forms user friendly. Can I do this in php or will it require javascript as well? Thanks _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- 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] formatting textarea input on output
hi all, i have a textarea in a form which gets inserted into a table in my database (mySQL). When displaying this text back to the screen, how do i retain the line breaks etc. that were in the original input? thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and phpMyAdmin Issues
I am by no means an expert (even remotely) but I do recall instructions on exactly how to do this in the documentation for MySQL - I think under the "how to upgrade" section. - Charles On Monday, March 3, 2003, at 06:53 PM, Stephen Craton wrote: Hello, Yesturday I made a big mistake. I had to import a 60MB file into a database and I used ssh. I'm very unfamiliar with it and when I connected to the MySQL connection thing, I forgot to switch databases when I imported. This overwrite (I don't know why but it did) the users table in the mysql database and caused everything to get messy. For some reason, though, the sites on the server are still working with their old MySQL username and password (I'm not sure why since I imported a fresh install's mysql database from my local server). Everything seems to be working except phpMyAdmin. When I try logging in using the default user as root and password as nothing, it gives me an access denied error. It does this for every user we had in the database as well. Is there anyway I can fix this is ssh? The only option I can think of is reinstalling MySQL but even then we'll loose all the old databases and I'm not sure how to export the tables to a file in ssh. Any help here would be most obliging and I need a reply rather urgently in order to allow my hosted sites access to phpMyAdmin once again... Thanks, Stephen Craton http://www.melchior.us -- 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] formatting textarea input on output
I hang my head in shame... yes. As a matter of fact, I did on my second skim through my PHP ref. manual... thanks for the pointer just the same. - charles On Tuesday, March 25, 2003, at 05:38 PM, CPT John W. Holmes wrote: i have a textarea in a form which gets inserted into a table in my database (mySQL). When displaying this text back to the screen, how do i retain the line breaks etc. that were in the original input? I bet if you searched for "textarea" and "line breaks" you'd of found the nl2br() function... but I'm not a betting man... unless there's money involved... and beer. ---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
[PHP] html_quickform - array question
hi all, using html_quickform (pear) and it has a date type that passes the date info like this: array(24) { ["lr_pub_date"]=> array(3) { ["m"]=> string(1) "3" ["d"]=> string(2) "12" ["Y"]=> string(4) "2003" } I am used to getting this data like: $form->getSubmitValue("field_name"); But doing that with this array just returns: Array Anyone know how to get to the data? Thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html_quickform - array question
Okay. I think I understand. So I do something like this: $thedate = $lr_form->getSubmitValue('lr_pub_date'); echo "The month: $thedate['m']"; Is that what you meant? - Charles On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote: Are you trying to print/echo it? That converts it to a string first. Either print_r it, var_dump it, or do something else with it. Charles Kline wrote: hi all, using html_quickform (pear) and it has a date type that passes the date info like this: array(24) { ["lr_pub_date"]=> array(3) { ["m"]=> string(1) "3" ["d"]=> string(2) "12" ["Y"]=> string(4) "2003" } I am used to getting this data like: $form->getSubmitValue("field_name"); But doing that with this array just returns: Array Anyone know how to get to the data? Thanks charles -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] html_quickform - array question
Great. Thanks. - Charles On Wednesday, March 26, 2003, at 09:48 PM, Leif K-Brooks wrote: Yes, but you can't put put the single quoted array key directly in the double-quotes string, try: $thedate = $lr_form->getSubmitValue('lr_pub_date'); echo "The month: {$thedate['m']}"; Charles Kline wrote: Okay. I think I understand. So I do something like this: $thedate = $lr_form->getSubmitValue('lr_pub_date'); echo "The month: $thedate['m']"; Is that what you meant? - Charles On Wednesday, March 26, 2003, at 09:31 PM, Leif K-Brooks wrote: Are you trying to print/echo it? That converts it to a string first. Either print_r it, var_dump it, or do something else with it. Charles Kline wrote: hi all, using html_quickform (pear) and it has a date type that passes the date info like this: array(24) { ["lr_pub_date"]=> array(3) { ["m"]=> string(1) "3" ["d"]=> string(2) "12" ["Y"]=> string(4) "2003" } I am used to getting this data like: $form->getSubmitValue("field_name"); But doing that with this array just returns: Array Anyone know how to get to the data? Thanks charles -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date math question
I am storing my dates as unix timestamp (epoch). Am I right in assuming that if I need to add or subtract days from this it is done in seconds? So for example if I have the timestamp 1041397200 and I wanted to subtract 24 hours from it I would do this: $newtime = $orig_time - 86400; Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date math question
Okay cool. This leads me to another question. If I have stored the date as an epoch then is there a way using PHP and MySQL to say find all the records that have been added this YEAR (not last 365 days)? Thanks Charles On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote: On March 27, 2003 09:15 pm, Charles Kline wrote: I am storing my dates as unix timestamp (epoch). Am I right in assuming that if I need to add or subtract days from this it is done in seconds? yes -- 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] date math question
Caught that :) Thanks for the tip... worked just perfect (after I fixed typo) On Friday, March 28, 2003, at 12:57 AM, Foong wrote: sorry typo error should be: date('Y') Foong "Foong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] hi, $start = mktime ( 0, 0, 0, 1, 1, date['Y']); // first day of this year $end = mktime ( 0, 0, 0, 12, 31, date['Y']); // last day of this year then select all record where timestamp >= $start and timestamp <= $end should do the job Hope this helps Foong "Charles Kline" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Okay cool. This leads me to another question. If I have stored the date as an epoch then is there a way using PHP and MySQL to say find all the records that have been added this YEAR (not last 365 days)? Thanks Charles On Friday, March 28, 2003, at 12:31 AM, Leo Spalteholz wrote: On March 27, 2003 09:15 pm, Charles Kline wrote: I am storing my dates as unix timestamp (epoch). Am I right in assuming that if I need to add or subtract days from this it is done in seconds? yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validate MySQL date
try the checkdate() function. i think that will do what you need. On Monday, March 31, 2003, at 11:06 PM, Ben C. wrote: How do I easily check to see if a MySQL formatted date is valid such as if a user enters 2003/02/28 would return true 2003/02/31 would return false I have check the manual and other resources but can't come up with anything. --- --- The content of this email message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. -- 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] getting values from objects
hi there, if this: $res_pform->getSubmitValue("investigator5"); returns an array, how do I get to the individual values in that array without first setting it to a variable like: $myvar = $res_pform->getSubmitValue("investigator5"); echo $myvar['field']; thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting values from objects
My objective was to try and NOT use a temporary variable. for example I can do this: foreach ($res_pform->getSubmitValue("investigator5") AS $k=>$v){ echo $k . ""; } I was just wondering in other circumstances, how I can maybe just get to the value of one of the keys without setting it first to a variable (which is the only way I know how to now). Thanks, Charles On Tuesday, April 1, 2003, at 03:18 PM, Dan Joseph wrote: Have you tried: extract ($myvar = $res_pform->getSubmitValue("investigator5")); -Dan Joseph -Original Message- From: Charles Kline [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 2:58 PM To: [EMAIL PROTECTED] Subject: [PHP] getting values from objects hi there, if this: $res_pform->getSubmitValue("investigator5"); returns an array, how do I get to the individual values in that array without first setting it to a variable like: $myvar = $res_pform->getSubmitValue("investigator5"); echo $myvar['field']; thanks charles -- 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] When to use a text file rather then a database
Hello all, I have a text blurb that is on the home page of a site. I need to make this block of text editable through a form in the admin section of the site. Is it worth having a table in the db or would I be better off writing to a file for this? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading a file into variable for using in a javascript
Hi all, I am reading the content of a text file into a variable to be used in a javascript. I am reworking some code that was originally done using ColdFusion and the jsStringFormat(var) function. What is the PHP equivalent string function? Is there one? I have searched the docs, but can't figure out which to use. Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stripping newlines from a string
Hi all, How would i go about stripping all newlines from a string? Thanks, Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stripping newlines from a string
Yes. Is weird. I thought this would work too, but for some reason it was not removing them all. I wonder if re-saving the files with UNIX linebreaks (or try DOS) would have any effect. Will report back. - Charles On Monday, June 9, 2003, at 02:24 AM, Joe Pemberton wrote: http://www.php.net/str_replace $newstr = str_replace("\n", "", $oldstr); - Original Message - From: "Charles Kline" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, June 08, 2003 10:44 PM Subject: [PHP] stripping newlines from a string Hi all, How would i go about stripping all newlines from a string? Thanks, Charles -- 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] Can I perform a PHP script from a form but stay on the same page afterwards?
Check out Liz Fulgham article on PHP and Forms ->> http://softwaredev.earthweb.com/script/article/0,,12063_996351,00.html It show how the _SERVER fuction/varible is used. Cheers CJ Jim Dam wrote: > http://www.faqts.com/knowledge_base/view.phtml/aid/235/fid/17 > - Original Message - > From: "php @ banana" <[EMAIL PROTECTED]> > To: "PHP-GENERAL" <[EMAIL PROTECTED]> > Sent: Friday, August 09, 2002 5:51 PM > Subject: Re: [PHP] Can I perform a PHP script from a form but stay on the > same page afterwards? > > >You can send a 204 No Content header, and the browser won't move to the new > >page, but instead the PHP script will be executed and the browser will stay > >on the same page. > > could you gimmie a code snippet of the above > > Thanks > > R> > > > > >Jim Dam > >[EMAIL PROTECTED] > > > > > >- Original Message - > >From: "César Aracena" <[EMAIL PROTECTED]> > >To: "'DonPro'" <[EMAIL PROTECTED]>; "'php list'" > <[EMAIL PROTECTED]> > >Sent: Friday, August 09, 2002 4:53 PM > >Subject: RE: [PHP] Can I perform a PHP script from a form but stay on the > >same page afterwards? > > > > > >> > -Original Message- > >> > From: DonPro [mailto:[EMAIL PROTECTED]] > >> > Sent: Friday, August 09, 2002 5:34 PM > >> > To: php list > >> > Subject: [PHP] Can I perform a PHP script from a form but stay on the > >> same > >> > page afterwards? > >> > > >> > Hi, > >> > > >> > I have a form where the user can change a value ion a text box and > >> then > >> > click on a button which will update a table in a MySQL database. I > >> assume > >> > that the only way to do this is to have the button POST the form value > >> to > >> > my > >> > script which updates the MySQL table. > >> > > >> > However, once updated (whether the update is successfull or not), I > >> need > >> > to > >> > remain or return to the same page that the form is on. > >> > > >> > Can this easily be done? > >> > > >> > > >> [Cesar Aracena] > >> > >> Sure. All you have to do is point the form's action to $PHP_SELF and the > >> play a little with the *IF* and *ELSE IF* statements. > >> > >> > > >> > -- > >> > 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 > > > > --__-__-__ > eat pasta > type fasta > > -- > 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] How can I strip the code from HTML pages to extract the contents of a HTML page.
This may be an interesting challenge for someone or has it been done before Can some one help me. I am looking for a laboursaving method of extracting the contents of a web page (Text only) and dumping the rest of the html code. I need the contents to rework the pages and put the contents into flat file database. Large but only two columns of data. Simple to work with (no need for DB) - They are just alot of links on a links page. Scripts would be welcome. Ciao, Carlos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I strip the code from HTML pages to extract thecontents of a HTML page.
I was looking into stripping HTML files that contain alot of links. I was trying to avoid the manual way of data entry. The contents i need are the name of the link (plain text which sits out side the HTML code) and all the a href tags. I would like the a href (ie.the hyperlink) tags to be displayed on the HTML output as plain text. All other HTML tags would be kept in place. The reason why I am doing this is that I am placing a link's name and the http:// link in to flat files, where they can be updated just by appending to them. The srcipt that I have does the rest. I have looked into the functions suggested but do find the concepts and use of the opperators to strip the HTML involved esoteric and tricky. ¬¬Chuck¬¬ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] and or statement
PHP and MYSQL Web Development manual by Welling and Thompson states that logical operators are as follows: ___ Operator Name Use Result ___ ! NOT !$b Returns true if $b is false and vice versa && AND $a && $b Returns true if both $ a and $b are true; otherwise false | | OR $a | | $b Returns true if either $ a or $b are true; otherwise false and AND $a and $b Same as && but with lower precedence or OR $a or $b Same as | | but with lower precedence ___ Just wanted to touch on the matter of the little fact that " and " and " or " can be used in PHP but the order of precedence. Hope this is helpful ¬¬Chuck¬¬ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] zip/zziplib segfaults
Hi I've searched the archives but cannot find any answers to this problem. Red Hat 7.2 php-4.1.2-7.2.4 or php-4.1.2-7.3.4 zziplib-0.10.66 I rebuilt php with --with-zip. However a simple cli test program that does a zip_open then attempts a zip_read, gets a segmentation fault on the zip_read (or even a zip_close immediately after the open). Can anyone shed some light on how to get zip support working? I'm working on getting a backtrace right now. thanks charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Processing current file
Hello, I'm a PHP newbie who needs to serve a custom file format and turn it into valid XHTML. I can imagine someone using a similar technique to remove all comments from HTML files as they're being served, etc. I've configured Apache so that it assigns the file extension to PHP and prepends PHP code to create a pageServer object and call its render method. So far, so good. Now I need to process the file (minus the prepended PHP), and deliver the XHTML result rather than the original file. I'm thinking that there must be an easy way to do this, and would appreciate any tips. Thank you, -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Plug-in strategies?
Hello, Does anyone know of articles that discuss best practices for supporting plug-ins? I searched for a while, but there doesn't seem to be anything out there. -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Plug-in strategies?
Manuel Lemos wrote... >> Does anyone know of articles that discuss best practices for supporting >> plug-ins? I searched for a while, but there doesn't seem to be anything out >> there. > > Use a base class to implement the common plugin API (generalization)... > You may want to take a look at Metabase... > You may also want to look into MetaL... Thank you for the advice and pointers! :^) -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML to MS Word
Justin French wrote... > I'd say RTF is a format you're going to be able to come to grips with > quicker than .doc -- just take a look at the source of a word doc -- it's > pretty obscure!!! And proprietary, and soon to be obsolete. But Office 11 files will be XML files. -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML to MS Word
Manuel Lemos wrote... >>> I'd say RTF is a format you're going to be able to come to grips with >>> quicker than .doc -- just take a look at the source of a word doc -- it's >>> pretty obscure!!! >> >> And proprietary, and soon to be obsolete. But Office 11 files will be XML >> files. > > RTF is not a closed format. (I was talking about Office's native .doc format, not the .rtf file format.) -- Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.2.3 compile problem on OSX
Kristopher Yates wrote... > I'm trying to compile PHP4.2.3 for Mac OSX 10.2 (Jaguar). Has anyone else had > this problem (see below)? Yes, seemingly. You can get 4.2.3 at <http://www.entropy.ch/software/ macosx/php/>, and this page also comments on build problems and build instructions on the Stepwise site. Mac OS X also comes with PHP pre-installed, although I'm not sure what version. -- Charles Wiltgen PlaybackTime <http://PlaybackTime.com/> - Great new QuickTime 6 book - Even pirates need parrots - Nokia's 6 new phones: All color, all MMS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen() with permissions?
Hello, There doesn't seem to be a way to fopen() with permissions. Someone commenting on the PHP manual suggested writing a file via FTP (which would allow me to specify a user name and password). Is this a reasonable thing to do? My plan is to create empty files via FTP, and then fopen($thefile, "r")-ing from there (since I think that will be faster than sending everything through an FTP server). Any feedback is appreciated, -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Marco Tabini wrote... > If you're using Apache, have you considered suexec? You can write an external > script that takes care of that. My hosting provider (DreamHost) uses suexec. My understanding is that this lets you run CGI scripts as another user, but I'm not sure how I could take advantage of this since my code isn't run by users per se. I'm building something that I hope lots of people will use, and the challenge is that it needs to "just work" on almost any system that supports PHP because the audience is, well, not going to know anything -- the ones that'll have access to a command line won't generally know how to use it. If I could chmod 777 the directory for a millisecond, the file could get created/written fine and then everything would work fine from then on out because the file has the correct permissions. But in the notes for chmod, it sounds like lots of hosting providers disable this (which kinda rules it out). I will have the users' FTP user name/password, which is why I was thinking of creating files via FTP. But speed is important, so this seems like more of a "last resort" strategy. I'm stumped. Many thanks for the response, and I appreciate any additional thoughts. -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Hello, Well, I'm able to make an empty file with fopen("ftp://username:password@;domain.com/folder/file.prefs", "w") However, I'm still nowhere because this file belongs to the user and her group, not to Apache, so I still can't write to it. Here's what I have to work with: -- I have the user's FTP username and password, which is necessary to install the software. -- The provider does not allow the backticks (``) operator, system(), exec(), passthru() or dl() for security reasons, and I assume this is the case with most people's service providers. I'm starting to think that PHP, although a great choice for anything but in-house software, may not be the right choice for a product aimed at non- technical people. Is there a PHPriest in the house? -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Marco Tabini wrote... > I'm not much of a PHPriest, but I love PHP because it's the first web > scripting language that I have encountered that actually make sense, is > coincise and very powerful. Yes, I'm a big fan. I was going to do this in .NET, which I'm more familiar with <http://wiltgen.net/articles/dotnet/>, but I've developed a crush on PHP. > It's the old question--do we make computers dumber or users smarter? :-) What, no "make computers smarter" option? :O) Seriously, if this was for people who knew what a shell prompt was, I would've gone with putting the burden on the user. -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Ernest E Vogelsinger wrote... > Why don't you do it this way: > > $fp = fopen("ftp://username:password@;domain.com/folder/file.prefs", "w"); > fwrite($fp, 'Some content', 12); > fclose($fp); > > I don't see a reason why you shouldn't directly use the file handle > returned by fopen - that's why the PHP god has created it :) A very good point, and this will work for me. I mentioned in my first note that I'm afraid that this is about 1,000 times slower than creating/writing a "local" file, but I don't see that I have an option. Thank you! -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Ernest E Vogelsinger wrote... > $fp = ftp_connect("$ftphost"); > if ($fp) { > $login = ftp_login ($fp, $user, $pass); > ftp_delete ($fp, $ftpfile); > ftp_quit($fp); > } > else die('Cannot connect to FTP'); So, DreamHost doesn't appear to have compiled PHP with FTP support. Can anyone recommend a great FTP class? (I'm not exciting about doing this via sockets, but I will if I have to...) Thanks! -- Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Ernest E Vogelsinger wrote... >> So, DreamHost doesn't appear to have compiled PHP with FTP support. Can >> anyone recommend a great FTP class? (I'm not exciting about doing this via >> sockets, but I will if I have to...) > > Would curl be an option? Do they have this? You could, however, always write a > tempfile, then exec your ftp client for a transfer... No curl, no exec. :^) I'm using sockets, and everything working except I can't CD to a directory with a period in it (which is, of course, what I need to do). Does I need to escapte this somehow for fputs()? -- Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen() with permissions?
Charles Wiltgen wrote... > I'm using sockets, and everything working except I can't CD to a directory > with a period in it (which is, of course, what I need to do). Does I need to > escapte this somehow for fputs()? Sorry, I'm an idiot...I went back to the FTP RFC and everything's working fine. -- Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Running functions as other than nobody
Marco Tabini wrote... >> I need to chmod files which are owned by a nother user than nobody with a >> php script runing from a browser. >> >> lets say i have a file called image.gif and I want to chmod(imgage.gif, >> 0777); and I want to run it as user: myuser with passwd: passwd. >> >> Can I do this? > > There was actually a brief thread about this last night. If you're using > Apache, you could look into suexec--this may or may not be a possibility > depending on the degree of control that you have on your server. The short answer is "no". My provider uses suexec, but that just means that Apache and its processes run as (in my case) "dhapache" instead of "nobody", putting you in the same boat with the same paddle. I'm not sure why PHP doesn't let you fopen() with a user name and password. It seems obvious, so I assume there are technical issues that prevent this from happening. My solution (for now) was to use FTP, since I will have the user's FTP username/password. Worse, I can't depend on the FTP commands (my provider's PHP doesn't have them), so I'm using fsockopen() to "speak FTP" to do things like delete files I've created with fopen(). This is far slower and more error-prone, and I'm very, VERY interested in other portable solutions. Please post whatever you find about this to the list, and I'll do the same. -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File locking problem
Hello, I'm having file locking problems. I'm using fopen() to write a file via FTP. At the end, I'm doing... fflush($fp); fclose($fp); ...and then I include it immediately after. But many times I only get part of what I wrote to the file, which suggests that it wasn't really flushed and closed properly. What else can I do? Thanks, -- Charles Wiltgen "Well, once again my friend, we find that science is a two-headed beast. One head is nice, it gives us aspirin and other modern conveniences... but the other head of science is bad! Oh beware the other head of science...it bites!" -- The Tick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking problem
Marco Tabini wrote... > Just a (possibly stupid) suggestion--is it possible that the file is being > overwritten by another instance of your script that's run in the meantime? This may also be a problem at some point, but currently I'm just trying to get it working in an test environment where only one instance is running. I know I can just use another empty file as a semaphore, but my performance is already killed by having to use FTP to create and delete files with PHP, and I need to do whatever I can do avoid it. Basically, it appears that using fflush() and fclose() is no guarantee that a file is completely written, and I'm wondering what I can do besides insert sleep() statements. -- Charles Wiltgen "Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come." - Nietzsche (Groening) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delete a file via FTP (without PHP FTP support)
// Delete a file via FTP function deleteFileViaFTP($ftpServer, $user, $password, $ftpDir, $ftpFile) { $error = FALSE; // Open connection to FTP port $ftp = fsockopen($ftpServer,21); $foo = fgets($ftp); if (!ereg("^220*", $foo)) { $error = "*** Error! FTP service not ready ***\r\n"; } // Submit user name and password fputs($ftp,"USER $user\r\n"); $foo = fgets($ftp); if (!ereg("^331*", $foo)) { $error = "*** Error! USER commend unsuccessful ***\r\n"; } fputs($ftp,"PASS $password\r\n"); $foo = fgets($ftp); if (!ereg("^230*", $foo)) { $error = "*** Error! PASS command unsuccessful ***\r\n"; } // Change to the proper directory fputs($ftp,"CWD $ftpDir\r\n"); $foo = fgets($ftp); if (!ereg("^250*", $foo)) { $error = "*** Error! CWD command unsuccessful ***\r\n"; } // Delete the file fputs($ftp,"DELE $ftpFile\r\n"); $foo = fgets($ftp); if (!ereg("^250*", $foo)) { $error = "*** Error! DELEte command unsuccessful\r\n"; } // Wrap it up fputs($ftp,"QUIT\r\n"); $foo = fgets($ftp); if (!ereg("^221*", $foo)) { $error = "*** Error! FTP service closed abnormally *** \r\n"; } fclose($ftp); // Return TRUE if the file has been deleted $fileUri = "ftp://$user:$password@;$ftpServer/$ftpDir/$ftpFile"; $fp = @fopen($fileUri, "r"); if (!$fp) { return TRUE; } else { return FALSE; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delete a file via FTP (without PHP FTP support)
Ernest E Vogelsinger wrote... > or, if you have FTP support built in: Yeah, a much better option if it's available. It isn't for me, and I can't use it as a final solution, so I'm still looking for a way to write files locally without using it. I wish PHP just gave me the ability read and write files as another user, my problems would be solved. -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why this open_basedir warning?
Hello, I have a script that makes a file, and then includes it. Sometimes I get this error: Warning: open_basedir restriction in effect. File is in wrong directory in /home/.pix/cwiltgen/coremessaging.com.scripts/pageServer.php on line 59 Warning: Failed opening '/home/cwiltgen/coremessaging.com/index.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/.pix/cwiltgen/coremessaging.com.scripts/pageServer.php on line 59 But most of the time it works great. (Line 59 is simply the include statement.) I get the error about once every 20 times or so, and I can't figure out why PHP loses it's mind and thinks there's a open_basedir violation. -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why this open_basedir warning?
Ernest E Vogelsinger wrote... >> I have a script that makes a file, and then includes it. Sometimes I get >> this error: [stuff deleted] >> >> But most of the time it works great. > Is this always the same source, or does some source fail, and others work? Always the same source. To test, I'm just reloading the page, giving it a second between reloads just to make sure I'm not running into anything else. > As to the docs, open_basedir is implemented as a prefix check - from your code > it looks as if you were allowed to open all files below /home/cwiltgens, but > not outside your home directory. > > Could it be that the correct path for your statement _should_ be > /home/cwiltgens/.pix? Crap. Good and bad news. So I hardcoded "/home/.pix/cwiltgen/coremessaging.com/index.php" and it worked every time. But then I hardcoded "/home/cwiltgen/coremessaging.com/index.php" (which is what $_SERVER['DOCUMENT_ROOT'] is returning) and *it* worked every time. So then I changed include($this->getSourceDirPath() . "index.php"); ...to... $foo = ($this->getSourceDirPath() . "index.php"); include($foo); ...and IT worked every time. So the problem appears to be related to using concatenation in my include statement (?). Odd. Many thanks for the response! -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File locking problem
Charles Wiltgen wrote... > I'm having file locking problems. > > I'm using fopen() to write a file via FTP. At the end, I'm doing... > > fflush($fp); > fclose($fp); > > ...and then I include it immediately after. But many times I only get part > of what I wrote to the file, which suggests that it wasn't really flushed > and closed properly. BTW, when I only get part of the file in the browser, I open it with Pico and it's all there. So I know that $stuff = ob_end_clean() is working, and that $stuff is being written to the fopen(ftp://...) pointer correctly. I suspect that PHP is including before the file is closed, but not returning an error. I haven't found any other mechanisms in PHP that would allow me to verify that the file is really, really, really closed after using fflush() and fclose() on an fopen("ftp://...";). Any ideas? -- Charles Wiltgen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php