Re: [PHP] if(date(Y-m-d)

2005-01-10 Thread Travis Conway
Maybe this will help.  Just keep adding to $var[] until you add all your 
weeks.  Then execute it.  This is written to run on the command line, but 
you can replace the \n with br to get your breaks in HTML.

?
   $var = Array();
   $var[] = 2005-01-02;
   $var[] = 2005-01-09;
   $var[] = 2005-01-16;
   $numweeks = count($var);
   echo Number of weeks:  . $numweeks . \n;
   $today = date(Y-m-d);
   for ($i=0;$i$numweeks;$i++) {
   if ($today = $var[$i]) {
   $lastweek = $i + 1;
   }
   }
   echo This is week $lastweek.\n;
?
HTH
Trav
www.pinkbunnysuit.com
- Original Message - 
From: John Taylor-Johnston [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Monday, January 10, 2005 12:08 PM
Subject: [PHP] if(date(Y-m-d) 


Hi,
I would like some help to improve this script. I'm a teacher with a 
schedule of 17 weeks.
Instead of using if(date(Y-m-d) = $week3)  I would like to do a for i 
= 1 to 17 and if the current date date(Y-m-d) = week[i] I would like to 
echo This is week $week[i];

Can someone show me how please?
?php
#old code:
$week1 = 2005-01-17;
$week2 = 2005-01-24;
...
$week17 = 2005-05-09;
if(date(Y-m-d) = $week3)
{
echo this is week 3);
}
?
Thanks,
John
--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.
'''Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
 - 819-569-2064
 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064

--
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] 403 not working -- apache 2 / php5 / linux

2005-01-10 Thread Travis Conway
you have to allow others to read it.
You have it so only root can access the file.  Try this:
chmod 644 test.php
while logged in as root.  This should put the file as
-rw-r--r-- 1 root root test.php
HTH
Travis
- Original Message - 
From: Jason Morehouse [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Monday, January 10, 2005 12:49 PM
Subject: [PHP] 403 not working -- apache 2 / php5 / linux


Hello.  I'm not sure if this is an apache problem or php... but 
wondering if anyone has come across the same problem.

-rw---1 root root test.html
-rw---1 root root test.php
Trying to access test.html via a browser servers up the apache 403 error 
page.  The test.php however produces:

Warning: Unknown: failed to open stream: Permission denied in Unknown on 
line 0 Warning: Unknown: Failed opening '/www/test.php' for inclusion 
(include_path='.:/www/php') in Unknown on line 0

Any ideas?
Thanks!
--
Jason Morehouse
Vendorama - Create your own online store
http://www.vendorama.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] GMT

2005-01-04 Thread Travis Conway
Here has always been a problem I run into with GMT translation.  You have to 
make sure that the system you are working with is set to the correct time 
zone so that any application trying to automatically figure out the time 
have the starting point.  This is easy enough in Windows, but can mean 
making sure your /etc/localtime (See 
http://www.linuxforum.com/linux_tutorials/68/1.php) is correct in linux. Of 
course there are GUI tools to help with this also for those non-console 
people. Unfortunately some people rely on shared servers where you do not 
have root access to change /etc/localtime.

Therefore you must have an overloadable function to return the time in GMT. 
Where it can accept an offset or rely on the systems timezone.

To me, it seems best to just use a variable.  Print out the time, then do a 
correct offset for it.

But for something already done, see 
http://us3.php.net/manual/en/function.gmdate.php

Travis
- Original Message - 
From: Bruno B B Magalhães [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, January 04, 2005 5:04 AM
Subject: [PHP] GMT


Hi you all,
How do you work with GMT time-zones? I mean, I´ve developed a support 
system, with projects, bugs, tasks, etc... but as I user date()ç,I is 6 
hours late from my client´s time-zone...

And I would like to make it a little more dynamic than just put a variable 
in the code and add to the hour.

Regards,
Bruno B B Magalhães
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP and Post Data

2004-12-21 Thread Travis Conway
Why reinvent the wheel by writing your own webserver?  Apache allows for it 
to be used within other products.  Just redistrbute it according to the 
license.
- Original Message - 
From: Shane Mc Cormack [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, December 21, 2004 10:36 PM
Subject: Re: [PHP] PHP and Post Data


That works on a normal webserver yes.
However, I am programming my own, and I have the Posted Data stored in the 
memory of the webserver, and when i execute the PHP.exe i need to tell it 
what the PostData is somehow.

- Shane
John Nichel wrote:
Shane Mc Cormack wrote:
Hi
I'm trying to integrate PHP Support into a basic webserver i am creating 
for personal use (Windows). However i've run into a problem.

I've got the _GET vars working, (using the QUERY_STRING Environment 
Variable), yet i can't figure out how to get the _POST vars set.

my webserver has the POST data stored in a variable, i jsut need to know 
how to tell PHP the post data.

On the webserver GET support works perfectly, as does POST support, all 
i need to do is tell PHP what the data is.

Any help would be appreciated.

Not sure I follow quite what you're asking, but if you have a form like 
this...

form action=myform.php method=post
input type=text name=foo /
input type=hidden name=bar value=bob /
input type=submit /
/form
Once you submit the form (to myform.php), the data posted from the form 
will be available in the $_POST super global array...

$_POST['foo']
$_POST['bar']
http://us4.php.net/manual/en/language.variables.external.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] How to distribute php codes safely?

2004-12-16 Thread Travis Conway
Well a simple search on Google for PHP Encoder brougt back these:
http://www.ioncube.com/ $199
http://www.rssoftlab.com/downloads.php - Appears to be Free
I am sure there are more.  Check http://freshmeat.net for a good Open Source 
product.  Also try http://www.sourceforge.net.

As always check to see if the encoders support your current version of PHP.
Also, always do a Google search first.
Trav
- Original Message - 
From: Jonathan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 8:21 AM
Subject: [PHP] How to distribute php codes safely?


Hi,
Is there a replace to Zend encoder that I can use for free? Zend encoder 
is
too expensive for a small fry developer like me.

Thanks for your help.
Jonathan Tang
--
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] Getting mail() to return false/0

2004-12-14 Thread Travis Conway
- Original Message - 
From: Paul Reinheimer [EMAIL PROTECTED]

Hi,
I was working with the mail function today to experiment with sending
a few messages, and threw in the apropriate checks so when mail()
can't send the message the apropriate errors were raised, however, I
discovered I couldn't actually get mail() to return 0. Take the
following call:
mail(dude, Daily Feed Update, body);
I assume dude is a local user you are mailing to?  Make sure you also give 
a FROM address.  Try this:

mail([EMAIL PROTECTED], Daily Feed Update, body, From: 
[EMAIL PROTECTED])

-Trav
When I run that exact call (well, I prepend echo, but you get the
idea) it returns 1. I can't for the life of me understand why my MTA
would accept an email with a destination of 'dude'.
Any thoughts?

paul
--
Paul Reinheimer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] php.ini

2004-12-13 Thread Travis Conway
What is the default place for php.ini?  I have a few copies when I do a 
`whereis php.ini`.  I figure it is the /etc/php.ini.  Anyone shed some 
light?  Also, is there anything that must be done after I modify the 
php.ini?

Trav 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php.ini

2004-12-13 Thread Travis Conway
Nevermind.  I got it
- Original Message - 
From: Travis Conway [EMAIL PROTECTED]
To: PHP-GEMERAL [EMAIL PROTECTED]
Sent: Monday, December 13, 2004 9:30 PM
Subject: [PHP] php.ini


What is the default place for php.ini?  I have a few copies when I do a 
`whereis php.ini`.  I figure it is the /etc/php.ini.  Anyone shed some 
light?  Also, is there anything that must be done after I modify the 
php.ini?

Trav 

--
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] Command Line

2004-12-12 Thread Travis Conway
- Original Message - 
From: - Edwin - [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: Travis Conway [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 10:40 AM
Subject: Re: [PHP] Command Line


Hi,
On Sun, 12 Dec 2004 09:15:46 -0600
Travis Conway [EMAIL PROTECTED] wrote:
How do you reference command line arguments in php?
i.e., chkmd5.php file.md5
I am wanting to reference file.md5. Since the output of md5sum is
not in the RFC I am having to manually parse each md5 and detect
whether it is in Win32, Linux, or BSD format.
I'm not sure what you meant by that (since an md5 checksum is an md5
checksum) but...
What I mean is that a Win32 md5sum outputs like
hash *file
Linux:
file:hash
-or
hash:file
and BSD:
(file) hash
So if I run md5sum -c file.md5 and it was created on another platform, 
md5sum will not check md5.  The hash will be the same but not the file 
output format.  That is all.

And since php has good built in md5() support it helps out.
I think you're looking for argv:
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
PS
Btw, it's php-geNeral and not php-geMeral ;)
It is much easier to just ask you guys though.
Trav 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Travis Conway
Ha!
Sorry for that Fedora 3 is causing all kinds of havoc. I would stay away 
for a while.

Trav
- Original Message - 
From: Michael Leung [EMAIL PROTECTED]
To: Andre Dubuc [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 7:25 PM
Subject: Re: [PHP] PHP Apache Upload file Permission denied


Hi Andre,
 thank you, I have hided my html path in the message. I have replace
my real path with '/var/www/html/'.  the error message should be like
this.
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to
 move '/tmp/phpjsLZfC' to '/var/www/html/test/icons.zip' in
 /var/www/html/simple_upload.php on line 76.
Pervious error message , I have some typing mistakes in there.
Yes, this kind of script is working in my pervious old server. But
after I have upgraded the OS to Fedora 3 with PHP 5.0.2 and Apache 2.
The script does not work any more. I am thinking may be I need to
modify some configure in Apache 2 to allow the upload file function.
yours,
Michael
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP Apache Upload file Permission denied

2004-12-12 Thread Travis Conway
What user did you run your command line as?
Trav
- Original Message - 
From: Michael Leung [EMAIL PROTECTED]
To: Travis Conway [EMAIL PROTECTED]
Cc: Andre Dubuc [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, December 12, 2004 8:01 PM
Subject: Re: [PHP] PHP Apache Upload file Permission denied


Hi all,
 I am more believing this is a kind of apache configure problem. If
that's Fedora 3 problem, I can't do this kind in command line.
Therefore, if I bypassed Apache, my problem is solved. Moreover, my
system is highly OOP , I can't fall back into PHP 4.
yours,
Michael
--
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] Command Line

2004-12-12 Thread Travis Conway
How do you reference command line arguments in php?
i.e., chkmd5.php file.md5
I am wanting to reference file.md5. Since the output of md5sum is not in the 
RFC I am having to manually parse each md5 and detect whether it is in 
Win32, Linux, or BSD format.  And since php has good built in md5() support 
it helps out.

Travis 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP vs JSP?

2004-12-11 Thread Travis Conway
Did he really ask that question on a PHP board?
That is like walking into a Coke factory, going to the manager and asking 
pepsi or coke?

- Original Message - 
From: Raditha Dissanayake [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, December 11, 2004 7:11 AM
Subject: Re: [PHP] PHP vs JSP?


Peter Lauri wrote:
Best groupmember,
Why should I choose PHP instead of JSP/Servlets when it comes to develop a
high-traffic site. Assume that the infrastructure for both are set up. It
only comes to efficiency (both coding and running)? What are your
experience?
As a sun certified java programmer, let me assure you that PHP is easier 
to work with.

--
- Best Of Times
/Peter Lauri


--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload
--
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] For Loop

2004-12-08 Thread Travis Conway
try
for($i=0;$i$months_arr_length;$i++)
look at it as this:
for(i as starting point; till i is what? greater than my length; increment i 
how? by 1) {

HTH
Trav
- Original Message - 
From: R. Van Tassel [EMAIL PROTECTED]
To: 'PHP general' [EMAIL PROTECTED]
Sent: Wednesday, December 08, 2004 3:41 PM
Subject: [PHP] For Loop


I have a question about the following code:
**
$months_arr = array(JAN, FEB, MAR, APR, MAY, JUN, JUL, 
AUG,
SEP, OCT, NOV, DEC);
$months_arr_length = count($months_arr);

for($i = 0; $i = $months_arr_length; $i++){
echo $months_arr[1]. br /;
}
***
When I run the code above it continues and never stops. According to the 
PHP
documentation the second condition works as follows:

In the beginning of each iteration, expr2 is evaluated. If it evaluates 
to
TRUE, the loop continues and the nested statement(s) are executed. If it
evaluates to FALSE, the execution of the loop ends.

In the first iteration of the loop $i would equal 0 and the array length 
is
12. 12 is consistent. To it seems that the loop should STOP when the 
counter
reaches 12, equal to the length of the array. Why is it continuing in a
neverending loop? What am I missing?

Changing the condition of the for loop to $i = $months_arr_length; fixes
everything and it works properly.
Can someone please explain where my confusion is?
Thanks,
~R. Van Tassel
--
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 error

2004-12-05 Thread Travis Conway
Try:
SELECT * FROM listing WHERE listing.state = 'WA' AND listing.type = 'RES' 
AND listing.county = 'clark' AND (listing.price  15 OR listing.price 
=20)

Try to not use the word type.  Do not know what it is but I have some 
problems using it.  In the event you have weird problems, try putting the 
table name before the field like I did (i.e., listing.type).  You probably 
also need the price in params since you want to OR just on those two items. 
I also assume that you have the price field as a int, bigint, or similar 
field type which does not require a tick around the value.  I also dont 
think that the back tick works.

HTH
Travis
- Original Message - 
From: Richard Kurth [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, December 05, 2004 3:05 PM
Subject: [PHP] mysql error


Could somebody tell me way these query gets a error 1064 and does not
work.
error=You have an error in your SQL syntax; check the manual that 
corresponds to your
MySQL server version for the right syntax to use near
'SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'

query=SELECT * FROM listing WHERE `state` = 'WA' AND `type` = 'RES'
AND `county` = 'clark' AND `price`  '15' OR `price` = '20';
--
Best regards,
Richard  mailto:[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Mass MySQL INSERT

2004-11-28 Thread Travis Conway
I am fairly new to the concept of working wity mysql and php.  I am looping 
thru a text file full of county names and attempting to add these to a database.

Now the table exists and if I enter the SQL statement manually against the 
database it works.  The user also has read and write permissions to the table 
and the columns in the table.

Here is my php code:
 $lines = file(/tmp/new1.txt);
 foreach ($lines as $line_num = $line) {
  echo($line . '... ');
   $link = mysql_connect('naabe', 'naabe', 'x')
or die('could not connect: ' . mysql_error());
// I use substr to remove the space at the end of every line.
   $sql = INSERT INTO countries (country) VALUES (' . 
substr($line,0,strlen($line)-1) . ');
   echo ($sql . ' ...br');
   mysql_query($sql);
   mysql_close();
  flush();
 }

This is how I configured php4.3.9
./configure --enable-so --with-mysql=/usr/local/mysql --enable-filepro 
--with-apx2=/usr/local/apache2/bin/apxs --with-jpg --with-png --with-xml

It will print to the screen the line and the SQL statement correctly.  The 
password is correct.  The database name is naabe, the user is naabe.

Anyone know what I could be doing wrong?

Trav

[PHP] php 4 to 5

2004-11-28 Thread Travis Conway
I do not know much about the history of php and do not know why there is 
active development on both the 4 and 5 major versions, but is there a 
definite reason for me to migrate from 4 to 5 on my servers?

Trav 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: php 4 to 5

2004-11-28 Thread Travis Conway
Well,  I look at other people's code sice I am new to the whole language.  I 
have only been working with it for about a month and half now.  I do have 
prior experience with languages such as ASP (both JScript and VBscript 
based).  I am probably not going to upgrade now since my stuff just works. 
I was just wondering what would be the main advantage.
- Original Message - 
From: Greg Beaver [EMAIL PROTECTED]
To: Travis Conway [EMAIL PROTECTED]
Cc: PHP-GEMERAL [EMAIL PROTECTED]
Sent: Sunday, November 28, 2004 6:15 PM
Subject: [PHP] Re: php 4 to 5


Travis Conway wrote:
I do not know much about the history of php and do not know why there is 
active development on both the 4 and 5 major versions, but is there a 
definite reason for me to migrate from 4 to 5 on my servers?
Depends on what you wish to do with php.
PHP 5 has far better support for xml and soap than php 4.  It has a 
stricter object model and supports native exceptions for error handling. 
Iterators, reflection, and __call()/__get()/__set() provide incredibly 
flexibility.  It is new, and so not nearly as stable as PHP 4.  Any 
solutions would need to be custom-written for PHP 5 at this point, 
although options are beginning to appear.

PHP 4 has a big history and is very stable.  There are shortcomings that 
are addressed in PHP 5, but there is a huge codebase.

So, the question is, do you rely on other people's code, or your own? If 
you rely on other people's code, I would wait a year or two to upgrade. 
Otherwise, what are you waiting for?

:)
Greg
--
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