[PHP] Re: Running a PHP script on an automated regular schedule

2004-07-12 Thread Henry Grech-Cini
You may also want to look at wget as a way of invoking
your PHP script if command line support is not available.

Henry

I.A. Gray [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi.

 I am wanting to use a PHP script to check on an hourly/daily basis on a
few
 things- ie links on my sites, whether the sites are up and running and
also
 to send an e-mail to me.  I know how to do this using PHP but my problem
is
 how to have this running 24/7.  I can't really have this on a web page as
 wouldn't it time out?  I don't have my own server and so use a hosting
 company.  Is there a way of running a PHP script on a regular basis (say
 every 10 or 30 mins, or hourly or daily)?  Would I have to set up my own
 server to do this?  I just the simplest way of acheiving this.  Any ideas?
 Does anyone know of any decent link checkers written in PHP that I could
 implement?

 Many thanks,

 Ian Gray


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



[PHP] Checking if a website is up?

2004-03-30 Thread Henry Grech-Cini
Hi All,

I am trying to check if a website is up (reachable) and I have used the
standard code below:

Unfortunately this works for most sites but Microsoft doesn't work most of
the time even thought the site is definiately up! (Occassionally it does say
it is reachable but only occassionaly and thats whats even more confusing).

Suggestions?

Henry

I tried URL's as follows:

http://www.microsoft.com/
http://www.microsoft.com



   function url_reachable( $link )
   {
   $url_parts = @parse_url( $link );

if ( $url_parts[scheme]!=http ) return ( false );

   if ( empty( $url_parts[host] ) ) return( false );

   if ( !empty( $url_parts[path] ) )
   {
   $documentpath = $url_parts[path];
   }
   else
   {
   $documentpath = /;
   }

   if ( !empty( $url_parts[query] ) )
   {
   $documentpath .= ? . $url_parts[query];
   }

   $host = $url_parts[host];
   $port = $url_parts[port];
   // Now (HTTP-)GET $documentpath at $host;

   if (empty( $port ) ) $port = 80;
   $socket = @fsockopen( $host, $port, $errno, $errstr, 30 );
   if (!$socket)
   {
   return(false);
   }
   else
   {
   fwrite ($socket, HEAD .$documentpath. HTTP/1.0\r\nHost:
$host\r\n\r\n);
   $http_response = fgets( $socket, 22 );

   if ( ereg(200 OK, $http_response, $regs ) )
   {
   return(true);
   fclose( $socket );
   } else
   {
//echo HTTP-Response: $http_responsebr;
   return(false);
   }
   }
   }

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



[PHP] Re: Ticketing system

2004-03-23 Thread Henry Grech-Cini
Hi

I am using deskpro. see http://www.deskpro.com

It's written in PHP, but it is not cheap. From my brief experience I would
have to say however that it certainly seems to be worth it.

Such a sophisticated ticketing system would take a very significant amount
of time to build from scratch.

HTH


[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there, ok i am asking now, but be assured that I have googled already.
I
 am looking for a good customisable ticketing system in PHP, i had a look
at
 request tracker, but it doesnt look customisable and its in Perl.

 I am trying to find if there are solutions to what we want before i go and
 build it from scratch, let me know thanks.

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



Re: [PHP] How to make sure a redirect works

2004-03-11 Thread Henry Grech-Cini
Thankyou all,

There's a lot of info here but I guess that I can summaries it as follows:

1) Do not redirect if the page is visited as the result of a POST
2) Keep text after header(Location: ...) to an absolute minimum. Namely a
href=../a
3) Use absolute URLs not relative ones.
4) If you abide by 1,23 it should work with all (most) browsers

Thanks for all the help

Henry.


Christophe Chisogne [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Vincent Jansen wrote:
 If you output a location header then I don't know what the browser will
 do with text sent after that.  Hopefully nothing!

 Be carefull to exit() php code after header-location
 (and some text, see below): otherwise code following
 will be executed! It's a common error.

   I experienced some strange behaviour(=no redirect at all!!) with a
   script that send data after the location header.

   header(Location: http://somesite.nl;);
   die();

 To make things work, just follow the HTTP/1.1 spec[1]:
 PHP just sends a 302 Found code in the http header when using
 PHP header(Location: ...). It's a 'temporary' redirect (browser
 should continue to use previous url), as opposed to a 'permanent'
 redirect (http code 301). Text sent after that fills the body
 of the http request (ex GET), and it shoud
 contain a short hypertext note with a hyperlink to the new URI(s).
 (unless request is HEAD) [2]. Also note that the location url
 must be absolute, not relative [3].

 So use

 1. header(Location: $url); // $url must be absolute
 2. echo ...a href='$url'.../a...; // send body of request
 3. exit() or die(); // to avoid executing of code following

 Forgetting 1 is common error: not all browser will 'redirect' then,
 but most modern browsers do, helping uncompliant applications.

 Forgetting 2 makes impossible to see the redirected page with old
 browsers (they only display the body of 30x request, allowing
 user to manually follow it.. I vaguely remember netscape 2 or 3).

 Forgetting 3 causes bugs, sometimes hard to find.

 Note that things can be different with POST requests.
 If the 302 status code is received in response to a request other than
 GET or HEAD, the user agent MUST NOT automatically redirect the request
 unless it can be confirmed by the user, since this might change the
 conditions under which the request was issued. [4]

 The curious about redirects will read 302 and 301 codes,
 but also 303 and 307 (only since http/1.1)

 [1] http/1.1 RFC (w3c html version)
 http://www.w3.org/Protocols/rfc2616/rfc2616.html
 [2] 302 http code
 http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.3
 [3] Location http header
 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30

 Christophe

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



[PHP] How to make sure a redirect works

2004-03-10 Thread Henry Grech-Cini
Hi All,

I want to randomly select a desitniation page and use cookies to ensure that
refreshes and return visits on the same machine always return to that
desination (assuming the cookie is intact).

Imagine that we have an array of URL's

$url=array(1=dest1.html, dest2.html, dest3.html); // I'm using the
1= so that I don't need to store 0 in a cookie!

and that we have a variable $index which has a value in it (either set to a
cookie value, if this is a refresh or return visit, or a random value [1-3]
if this is the first visit

My question is are there problems with:

?php
header(Location: .$url[$index]);
?

Might some browsers fail to redirect to the required destination?
If so under what circumstances?
Can I use belt and braces and employ HTML and javascript methods
afterwards without introducing problems?

i.e.
?php
header(Location: .$url[$index]);
?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
HTML
HEAD
SCRIPT
!--
window.location.replace=?php echo $url[$index]; ?;
window.location=?php echo $url[$index]; ?; // for NS = 2.x no support
for replace
// --
/SCRIPT
meta http-equiv=REFRESH content=0;URL=?php echo $url[$index]; ?
TITLEForward Page/TITLE
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/HEAD
frameset cols='100%,*' border='0' framespacing='0' frameborder='NO'
FRAME SRC='?php echo $url[$index]; ?' NAME='mainframe' FRAMEBORDER='0'
NORESIZE='noresize' SCROLLING='AUTO'/
FRAME src=blank.html FRAMEBORDER='0' SCROLLING='NO' NORESIZE='noresize'/
/frameset
NOFRAMES
BODY
Your browser appears not to support any form of automatic redirect. Pleasea
href=?php echo $url[$index]; ?click
here/a to be redirected to the web site.
/BODY
/NOFRAMES
/HTML

Any comments or suggestions would be greatly appreciated.

Henry

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



[PHP] Re: Are $_POST and $_GET interchangable?

2004-03-10 Thread Henry Grech-Cini
Hi

You can use both $_GET and $_POST at the same time.

As an example imagine that you had a script that generated a HTML form for
collecting data. And image that that script generated different forms on the
basis of a parameter passed in the URL (i.e. a $_GET value).

Of the top of my head like this:

form metod=post
?php
switch($_GET['formid'])
{
   case 1:
  echo 'enter your name:input type=text name=name
value='.$_POST['name'].'/;
  break;
   case 2:
  echo 'enter you telephone number:input type=text name=tel
value='.$_POST['tel'].'/;
  break;
   default:
 echo oops, no form ID;
 break;
}
?
input type=submit/
/form


you could imagine calling this as follow:

http://www.yoursite.com/form.php?formid=1

or

http://www.yoursite.com/form.php?formid=2

HTH

Henry


David Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I understand the difference between how they process from data.
 Most application seem to reply on $_GET which display the
 session/from/cookie values in the URL windows.

 What I'm not clear on are there times when you have to either $_POST or
 $_GET?

 TX,
 david

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



[PHP] Re: Warning: Cannot modify header information - headers already sent by (output sta

2004-03-10 Thread Henry Grech-Cini
Hi

The problem is that the header requires that no output
be generated by your script before it is invoked.

It makes this clear in the error message when it indicates
that on line 6 you produced output!

Try this instead (although the code seems a little confused).

?php
session_start();
include_once(lib/lib_main.php);
dbConnect($host, $user, $pass);

$password = $_POST['password'];
$username = $_POST['username'];
$sql_login = mysql_query(SELECT id from user WHERE username='$username' and
password=password('$password'));
if(mysql_num_rows($sql_login)) {
header(Location: http://www.index.php;);
   }

echo FORM ACTION=\$PHP_SELF\ METHOD=\POST\;
?
table align=center
  trtdUsername:/tdtd input type=username
name=username/td/tr
  trtdPassword:/tdtd input type=password
name=password/td/tr
trtd/tdtd align=centerinput type=submit name=submit
value=Submit/tdtr

?php echo /FORM; ?



Mike Mapsnac [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 This code below gives me this error message:
 Warning: Cannot modify header information - headers already sent by
(output
 started at /var/www/html/account.php:6) in /var/www/html/account.php on
line
 17

 The script check in the database if user exists and than redirect the page
 to the home index.php page. I know the problem exist in the header() ..
But
 I don't understand why?



 ?php
 session_start();
 include_once(lib/lib_main.php);
 dbConnect($host, $user, $pass);

 echo FORM ACTION=\$PHP_SELF\ METHOD=\POST\;?
 table align=center
   trtdUsername:/tdtd input type=username
 name=username/td/tr
   trtdPassword:/tdtd input type=password
 name=password/td/tr
 trtd/tdtd align=centerinput type=submit name=submit
 value=Submit/tdtr
 ?php echo /FORM;
 $password = $_POST['password'];
 $username = $_POST['username'];
 $sql_login = mysql_query(SELECT id from user WHERE username='$username'
and
 password=password('$password'));
 if(mysql_num_rows($sql_login)) {
 header(Location: http://www.index.php;);
} ?

 _
 Find things fast with the new MSN Toolbar - includes FREE pop-up blocking!
 http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/

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



Re: [PHP] regexp appears to be faulty!?

2004-02-25 Thread Henry Grech-Cini
Absolutely brilliant, also I'm using the /s modifier to process newlines as
well.

Great

Thanks to everybody for their help.

Jome [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Henry Grech-Cini [EMAIL PROTECTED] skrev i meddelandet
 news:[EMAIL PROTECTED]
  Thanks for that Mike,
 
  I was getting lost.
 
  Is there anyway to say
 
  Any characters excluding the sequence /fieldset
 
  so I could do something like
 
  /fieldset([^]*)(.* whilst not \/fieldset)\/fieldset/i
 
  Or alternatively is there a switch to say get the smallest sequence
 

 ? is what you're looking for. i.e.: .*? instead of just .*

 /j

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



[PHP] regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
Hi All,

function extractFieldsets($subject)
{
   $regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
   $replacement;
   $matches=array();

   preg_match_all($regexp, $subject, $matches);

   return ($matches);
}

$result=extractFieldsets('testfieldset attribute=hellocontent of
hello/fieldsetemblah/emfieldset
attribute=goodbyegoodbye/fieldset');
echo br/;
foreach($result as $key=$string)
{
   echo (.$key.)=.br/;
   foreach($string as $subkey=$subres)
echo(.$subkey.)=[.htmlspecialchars($subres).]br/;
   echo br/;
}

And it produced;

(0)=
(0)=[fieldset attribute=hellocon]
(1)=[fieldset attribute=goodbyegoo]

(1)=
(0)=[ attribute=hello]
(1)=[ attribute=goodbye]

Why did it get three letters after the end of the fieldset tag

con and goo.

Any pointers?

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



[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Henry Grech-Cini
Hi All,

I don't actually think regexp is fault. But if anyone could explain this or
give me some example code that will extract the attributes and data between
a fieldset tag pair I would be appreciated.

Henry

Henry Grech-Cini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 function extractFieldsets($subject)
 {
$regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
$replacement;
$matches=array();

preg_match_all($regexp, $subject, $matches);

return ($matches);
 }

 $result=extractFieldsets('testfieldset attribute=hellocontent of
 hello/fieldsetemblah/emfieldset
 attribute=goodbyegoodbye/fieldset');
 echo br/;
 foreach($result as $key=$string)
 {
echo (.$key.)=.br/;
foreach($string as $subkey=$subres)
 echo(.$subkey.)=[.htmlspecialchars($subres).]br/;
echo br/;
 }

 And it produced;

 (0)=
 (0)=[fieldset attribute=hellocon]
 (1)=[fieldset attribute=goodbyegoo]

 (1)=
 (0)=[ attribute=hello]
 (1)=[ attribute=goodbye]

 Why did it get three letters after the end of the fieldset tag

 con and goo.

 Any pointers?

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



[PHP] Re: regexp appears to be faulty (DONT actually think so)

2004-02-24 Thread Henry Grech-Cini
Thanks Sven,

You are quite right with your some probs comment.

Do you know what the the switch is that catches only the least result?

I now get

(0)=
(0)=[fieldset attribute=hellolegendhello legend/legendcontent of
hello/fieldsetemblah/emfieldset
attribute=goodbyegoodbye/fieldset]

(1)=
(0)=[ attribute=hello]

(2)=
(0)=[legendhello legend/legendcontent of
hello/fieldsetemblah/emfieldset attribute=goodbyegoodbye]

as we can see the second fieldset is included in that which is between the
fieldset tags!

:-(

Thanks everyone for you help including Mike (with the post out of chain).

Henry

Sven [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
 Henry Grech-Cini schrieb:
 ...
$regexp=/fieldset([^]*)[^(\/fieldset)]*/i;
 ...
 $result=extractFieldsets('testfieldset attribute=hellocontent of
 hello/fieldsetemblah/emfieldset
 attribute=goodbyegoodbye/fieldset');
 ...
 And it produced;
 (0)=
 (0)=[fieldset attribute=hellocon]
 (1)=[fieldset attribute=goodbyegoo]
 (1)=
 (0)=[ attribute=hello]
 (1)=[ attribute=goodbye]

 hi,

 as it is defined in regex-spec: a '^' inside a char-group '[...]'
 defines all chars, that aren't allowed, and not a string!

 so the first 't' of 'content' and the 'd' of 'goodbye' don't match your
 regex anymore.

 a start for a solution could be:

 ?php
  $rx = '/fieldset[^]*(.*)\/fieldset/i';
 ?

 if you want to take care of your fieldset-attribs in your result, you
 can set your brackets again: ([^]*)

 some probs i can think of are nested fieldsets inside fieldsets (don't
 know by head, if this is allowed by w3). and another prob: is that you
 don't catch multiple fieldsets after another. i think there is a switch,
 that catches only the least result.

 hth SVEN

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



Re: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
Thanks for that Mike,

I was getting lost.

Is there anyway to say

Any characters excluding the sequence /fieldset

so I could do something like

/fieldset([^]*)(.* whilst not \/fieldset)\/fieldset/i

Or alternatively is there a switch to say get the smallest sequence

Thanks

Henry

Mike Ford [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On 24 February 2004 12:40, Henry Grech-Cini wrote:

  Hi All,
 
  function extractFieldsets($subject)
  {
 $regexp=/fieldset([^]*)[^(\/fieldset)]*/i;

 This: [^(\/fieldset)]
 will match any *single* character except the ones listed -- i.e. any
character that isn't one of: ()/defilst

 So this: [^(\/fieldset)]*
 will match any run of characters that is not in that set.

 
  And it produced;
 
  (0)=
  (0)=[fieldset attribute=hellocon]
  (1)=[fieldset attribute=goodbyegoo]
 
  Why did it get three letters after the end of the fieldset tag

 By coincidence, the 4th letter in each case is one of the set listed
above, and so ends the match: t in content and d in goodbye.  If the
second example had ahppened to be, say, au revoir, you'd have got 4
characters (au r).

 Cheers!

 Mike

 -
 Mike Ford,  Electronic Information Services Adviser,
 Learning Support Services, Learning  Information Services,
 JG125, James Graham Building, Leeds Metropolitan University,
 Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
 Email: [EMAIL PROTECTED]
 Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211


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



[PHP] Re: regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
I came accross this link

a href=
http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html

http://www.alpha-geek.com/2003/12/31/do_not_do_not_parse_html_with_regexs.html /a

Do we all agree or should I keep trying?

Henry

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



[PHP] circumventing SAFE MODE Restriction

2003-04-03 Thread Henry Grech-Cini
Hi All,

I want to get a list of files in my own sub-directory from where my .php
file is.

If I use dir(.) then I can list the file in the current directory BUT

If I use dir(./subdirectory) or dir(subdirectory) I get the following
error:

Warning: SAFE MODE Restriction in effect. The script whose uid is 614 is not
allowed to access /home/currentdirectory owned by uid 0 in
/home/currentdirectory/download.php on line 12
Handle:
Path:

Fatal error: Call to a member function on a non-object in
/home/currentdirectory/download.php on line 15

The code looks like this.

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
?php
// get a list of all the .zip files
// generate the page if the .gif or .jpg file of the same name exists use
that as an icon otherwise use a picture!
$d = dir(.\downloads);
echo Handle: .$d-handle.br\n;
echo Path: .$d-path.br\n;
while (false !== ($entry = $d-read())) {
echo $entry.br\n;
}
$d-close();

?
/body
/html

Any ideas about how to get round this other than making a .php file to call
in the subdirectory?

TIA

Henry



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



[PHP] using preg_match to extract information from pop3

2003-03-04 Thread Henry Grech-Cini
Hi All,

I know that you will probably tell me to RTFM but I have (several times) and
I cannot quite understand it!

So failing that I turn to you for help.

I know that this is very trivial but please humour me.

I have a line containing From: Henry henry @ .com 
(please ignore any spaces between the angled braces  , they are just to
fool outlook express)

And I want to extract the name and the email address into the variables
$name $email. I suspect using preg_match?

TIA

Henry



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



[PHP] Re: using preg_match to extract information from pop3

2003-03-04 Thread Henry Grech-Cini
Hi All,

This has to be easy to do using preg_match!
Can no one spare a minute of their time?

Henry

Henry Grech-Cini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 I know that you will probably tell me to RTFM but I have (several times)
and
 I cannot quite understand it!

 So failing that I turn to you for help.

 I know that this is very trivial but please humour me.

 I have a line containing From: Henry henry @ .com 
 (please ignore any spaces between the angled braces  , they are just to
 fool outlook express)

 And I want to extract the name and the email address into the variables
 $name $email. I suspect using preg_match?

 TIA

 Henry





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



[PHP] Re: using preg_match to extract information from pop3

2003-03-04 Thread Henry Grech-Cini
I tried

if(preg_match(/^From:(.*)$/, $headers[$line], $info))
   {
   echo [;
print_r($info);
echo ];
echo PRE,HtmlSpecialChars($headers[$line]),/PRE;

   }

But all I get is

[Array ( [0] = From: [1] = ) ]
From: Henry henry @ .com 

Any pointers?


Henry Grech-Cini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 I know that you will probably tell me to RTFM but I have (several times)
and
 I cannot quite understand it!

 So failing that I turn to you for help.

 I know that this is very trivial but please humour me.

 I have a line containing From: Henry henry @ .com 
 (please ignore any spaces between the angled braces  , they are just to
 fool outlook express)

 And I want to extract the name and the email address into the variables
 $name $email. I suspect using preg_match?

 TIA

 Henry





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



[PHP] Re: using preg_match to extract information from pop3

2003-03-04 Thread Henry Grech-Cini
Found a solution

if (preg_match(/Form:[ ]*(.+)[ ]*(.+)/, Form:Henry [EMAIL PROTECTED],
$info))
{
 print_r($info);
}
else
 print Pattern not found;

but I'm refining it so that it doesn't need the last bit, any more pointers
appreciated!!!

Thanks All

Henry

Henry Grech-Cini [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi All,

 I know that you will probably tell me to RTFM but I have (several times)
and
 I cannot quite understand it!

 So failing that I turn to you for help.

 I know that this is very trivial but please humour me.

 I have a line containing From: Henry henry @ .com 
 (please ignore any spaces between the angled braces  , they are just to
 fool outlook express)

 And I want to extract the name and the email address into the variables
 $name $email. I suspect using preg_match?

 TIA

 Henry





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



[PHP] Session variable under PHP 4.0.6

2003-03-03 Thread Henry Grech-Cini
Hi All,

I'm having a problem with session variables under PHP 4.0.6 on a secure
server. I ran phpinfo and have attached the resulting page after the main
body of this message.

My test code looks like this

Filename: index.php

Page Start --

?php
session_start();

$HTTP_SESSION_VARS['variable']=the variables value;

?
a href=index2.phpclick here/a to go to the next page

Page End --


Next file
Filename: index2.php

Page Start --

?php
session_start();

print_r($HTTP_SESSION_VARS);

echo --gt;.$HTTP_SESSION_VARS['variable'].lt;--;
?

Page End --


Suffice to say it doesn't work. The first page displays

click here to go to the next page


as expected. However clicking on the link takes you to index2.php and the
following is displayed:


Array ( ) 


Namely that the session variable called variable is not set in the
session.


I have run the exact same code on a machine running PHP 4.2.3 (non secure
servers) and it works perfectly! And outputs:

Array ( [variable] = the variables value ) --the variables value--

Exactly as required!!



I hope that you can help, since I am getting frustrated after 4 days trying
to fix this problem.

Henry



--
Sorry about the formating but this is what I got from phpinfo from the
machine

PHP Version 4.0.6


Build Date Oct  7 2001
Configure Command  './configure' '--with-mysql' '--with-apxs=/usr/sbin/apxs'
'--enable-track-vars' '--with-config-file-path=/etc' '--enable-magic-quotes'
'--enable-apc=shared' '--with-xml' '--enable-trans-sid' '--with-pgsql'
'--with-zlib'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php.ini
ZEND_DEBUG disabled
Thread Safety disabled

 This program makes use of the Zend scripting language engine:
Zend Engine v1.0.6, Copyright (c) 1998-2001 Zend Technologies
with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend
Technologies







PHP 4.0 Credits




Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference
 On On
allow_url_fopen
 1 1
arg_separator.input
  
arg_separator.output
  
asp_tags
 Off Off
auto_append_file
 no value no value
auto_prepend_file
 no value no value
browscap
 no value no value
default_charset
 no value no value
default_mimetype
 text/html text/html
define_syslog_variables
 Off Off
disable_functions
 no value no value
display_errors
 On On
display_startup_errors
 Off Off
doc_root
 no value no value
enable_dl
 On On
error_append_string
 no value no value
error_log
 no value no value
error_prepend_string
 no value no value
error_reporting
 2039 2039
expose_php
 On On
extension_dir
 ./ ./
file_uploads
 1 1
gpc_order
 GPC GPC
highlight.bg
 #FF #FF
highlight.comment
 #FF9900 #FF9900
highlight.default
 #CC #CC
highlight.html
 #00 #00
highlight.keyword
 #006600 #006600
highlight.string
 #CC #CC
html_errors
 On On
ignore_user_abort
 Off Off
implicit_flush
 Off Off
include_path
 .:/usr/local/lib/php .:/usr/local/lib/php
log_errors
 Off Off
magic_quotes_gpc
 On On
magic_quotes_runtime
 Off Off
magic_quotes_sybase
 Off Off
max_execution_time
 30 30
open_basedir
 no value no value
output_buffering
 Off Off
output_handler
 no value no value
post_max_size
 8M 8M
precision
 14 14
register_argc_argv
 On On
register_globals
 On On
safe_mode
 Off Off
safe_mode_exec_dir
 no value no value
sendmail_from
 [EMAIL PROTECTED] [EMAIL PROTECTED]
sendmail_path
 /usr/sbin/sendmail -t -i  /usr/sbin/sendmail -t -i
short_open_tag
 On On
SMTP
 localhost localhost
sql.safe_mode
 Off Off
track_errors
 Off Off
upload_max_filesize
 2M 2M
upload_tmp_dir
 no value no value
user_dir
 no value no value
variables_order
 EGPCS EGPCS
y2k_compliance
 Off Off


xml
XML Support active


standard
Regex Library Bundled library enabled
Dynamic Library Support enabled
Path to sendmail /usr/sbin/sendmail -t -i

Directive Local Value Master Value
assert.active
 1 1
assert.bail
 0 0
assert.callback
 no value no value
assert.quiet_eval
 0 0
assert.warning
 1 1
safe_mode_allowed_env_vars
 PHP_ PHP_
safe_mode_protected_env_vars
 LD_LIBRARY_PATH LD_LIBRARY_PATH
session.use_trans_sid
 1 1
url_rewriter.tags
 a=href,area=href,frame=src,input=src,form=fakeentry
a=href,area=href,frame=src,input=src,form=fakeentry


session
Session Support enabled

Directive Local Value Master Value
session.auto_start
 Off Off
session.cache_expire
 180 180
session.cache_limiter
 nocache nocache
session.cookie_domain
 no value no value
session.cookie_lifetime
 0 0
session.cookie_path
 / /
session.cookie_secure
 Off Off
session.entropy_file
 no value no value
session.entropy_length
 0 0
session.gc_maxlifetime
 1440 1440
session.gc_probability
 1 1
session.name
 PHPSESSID PHPSESSID

[PHP] where do you recommend I put useful code for people to use?

2003-03-03 Thread Henry Grech-Cini
Hi All,

I've written some javascript that serializes javascript variables so that
they can be sent to PHP and unserialized there. Is this silly thing to have
done? i.e. is it already done or superfluous for some reason? Or, if it is
not, where would I put the code to share it with others. Thing is that
although its meant for use with PHP it is javascript so I'm not sure where
to post it.

Henry



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



[PHP] Re: Problems posting

2003-03-03 Thread Henry Grech-Cini
Did you send this post at 17:17 and did it arrive at 17:22?

Niels Andersen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When I post something here, it first appears several hours later. How can
it
 be so?





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



Re: [PHP] Session variable under PHP 4.0.6

2003-03-03 Thread Henry Grech-Cini
Thanks that works in my testing example. But why? The manual says:

Caution
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
session_register(), session_is_registered() and session_unregister().

But in index2.php I am using $HTTP_SESSION_VARS and it works?!

Need a bit of clarification since my actual app still doesn't work!

Henry

Kirk Johnson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In the first file, replace this line:

 $HTTP_SESSION_VARS['variable']=the variables value;

 with these two lines:

 $variable = the variables value;
 session_register('variable');

 This is because 'register_globals' is enabled in the php.ini file.

 Kirk

  -Original Message-
  From: Henry Grech-Cini [mailto:[EMAIL PROTECTED]
  Sent: Monday, March 03, 2003 9:34 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Session variable under PHP 4.0.6
 
 
  Hi All,
 
  I'm having a problem with session variables under PHP 4.0.6
  on a secure
  server. I ran phpinfo and have attached the resulting page
  after the main
  body of this message.
 
  My test code looks like this
 
  Filename: index.php
 
  Page Start --
 
  ?php
  session_start();
 
  $HTTP_SESSION_VARS['variable']=the variables value;
 
  ?
  a href=index2.phpclick here/a to go to the next page
 
  Page End --
 
 
  Next file
  Filename: index2.php
 
  Page Start --
 
  ?php
  session_start();
 
  print_r($HTTP_SESSION_VARS);
 
  echo --gt;.$HTTP_SESSION_VARS['variable'].lt;--;
  ?
 
  Page End --
 
 
  Suffice to say it doesn't work. The first page displays
 
  click here to go to the next page
 
 
  as expected. However clicking on the link takes you to
  index2.php and the
  following is displayed:
 
 
  Array ( ) 
 
 
  Namely that the session variable called variable is not set in the
  session.
 
 
  I have run the exact same code on a machine running PHP 4.2.3
  (non secure
  servers) and it works perfectly! And outputs:
 
  Array ( [variable] = the variables value ) --the variables
  value--



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



[PHP] processing pop3 inbox

2003-03-03 Thread Henry Grech-Cini
Hi All,

I need to process the inbox. Any pointers, I don't use Perl and would like
to use PHP. Also I do not have PHP compiled for a comand line so I'll
probably use a crontab and unix text based web browser to invoke the PHP
page to process the inbox.

TIA Any help much appreciated.

Henry



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



[PHP] Re: PHP shopping carts

2003-03-03 Thread Henry Grech-Cini
Hi,

Please let me know if you find one thats any good?

Henry

Dan Sabo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 What I'm looking for is either an open source or commercial solution which
 is supported by either commercial or OS add on modules.  I've looked at OS
 commerce and X cart so far, wanted to look at a few more.

 I'm hoping to find one which has a hotel booking or reservation system
 either as a standard or as an add on mod, and am doing some comparisons.

 Thanks,

 Dan




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



[PHP] Using php as a scripting language within cron jobs?

2002-05-17 Thread Henry Grech-Cini

Hi All,

Is this possible?

I really don't want to go back to perl5 to setup an autoresponder system!

Henry



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




[PHP] Newline in fputs

2002-05-16 Thread Henry Grech-Cini

Dear All,

Firstly, I am a newbie to php so please be gentle.

I'm having problems with carriage returns placed in a file on a Linux based
server. When this file is download to a WindowsXP machine the carriage
returns are quite frankly useless. I just get [] (where [] represents an
undisplayable character. No actual carriage returns or newlines!

I generate the file using the following code (fragment only):

 while($row=mysql_fetch_array($mysql_result))
{
  $f_title=$row[title];
  $f_first_name=$row[first_name];
  $f_surname=$row[surname];
  $f_email=$row[email];
  fputs($file_op,$f_title, $f_first_name, $f_surname, $f_email\n);
}

I then use the following link to a download_it.php script as described in
Tansley as follows:

$parameters=file_name=.urlencode($file_name).file_size=$file_size;
 echo A HREF=\downloadit.php?$parameters\download it/A;

The download_it.php file looks as follows:
?php
#downloadit.php
$file_name=urldecode($file_name);
header(Content-type: Application/octet-stream);
header(Content-Disposition: attachment;filename=download/download.txt);
header(Content-Description: PHP Download);
header(Content-Length: $file_size);
readfile($file_name);
?

Appart from the fact that the Content-Disposition appears not to be working
under IE6 since the file name is not correct.

The downloaded file does not contain Windows type carriage returns of
newlines! However it does contains the data thank goodness.

What is the fix?

Henry Grech-Cini



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




[PHP] Re: fsockopen

2002-05-16 Thread Henry Grech-Cini

I'm confused!

Did you want to make a new post for this comment or a reply to another post.
Or does it in some way relate to my question. On my newsgroup browser it
appears as if this post is in the wrong place! In answer to my post on
Newlines in fputs

Thanks for responding anyway.

Henry

Scott St. John [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am using fsockopen to test several of our SQL and WEB servers at our
 office.  Testing ports 80, 1433 and 8080 work fine, but I would like to
 set something up to test ports on our mainframe.  These are printers
 listening on 9100 and when I test it fails.  I don't see anything in the
 online docs about going above a certain port - or is there something else.

 Thanks,

 -Scott





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