Re: [PHP] return path of mail function

2006-04-03 Thread sub

 You are better off using the 5th paramater to mail() instead..
  mail($to, $sub, $msg, $headers, -f $return);


And what if that doesn't work? Is there a 3rd way of doing it that might
work?

~Drew

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



Re: [PHP] return path of mail function

2006-04-02 Thread sub
The same as before:

Return-path: [EMAIL PROTECTED]
Envelope-to: [EMAIL PROTECTED]
Delivery-date: Mon, 03 Apr 2006 00:35:34 -0500
Received: from nobody by amsterdam.servershost.net with local (Exim 4.52)
 id 1FQHiw-Kf-E4
 for [EMAIL PROTECTED]; Mon, 03 Apr 2006 00:35:34 -0500
To: [EMAIL PROTECTED]
Subject: Test sub
X-PHP-Script: www.drewpydraws.com/crap.php for ip address
From: Test test@test.com
Reply-To: Test test@test.com
Message-Id: [EMAIL PROTECTED]
Date: Mon, 03 Apr 2006 00:35:34 -0500
X-Antivirus: AVG for E-mail 7.1.385 [268.3.4/299]
Mime-Version: 1.0
Content-Type: text/plain


~Drew
www.drewpydraws.com
- Original Message - 
From: Chris [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Sunday, April 02, 2006 10:31 PM
Subject: Re: [PHP] return path of mail function


 [EMAIL PROTECTED] wrote:
  Safe mode is indeed off and sendmail_from has no value. I've modified
the
  code as below:
 
  $return=test@test.com;
  $orig_sendmail_from = ini_get('sendmail_from');
  ini_set('sendmail_from', $return);
 
  $headers =  From: Test test@test.com\r\n .
 Reply-To: Test test@test.com\r\n;
 
  $sub=Test sub;
  $msg=Test msg;
  $to=[EMAIL PROTECTED];
 
  mail($to, $sub, $msg, $headers);

 What headers do you get when you do this?


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



Re: [PHP] return path of mail function

2006-04-02 Thread sub
Safe mode is indeed off and sendmail_from has no value. I've modified the
code as below:

$return=test@test.com;
$orig_sendmail_from = ini_get('sendmail_from');
ini_set('sendmail_from', $return);

$headers =  From: Test test@test.com\r\n .
   Reply-To: Test test@test.com\r\n;

$sub=Test sub;
$msg=Test msg;
$to=[EMAIL PROTECTED];

mail($to, $sub, $msg, $headers);

Still doesn't work. I also tried modifying the5th argument as
[EMAIL PROTECTED] and [EMAIL PROTECTED] neither of those worked either.

I'm not sure what i'm missing here. If it would help to view the phpinfo
from my host, you may do so here http://drewpydraws.com/phpinfo.php

~Drew
www.drewpydraws.com

- Original Message - 
From: Chris [EMAIL PROTECTED]
To: Andrew Darrow [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Sunday, April 02, 2006 5:02 PM
Subject: Re: [PHP] return path of mail function


 Andrew Darrow wrote:
  I'm having a problem setting the return-path using the mail function. I
seem to be able to modify any of the other header information I want, but
not this one item.
 
  Here's my code:
  $headers =  Return-Path: Test test@test.com\r\n .
 From: Test test@test.com\r\n .
 Reply-To: Test test@test.com\r\n;
 
  $sub=Test sub;
  $msg=Test msg;
 
  $to=[EMAIL PROTECTED];
 
  mail($to, $sub, $msg, $headers, '-f test@test.com');

 No space between -f and the email.

 I assume your host doesn't have safe-mode on? (You can't use this method
 if so).

 Check a phpinfo page and look for:

 sendmail_from

 If that's set, this way won't do it either, you'll need to do:

 $orig_sendmail_from = ini_get('sendmail_from');

 // this should match what phpinfo tells you but replace the email. so
 might be '-f'.$return_path
 ini_set('sendmail_from', $return_path);

 mail($to, $sub, $msg, $headers);

 and leave off the last parameter.

 -- 
 Postgresql  php tutorials
 http://www.designmagick.com/

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.385 / Virus Database: 268.3.4/299 - Release Date: 3/31/2006



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



[PHP] defined

2006-02-25 Thread sub
I'm having kind of a weird problem I want $MailSubject to contain a the value 
prayer unless I tell it other wise. 

// on a form processor. 
$MailSubject = Praise;
include_once(mailit.php);

// then in mailit.php
include form2mail.php;

// and in formtomail.php
if(!defined($MailSubject)) // This is the problem line
{
   $MailSubject = Prayer; 
}

The problem I believe is with the defined function check. (I think) the value 
of $MailSubject is maintained to the end so I'm don't think it to be a scope 
issue, but also, if I don't assign a value to it it should be running the if() 
statement, but it's not. 

Any thoughts?


~Drew
www.drewpydraws.com


Re: [PHP] defined

2006-02-25 Thread sub
Well ain't that a kick in the pants? Works great now, thanks. And now I see
the difference between empty() and defined().

Again, many thanks,

~Drew
www.drewpydraws.com

- Original Message - 
From: Philip Hallstrom [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Saturday, February 25, 2006 3:27 PM
Subject: Re: [PHP] defined



  I'm having kind of a weird problem I want $MailSubject to contain a the
value prayer unless I tell it other wise.
 
  // on a form processor.
  $MailSubject = Praise;
  include_once(mailit.php);
 
  // then in mailit.php
  include form2mail.php;
 
  // and in formtomail.php
  if(!defined($MailSubject)) // This is the problem line
  {
$MailSubject = Prayer;
  }
 
  The problem I believe is with the defined function check. (I think) the
  value of $MailSubject is maintained to the end so I'm don't think it to
  be a scope issue, but also, if I don't assign a value to it it should be
  running the if() statement, but it's not.
 
  Any thoughts?

 Try...  if (empty($MailSubject)

 -philip

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 2/24/2006



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



Re: [PHP] problem with Mail function

2006-02-05 Thread sub
This may be a bit to obvious, but I miss little stuff all the time.

You wouldn't happen to have the if(mail(...)) in some form of loop would
you?

or perhaps $to is getting assigned the e-mail address like
[EMAIL PROTECTED] [EMAIL PROTECTED] can you check the value of $email
before you assign it?



~Drew
www.drewpydraws.com


- Original Message - 
From: Tariq Dalvi [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, February 05, 2006 6:55 PM
Subject: [PHP] problem with Mail function


 Hello everyone,

 I m using php mail function it dose everyting fine besides it prints
 message twise in the email body can someone please have a look
 what i m doing wrong the code is as follows :

 $to = $email;
 $subject = someting goes here \n\n;
 $headers = From: [EMAIL PROTECTED] .
 X-Mailer: Mailserver at somewhere.com\n .
 Date: $date\n .
 MIME-Version: 1.0\n .
 Content-Type: text/plain; charset=ISO-8859-1\n ;

 message EOF
 ...
 ...
 .
 .
 ...
 EOF;

   if (mail($to,$subject,$message,$headers)){

 $say = p /E Mail sent successfully to $email. br;
}
 else{

 $say = \n\np /Ohoho! Sending failed Please inform to Webmaster. br;

 }

 I shall highly appreciate any help

 Thanks
 Tariq

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 267.15.2/251 - Release Date: 2/4/2006



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



[PHP] readdir() and files with numbers

2005-09-14 Thread sub
I'm having a really weird problem. My code works, unless the images start with 
a number, then I get a 500 error. If they start with a letter it's fine. 

some example of problem files:
178_image.jpg
0005396C.jpg

the whole reason I wrote this code was so that I wouldn't have to rename all my 
files to pic1, pic2, etc...

What I find truely crazy, is that I can rename 178_image.jpg to 
a178_image.jpg and everything is fine.  How can I work with file names that 
start with numbers?

**
// the thumbnail page (new card and new paragraph)
echo( card id='thumbs'\n );
echo( p\n );

// $path is the gender group (lesbian, gays, etc...)
// $group is the model group (matt, rick, nurses, etc...)

if ($handle = opendir(galleries/$path/$group/pics/thumb/)) 
{
   $b=0;
   while (false !== ($file[$b] = readdir($handle))) 
   {
   $b++;
   }
   closedir($handle);
}

// Create the thumbnail table
// The table should be 3x3
echo( table columns='3'\n);

// $a is the counter w/ values 1-9
// $i is row number w/ values 1-3
// $j is column number w/ valuse 1-3
// $q is the counter for the files read from the thumbnail directory

$q=0;
for( $i=1, $a=1; $i=3; $i++)
{
 echo( tr\n);
 for( $j=1; $j=3; $a++, $j++)
 {
  if($file[$q]==. || $file[$q]==..)
  {
   $q++;
  }
  echo( tda href='#$file[$q]'img 
src='galleries/$path/$group/pics/thumb/$file[$q]' alt='thumb$a'//a/td\n);
  $q++;
 }
 echo( /tr\n);
}
// End the table
echo( /table\n);

// End the paragraph and card
echo( /p\n );
echo( /card\n );

// Loop creating 9 cards for the pics 
for( $x=1, $q=0; $x=9; $q++, $x++)
{
 
 if($file[$q]==. || $file[$q]==..)
 {
  $q++;
 }

 // the thumbnail page (new card and new paragraph)
 echo( card id='$file[$q]'\n );
 echo( p\n );
 

 echo( img src=\galleries/$path/$group/pics/$file[$q]\ alt='pic$x'/\n); 

 // End the paragraph and card
 echo( /p\n );
 echo( /card\n );


Andrew Darrow
Kronos1 Productions
www.pudlz.com



Re: [PHP] Problem w/ reading a txt file.

2005-09-13 Thread sub
Yeah, I just cut out almost the code that was working fine. My the full code
does a bit more than than that.

Thanks all,

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Burhan Khalid [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, September 13, 2005 12:45 AM
Subject: Re: [PHP] Problem w/ reading a txt file.


 [EMAIL PROTECTED] wrote:
   Problem w/ reading a txt file.
 
   The error I get is Warning: opendir(/home/pudlz/public_html ): failed
to
   open dir: No such file or directory 
 
   Here's my code::
 
   $main = file('folders.txt');
   $counter = count($main);
 
   for($i=0;$i$counter;$i++)
   {
if ($handle = opendir($main[$i]))
{
   $b=0;
 }
   }
 
 
   It's reading and extra space at the end of all my lines. How do I
prevent
   that?

 $main = file('folders.txt');
 foreach($main as $folder)
 {
 if ($handle = opendir(trim($folder))
 {
 $b = 0;
 }
 }

 I really don't see the point in this loop, but maybe you gave a very
 simple example.

 Warmly,
 Burhan

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.344 / Virus Database: 267.10.23/99 - Release Date: 9/12/2005



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



[PHP] Problem w/ reading a txt file.

2005-09-12 Thread sub

 Problem w/ reading a txt file.
 
 The error I get is Warning: opendir(/home/pudlz/public_html ): failed to
 open dir: No such file or directory 
 
 Here's my code::
 
 $main = file('folders.txt');
 $counter = count($main);
 
 for($i=0;$i$counter;$i++)
 {
  if ($handle = opendir($main[$i]))
  {
 $b=0;
   }
 }
 
 
 It's reading and extra space at the end of all my lines. How do I prevent
 that?
 
 Andrew Darrow
 Kronos1 Productions
 www.pudlz.com

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



[PHP] date of file?

2005-09-11 Thread sub
In addition to reading the names of the files in a directory, I also need to 
read the date the file was modified. 

Right now I've got this: 

if ($handle = opendir($path)) 
{
   $b=0;
   while (false !== ($file[$b] = readdir($handle))) 
   {
   $b++;
   }
   closedir($handle);
}

What function do I need to use to do this? I'm working in php4.

Andrew Darrow
Kronos1 Productions
www.pudlz.com



Re: [PHP] syntax for multiple boolean

2005-08-27 Thread sub
You could write what your code does now like this.

if (empty ($fname) || empty ($sname) || empty ($address))
{
// do something
}

If you want your first condition to be met and one of your second two
conditions to be met you can do it like this:

if (empty ($fname)  (empty ($sname) || empty ($address)))
{
// do something
}

Of course the first example will run the code if any of the fields are
empty. The second will run it if the first and second or third are empty.
Hope that helps.

Andrew Darrow
Kronos1 Productions
www.pudlz.com

- Original Message - 
From: Ross [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Saturday, August 27, 2005 10:42 AM
Subject: [PHP] syntax for multiple boolean


 I want to check if multiple fields are empty and want to find the best
 shorthand way to do it. What are the rules with brackets in PHP.


 if (empty ($fname){

 //do something

 }

 if (empty ($sname){

 //the same thing

 }

 if (empty ($address){

 //do the same ting again

 }


 R.

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005



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



Re: [PHP] Return Path [SOLVED]

2005-08-06 Thread sub
Works great. Thank you.

Although I swear I tried that last night. Eh I probably messed something up.

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Sebastian [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Saturday, August 06, 2005 6:12 AM
Subject: Re: [PHP] Return Path


 try using -f

 mail($toemail, $subject, $message, $from, '-f [EMAIL PROTECTED]');

 [EMAIL PROTECTED] wrote:

 I don't seem to be able to set the return path using the mail()
function. I can't figure out why from will let me set it, but not the
return path.
 
 $headers = 'From: [EMAIL PROTECTED]' . \r\n .
'Return-path: [EMAIL PROTECTED]' . \r\n .
'X-Mailer: PHP/' . phpversion();
 
 mail($email, $subject, $message, $headers);
 
 
 Any thoughts?
 
 Andrew Darrow
 Kronos1 Productions
 www.pudlz.com
 
 
 
 


 -- 
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.10.1/64 - Release Date: 8/4/2005

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.10.1/64 - Release Date: 8/4/2005



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



[PHP] login check

2005-08-05 Thread sub
 
I think this is the way I need to write my if statement. 

if ( $min  $user[ min ] == $min  $user[ pin ] == $pin || $pin == 
'allow')

$min login name entered by the customer at the form. 
$user[min] is the login name from my sql db that matches $min
$user[pin] is the password from mysql db that matches $min
$pin is the password that is entered by the user

There's 4 checks
1) $min must have a value
2)  $user[ min ] must equal $min 
3) $user[ pin ] must equal $pin 
4) $pin == 'allow'

I want it so that both 1 and 2 must be true and either 3 or 4 must be true. 
Will this if statement work?


Andrew Darrow
Kronos1 Productions
www.pudlz.com



[PHP] Return Path

2005-08-05 Thread sub
I don't seem to be able to set the return path using the mail() function. I 
can't figure out why from will let me set it, but not the return path. 

$headers = 'From: [EMAIL PROTECTED]' . \r\n .
   'Return-path: [EMAIL PROTECTED]' . \r\n .
   'X-Mailer: PHP/' . phpversion();

mail($email, $subject, $message, $headers);


Any thoughts?

Andrew Darrow
Kronos1 Productions
www.pudlz.com



Re: [PHP] code generation

2005-08-04 Thread sub
Couldn't you use a date check with date()?

if(todays date  end date)
{
load the site
}
else
{
the site has expired
}

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Johan Grobler [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Wednesday, August 03, 2005 11:04 PM
Subject: [PHP] code generation


is there a way to limit the time a website is available in php?, if you want
to have a database driven website but you would only like it to be active
for 6 months for instance, i'm doing a project at univirsity and this is
part of the specs, but i cant think of a good way how to do it...

Disclaimer
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is
intended for the attention and use only of the addressee.
Should you have received this e-mail in error, please delete
and destroy it and any attachments thereto immediately.
Under no circumstances will the Cape Peninsula University of
Technology or the sender of this e-mail be liable to any party for
any direct, indirect, special or other consequential damages for any
use of this e-mail.
For the detailed e-mail disclaimer please refer to
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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





-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.9/62 - Release Date: 8/2/2005

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



Re: [PHP] Running a PHP script everyday [SOLVED]

2005-07-31 Thread sub
What a convoluted mess.

Rather than using the shebang at the begging of the PHP file I had to put it
in the cron command
/usr/local/bin/php public_html/wap/mailer/dailylist.php

It will now run.

But then I had to slightly redesign the HTMLMimeMail code. I had to define
some of it as functions and include the file as a function definition rather
than include the direct code. I also had to change my include statements to
this include public_html/wap/mailer/sending.php; With this type of
include I can no longer run it from a browser, but I really didn't want to
do that anyways.

Thanks for all your help.

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Miles Thompson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-general@lists.php.net
Sent: Saturday, July 30, 2005 5:57 PM
Subject: Re: [PHP] Running a PHP script everyday



 If you're on Windows, use Task Manager and have it start an instance of a
 web browser, with your URL and script passed to it.
 or
 Cron job on server, if you have that level of access.

 Miles


 At 01:17 PM 7/30/2005, [EMAIL PROTECTED] wrote:
 I have a PHP script that I need to run once a day.  I have it currently
 setup so that I just run it from my cell phone, but I would prefer
something
 automated. I'd looked into a cron job, but that just looks like it's for
 doing linux command line stuff on my host.
 
 I also thought about writing a never ending while loop with an if
statement
 that checks to see if it's time to run the script, then when it is time,
it
 runs. Then checks to see if it's time again.
 
 But even assuming I could get it working, do I really want to have a PHP
 script that runs all the time. This could be bad if it ate up all the CPU
on
 my server. I'm not even sure I have access rights to kill the process
once I
 start it.
 
 Any suggestions?
 
 Andrew Darrow
 Kronos1 Productions
 www.pudlz.com

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





 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005



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



[PHP] Running a PHP script everyday

2005-07-30 Thread sub
I have a PHP script that I need to run once a day.  I have it currently
setup so that I just run it from my cell phone, but I would prefer something
automated. I'd looked into a cron job, but that just looks like it's for
doing linux command line stuff on my host.

I also thought about writing a never ending while loop with an if statement
that checks to see if it's time to run the script, then when it is time, it
runs. Then checks to see if it's time again.

But even assuming I could get it working, do I really want to have a PHP
script that runs all the time. This could be bad if it ate up all the CPU on
my server. I'm not even sure I have access rights to kill the process once I
start it.

Any suggestions?

Andrew Darrow
Kronos1 Productions
www.pudlz.com



Re: [PHP] Help with Functions

2005-07-30 Thread sub
I would recomend for sanity and clean code that you define your functions
outside of the file you will be calling it from and include that file in any
file you need to call a function from.

Here's a function that I defined in my db.php file.

/***
 * FUNCTION: DBCheckByMin($min)
 * DESCRIPTION: Checks to see if the user's min already exists
 * RETURNED: exist (1 or 0)
 **/
function DBCheckByMin($min)
{
$record = mysql_query( SELECT `min` FROM `user` WHERE `min` LIKE '$min' );

for($i=0; $holder[$i]=mysql_fetch_array( $record ); $i++);

if($min==$holder[0][0])
 {
  $exist=1;
 }
else
 {
  $exist=0;
 }
return $exist;
}

The first line of the file I call this function in includes my function
list:
include db.php;

And my call to the function itself:
$check=DBCheckByMin($min);



Let's say my user is entering his MIN as 1234567890

What the function does is catch the value of the variable $min which is
1234567890 when it's called and pass it to the function. Then DBCheckByMin
takes the value 1234567890 and assignes it to the variable $min. (I've named
both variables the same so I know what they are) Now that the function has
it's own variable, $min that has a value of 1234567890 It then does some
basic SQL work to find if that MIN already exists in my databse. Then it
sets $exist to either 1 or 0. It sets it to 1 if this is a duplicate entry
and 0 if it's not a duplicate. And let's just say that it did indeed find a
duplicate record so $exist will have the value of 1.  Next on the return
line, the function sends back the value of $exist which is 1. Please
remember when I called the function I had a variable before the function was
called $check=DBCheckByMin($min);  This way $check will catch whatever
value the function returns, in this case, that value is 1. Now that check
has a value which indicates that this user already exists I can send a
message to the user saying that it already exists and to try again.

Did that make a bit more sense about how variables are passed between
functions? It's all in the call and definition.


Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: Tom Chubb [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Saturday, July 30, 2005 9:23 AM
Subject: [PHP] Help with Functions


I am trying to start using functions on some pages to layout a header
row in a table.
I have defined the function as below...

?php
function (headerrow)
{ ?
table width=750 border=0 cellpadding=0 cellspacing=0
bgcolor=#FF0066
tr
  td class=table_head?php echo $tablehead; ?/td
  td width=20img src=/nav/images/pspromo_table_rhs.gif
width=20 height=20/td
/tr
/table
?php
}
?


What I can't seem to work out is a way to set the text. Here I've
echoed the $tablehead value, but it I was to use more than one table
on the same page then it wouldn't work. Can I do something like
headerrow(text goes here) or something?
I can't understand the use of arguments and it's really confusing me!
Any help would be really appreciated.
Thanks,

Tom

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





-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005

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



Re: [PHP] Running a PHP script everyday

2005-07-30 Thread sub
In my pevious hunt through cron I didn't even notice the PHP CLI. So I will be 
figuring that out today probably. 

My server runs on Linux. Not sure which distro though. I'll have to ask. 

My script will be getting e-mail addresses from my SQL db and sending them a 
pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I just 
need to figure out how to make it run without me doing anything. 

Thanks!

Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: James Kaufman [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Saturday, July 30, 2005 10:07 AM
Subject: Re: [PHP] Running a PHP script everyday


 On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] wrote:
  I have a PHP script that I need to run once a day.  I have it currently
  setup so that I just run it from my cell phone, but I would prefer something
  automated. I'd looked into a cron job, but that just looks like it's for
  doing linux command line stuff on my host.
  
  I also thought about writing a never ending while loop with an if statement
  that checks to see if it's time to run the script, then when it is time, it
  runs. Then checks to see if it's time again.
  
  But even assuming I could get it working, do I really want to have a PHP
  script that runs all the time. This could be bad if it ate up all the CPU on
  my server. I'm not even sure I have access rights to kill the process once I
  start it.
  
  Any suggestions?
  
  Andrew Darrow
  Kronos1 Productions
  www.pudlz.com
  
 
 You don't state what OS you are using, but you certainly can use cron under
 Linux to run a PHP script. What really matters is what does the PHP script do?
 For example, I have a PHP script that I run periodically that retrieves data
 from a database and updates a text file on the disk. What does your script do?
 
 -- 
 Jim Kaufman
 Linux Evangelist
 public key 0x6D802619
 CCNA, CISSP# 65668
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
 -- 
 No virus found in this incoming message.
 Checked by AVG Anti-Virus.
 Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
 
 

Re: [PHP] Running a PHP script everyday

2005-07-30 Thread sub
I can't figure out how to get into command line access through my webhost.
I've tried telnet and it fails.

My host uses cPanel. When I setup the crontab it e-mails me back this
response:

/bin/sh: public_html/wap/mailer/dailylist.php: /usr/bin/php
: bad interpreter: No such file or directory

I'm assuming that it means it can't find /user/bin/php

I ran a whereis php through a cronjob and got this:

php: /usr/src/php-4.3.8/php.ini-recommended /usr/src/php-4.3.8/php.ini-dist
/usr/src/php-4.3.8/php.gif /usr/src/php-4.3.8/php4.spec
/usr/src/php-4.3.10/php.ini-recommended /usr/src/php-4.3.10/php.ini-dist
/usr/src/php-4.3.10/php.gif /usr/src/php-4.3.10/php4.spec /usr/bin/php
/usr/lib/php /usr/lib/php.ini /usr/local/bin/php /usr/local/lib/php
/usr/local/lib/php.ini /usr/include/php

I tried them all except the ones with src And still get the same message,
but of course it doesn't say /user/bin/php, it says whichever one I put in
the file.

Now the main PHP file calls to 3 other PHP files in it. Do I need to put
that at the top of each of them as well. I didn't think so because they
aren't being executed. They are called using the include statement.

Also when I use #!/usr/include/php I get the response back from the cron
job, but when I use #!/usr/include/php -q like the tutorial says nothing
happens. What does the -q do?


Andrew Darrow
Kronos1 Productions
www.pudlz.com


- Original Message - 
From: André Medeiros [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Saturday, July 30, 2005 10:35 AM
Subject: Re: [PHP] Running a PHP script everyday


You can cron the script to run.

Do the following:

1) Add #!/usr/bin/php as the first line on your .php file. If
/usr/bin/php isn't where your php binary lives, type whereis php to
find out
2) Make sure you chmod +x your php script.
3) http://www.linuxforums.org/tutorials/1/tutorial-4017.html

On 7/30/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 In my pevious hunt through cron I didn't even notice the PHP CLI. So I
will be figuring that out today probably.

 My server runs on Linux. Not sure which distro though. I'll have to ask.

 My script will be getting e-mail addresses from my SQL db and sending them
a pic of the day. I got the HTML MimeMail 2.5.1 to work perfectly, now I
just need to figure out how to make it run without me doing anything.

 Thanks!

 Andrew Darrow
 Kronos1 Productions
 www.pudlz.com


 - Original Message -
 From: James Kaufman [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Saturday, July 30, 2005 10:07 AM
 Subject: Re: [PHP] Running a PHP script everyday


  On Sat, Jul 30, 2005 at 09:17:20AM -0700, [EMAIL PROTECTED] wrote:
   I have a PHP script that I need to run once a day.  I have it
currently
   setup so that I just run it from my cell phone, but I would prefer
something
   automated. I'd looked into a cron job, but that just looks like it's
for
   doing linux command line stuff on my host.
  
   I also thought about writing a never ending while loop with an if
statement
   that checks to see if it's time to run the script, then when it is
time, it
   runs. Then checks to see if it's time again.
  
   But even assuming I could get it working, do I really want to have a
PHP
   script that runs all the time. This could be bad if it ate up all the
CPU on
   my server. I'm not even sure I have access rights to kill the process
once I
   start it.
  
   Any suggestions?
  
   Andrew Darrow
   Kronos1 Productions
   www.pudlz.com
  
 
  You don't state what OS you are using, but you certainly can use cron
under
  Linux to run a PHP script. What really matters is what does the PHP
script do?
  For example, I have a PHP script that I run periodically that retrieves
data
  from a database and updates a text file on the disk. What does your
script do?
 
  --
  Jim Kaufman
  Linux Evangelist
  public key 0x6D802619
  CCNA, CISSP# 65668
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 
  --
  No virus found in this incoming message.
  Checked by AVG Anti-Virus.
  Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005
 
 


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





-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.7/60 - Release Date: 7/28/2005

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