Re: [PHP] php created pages's create time

2002-08-26 Thread Rasmus Lerdorf

So use the Header() function to send an appropriate Last-Modified
timestamp.  PHP can't possibly do that automatically as it does not know
the last modication time of the actual dynamic data that you send.

-Rasmus

On Tue, 27 Aug 2002, lin wrote:

> Dear Sir,
>
> we use php4.1.1+apache put html pages to IE from mysql DB, We find the
> created pages's create time is not availability, this let me a lot of
> discommodity, our webpage cann't index in yahoo etc. search engine.
>
> please help me, let me know how to avoid it.
>
>
> Mr.lin
>
>
>
> --
> 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 - Chat?

2002-08-26 Thread Andy

HI there,

I am wondering if a Chat coded in PHP would be sufficiant for a medium sized
site. Maybe someone has a working example online. It would be no problem to
get a ircdeamon working, just the client is in question.

Thank you for your suggestions,

Andy








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




Re: [PHP] Tricky question - referrer from ousite, or from intern?

2002-08-26 Thread hugh danaher

IFF they just left one of your other sites, then you should be able to pass
a variable in the other site's header such as:

php.net/function-name?variable=from_somewhere_I_own

if the variable isn't set, then they came from a site you don't own.

or you could send them to a unique function-name where you can then record a
hit on that function-name.

- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 10:58 PM
Subject: [PHP] Tricky question - referrer from ousite, or from intern?


> Hi there,
>
> I have a tricky problem which I honestly think is not possible to solve.
> However maybe I am wrong.
>
> As you all know it is possible on php.net to pass a function name just
> behind the adress (e.G. php.net/function-name) this will redirct to the
> propper page. I did the same thing with member sites (e.G
> server.com/member-name) Now I am starting a referrer programm. Every
member
> who follows a link like from anywhere on the net and registeres will be
> tracked and the referrer gets a point. Now I did forget that I do have
> several of this links on my site itself :-) Which means that they have
been
> aquired on my site by accident :-)
>
> My question is how can I make sure that they do come from outside and are
> not surfing my site already. I do set a coockie as soon as someone enteres
> this adress, but it would be fantastic if I could do a if statement on
> something to make sure he does not come from my own site. I would like to
> keep all the links like that, just to find a way to track the origin of
the
> user.
>
> Thank you so much for any idea on this tricky task,
>
> Andy
>
>
>
>
>
>
>
> --
> 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: XML/XSL

2002-08-26 Thread Alia Mikati

Hi everybody,
I'm using Sablotron to transform XML with XSL and this is the PHP file:

\n";
$strXhtml = $strXhtml . "\n";
$strXhtml = $strXhtml . "Balance:\n";
$strXhtml = $strXhtml . "\n";
$strXhtml = $strXhtml ."";
//echo(trim($strXhtml));

include("XSLTransformer.php"); 
$xml=$strXhtml; 
$xsl="testing.xsl"; 

$transform = new XSLTransformer(); 
if($transform->setXsl($xsl)) { 
   if($transform->setXmlString($xml)) { 
  $transform->transform(); 
  if ($transform->getError() == 0) { 
 echo $transform->getOutput(); 
  } else { 
 echo "Error transforming ",$xml,".\n"; 
  } 
   } else { 
  echo "",$xml,": ",$transform->getError(),"\n"; 
   } 

$transform->destroy(); 
} ?> 


I'm getting the following warning although I'm sure that if I applied XSL 
to the XML file without php, it's working. Plz can u help me and tell me 
what could be the problem?
Warning: xslt_process(): supplied argument is not a valid XSLT Processor 
resource in /home/alia/public_html/XHTML/XSLTransformer.php on line 69

Thx a lot



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




[PHP] php created pages's create time

2002-08-26 Thread lin

Dear Sir,

we use php4.1.1+apache put html pages to IE from mysql DB, We find the
created pages's create time is not availability, this let me a lot of
discommodity, our webpage cann't index in yahoo etc. search engine.

please help me, let me know how to avoid it.


Mr.lin



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




[PHP] Re: php created pages's create time

2002-08-26 Thread lin

Dear Sir,

we use php4.1.1+apache put html pages to IE from mysql DB, We find the
created pages's create time is not availability, this let me a lot of
discommodity, our webpage cann't index in yahoo etc. search engine.

please help me, let me know how to avoid it.


Mr.lin




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




[PHP] Tricky question - referrer from ousite, or from intern?

2002-08-26 Thread Andy

Hi there,

I have a tricky problem which I honestly think is not possible to solve.
However maybe I am wrong.

As you all know it is possible on php.net to pass a function name just
behind the adress (e.G. php.net/function-name) this will redirct to the
propper page. I did the same thing with member sites (e.G
server.com/member-name) Now I am starting a referrer programm. Every member
who follows a link like from anywhere on the net and registeres will be
tracked and the referrer gets a point. Now I did forget that I do have
several of this links on my site itself :-) Which means that they have been
aquired on my site by accident :-)

My question is how can I make sure that they do come from outside and are
not surfing my site already. I do set a coockie as soon as someone enteres
this adress, but it would be fantastic if I could do a if statement on
something to make sure he does not come from my own site. I would like to
keep all the links like that, just to find a way to track the origin of the
user.

Thank you so much for any idea on this tricky task,

Andy







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




Re: [PHP] Re: Output Compression & output buffering..

2002-08-26 Thread Gerard Samuel

Basically the included file containing the error handler is like so ->
-

--
In another file, I start compression like ->
if ($compress == '1')
{
ob_start('gz_handler');
}
-

Then at the end of the script I have ob_end_flush();

I believe the sequence of events are correct.
I just so happened to pass by zend.com, and in the newsletter #100
from the 26th, there is a blurb about ob_gzhandler being broken.  Im 
running php 4.2.2, so it may apply to me, as Im getting
the blank page that its describing.

Thanks for your help.


Eric Pignot wrote:

>Hi Gerard,
>
>I never had any problem using output buffering...
>Do you correctly dump the buffer when an error occurs ? I suppose you have
>built your own error() function, a bit like this one :
>
>exit_on_error($msg){
>ob_end_clean();
>echo $msg;
>exit();
>}
>
>can you tell us a bit more concerning the way you handle the exit of your
>program ?
>
>regards
>
>Eric
>
>
>
>"Gerard Samuel" <[EMAIL PROTECTED]> a écrit dans le message de news:
>[EMAIL PROTECTED]
>  
>
>>In an included file, I have an error handler that is using the 'output
>>buffering' trick to
>>dump a page in progress to display the error page.
>>I also happened to have a switch to turn on output compression.
>>When output compression is on, if an error is comitted while the page is
>>displaying, I get an empty page,
>>instead of the expected error page or the page hangs, depending on the
>>browser.
>>
>>Has anyone gotten both forms of output control to work together without
>>ill side effects??
>>
>>Thanks
>>
>>--
>>Gerard Samuel
>>http://www.trini0.org:81/
>>http://dev.trini0.org:81/
>>
>>
>>
>>
>
>
>
>  
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




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




[PHP] Re: Date conversion problems

2002-08-26 Thread David Robley

In article <[EMAIL PROTECTED]
maeci.gc.ca>, [EMAIL PROTECTED] says...
> Having a little trouble with converting dates.
> 
> I have, in my database, a bunch of dates stored like this: -M. Month is
> obviously the number of the month (5), not the name (May).
> 
> I want to convert the format to MMM,  (ex: May, 2002), so I used the
> mktime function. Basically I extract the date with a regular MySQL query,
> then explode the date, and my components look great. However, when I put the
> components into my mktime function, sometimes it'll work and sometimes it
> won't. It won't work if the date is too far off in the future (2085, etc.),
> but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
> works fine.
> 
> My code is this (after grabbing the query results):
> $enddate = explode("-", $datereuslt[0]);
> $fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
> $finaldate = date("M, Y", $fullenddate);
> 
> Any ideas? Alternatively, if anyone has an easier way of doing this, I'm all
> ears.
> 

Hmm, as mktime returns a unix timestamp it'll be constrained by that; 
currently the unix timestamp covers a range from 1 Jan 1970 to (mumble) 
January 2038.

However, if your date is stored using one of the mysql date or time 
formats, why not try using mysql's DATE_FORMAT to pretty it up as you 
select from the db? IIRC some of the date column types have a range of 
around 10,000 years, which should meet your needs.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] pattern matching urls

2002-08-26 Thread Justin French

I spotted a class or function on phpclasses.org a few days back that does
this.

Justin French


on 28/08/02 4:40 AM, tux ([EMAIL PROTECTED]) wrote:

> 
> 
> 
> hey all,
> 
> Just wanting some advice on something im doing, basically im storing
> news into mysql and what i want to do is, when the news is displayed, if
> a url is in there ie(http://www.blahblah.com OR
> mailto:[EMAIL PROTECTED]) it will automatically be displayed as a link,
> im considering using preg_match for this but i was wondering if there is
> any other function already designed for automatically detecting urls?
> 
> cheers,
> 
> Jo
> 


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




[PHP] pattern matching urls

2002-08-26 Thread tux




hey all,

Just wanting some advice on something im doing, basically im storing
news into mysql and what i want to do is, when the news is displayed, if
a url is in there ie(http://www.blahblah.com OR
mailto:[EMAIL PROTECTED]) it will automatically be displayed as a link,
im considering using preg_match for this but i was wondering if there is
any other function already designed for automatically detecting urls? 

cheers,

Jo


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




Re: [PHP] PHP: User Authentication Script

2002-08-26 Thread Farianto Kurniawan

...hello .. Mr.Anthony Ritter ..

Actually I have faced the same problem with you but right now I can fix it .

What you must do is :
1. Turn off your Apache Web Server
2. Edit your httpd.conf file from folder conf under Apache folder.
3. Please add this sentence  --   LoadModule php4_module
c:/Apache/php/sapi/php4apache.dll   -- in it. (the important thing   that
php4apache.dll is in that directory , if itsn't change it to the right
position.
4. Save it
5. Turn Your Apache Web Server on.

I hope it can work know...

Regards,

Farianto.K
PT.Yosibara Inti Corpora
Phone: 62-21-5267645/46
Indonesia


- Original Message -
From: "Anthony Ritter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 27, 2002 10:01 AM
Subject: Re: [PHP] PHP: User Authentication Script


> In my
> phpinfo()
>
> I get:
> php version 4.0.0
>
> Server_APICGI
> ..
>
> Is this why it is not working?
>
> If so, how does one install PHP as a "module"?
>
> Please advise.
> Thank you.
>
> TR
> ...
>
> Warren Vail wrote in message:
>
> > http://www.php.net/manual/en/features.http-auth.php also mentions that
> http
> > auth does not work when running php as a CGI, which may also give these
> > symptoms.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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




[PHP] Re: Forcing browsers to use cached pages

2002-08-26 Thread Richard Lynch

>Is there any way to force a browser to use a cached version of a page if the
>user hits the back button?

"Force" might be a bit too strong, but there are a bunch of headers about
Cache-control and Expiration and such-like that you can convince a lot more
to cache a document than do without the headers.

But there's no way you'll get every single browser to all do the same thing
with caching.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Output Compression & output buffering..

2002-08-26 Thread Eric Pignot

Hi Gerard,

I never had any problem using output buffering...
Do you correctly dump the buffer when an error occurs ? I suppose you have
built your own error() function, a bit like this one :

exit_on_error($msg){
ob_end_clean();
echo $msg;
exit();
}

can you tell us a bit more concerning the way you handle the exit of your
program ?

regards

Eric



"Gerard Samuel" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> In an included file, I have an error handler that is using the 'output
> buffering' trick to
> dump a page in progress to display the error page.
> I also happened to have a switch to turn on output compression.
> When output compression is on, if an error is comitted while the page is
> displaying, I get an empty page,
> instead of the expected error page or the page hangs, depending on the
> browser.
>
> Has anyone gotten both forms of output control to work together without
> ill side effects??
>
> Thanks
>
> --
> Gerard Samuel
> http://www.trini0.org:81/
> http://dev.trini0.org:81/
>
>



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




Re: [PHP] FW: Need example of Next 5>>

2002-08-26 Thread Justin French

Do you have phpMyAdmin on your server?

Because when it displays a table with more than 30 results, it splits it
into pages of 30.  The brilliant bit is that it always displays the query up
the top of the page, so you can learn what's going on.

You want to read up on LIMIT in the MySQL manual.

In short, SELECT * FROM 'mytable' LIMIT 60, 30 Will return rows 60 through
to 90.

Then you need to dynamically generate your next and back links, which pass
some kind of offset to the query:

next 10

Your query might look like:

$sql = "SELECT * FROM mytable LIMIT {$_GET['offset']}, 10";


Good luck.


Justin


on 27/08/02 7:45 AM, pax ([EMAIL PROTECTED]) wrote:

> 
> Hi,
> 
> I am looking for an example in php/MySql dealing with Next 5 > type of
> queries ..does anyone have any links?
> 
> Thank you for your help
> Pax
> 
> 


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




Re: [PHP] Forcing browsers to use cached pages

2002-08-26 Thread Chris Shiflett

There is no way to force the behavior, but you can exclude the HTTP 
headers that tell the Web browser to not cache the pages.

Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Expires: 
etc.

I believe PHP may include some or all of these when you use session 
management. A browser that adheres to these HTTP headers will explicitly 
not cache pages, and the "no-store" directive of the Cache-Control 
header actually forbids the Web browser from even storing a copy of the 
resource. IE ignores the "no-store" directive and treats it like 
"no-cache" instead.

I believe most (if not all) Web browsers will cache resources when not 
forbidden to do so.

You should just be able to use the header() function to overwrite these 
values.

Happy hacking.

Chris

Mike Mannakee wrote:

>Hi all,
>
>Is there any way to force a browser to use a cached version of a page if the
>user hits the back button?
>
>Mike
>
>
>
>  
>



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




Re: [PHP] filter files in a directory

2002-08-26 Thread Justin French

You need to have a look at the regular expression functions like ereg,
eregi, ereg_replace, eregi_replace and the preg functions.

The manual itself doesn't document regular expression pattern matching that
well, but there is a reasonable starter article here:

http://www.phpbuilder.com/columns/dario19990616.php3


Anyhoo, rather than testing for
$files != "*.config"
you need to test for
!ereg('.config$', $files)
which means if the file doesn't END with .config.

Similarly, you could also rule out .. and . with another regular expression:
!eregi('^.', $files)


Revised code, untested:




Justin French



on 27/08/02 4:03 AM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

> I am showing a directory of files and I don't what all the files to
> show on the screen. I was able to get the . and the .. not to show
> with what I have below but there are some other files in there that look
> like this mylist.confg. I don't want them to show in the directory
> list. I tried && $files != "*.config"  but this did not work .
> Anybody have an suggestions on how to do this . I have look through
> the manual and the mailing list but can't figure out how to make the
> pattern to keep this from showing
> 
> if ($handle = opendir('/path/to/list/directory')) {
> while (false !== ($files = readdir($handle))) {
> if ($files != "." && $files != "..") {
> echo $files;
> }
> 


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




Re: [PHP] PHP: User Authentication Script

2002-08-26 Thread Anthony Ritter

In my
phpinfo()

I get:
php version 4.0.0

Server_APICGI
..

Is this why it is not working?

If so, how does one install PHP as a "module"?

Please advise.
Thank you.

TR
...

Warren Vail wrote in message:

> http://www.php.net/manual/en/features.http-auth.php also mentions that
http
> auth does not work when running php as a CGI, which may also give these
> symptoms.




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




RE: [PHP] PHP: User Authentication Script

2002-08-26 Thread Vail, Warren

Was this before supplying the password or after?

I believe this log entry may be normal when authentication fails.

I also believe the message you got on your browser means that the 401 error
page is missing from your apache installation.

http://www.php.net/manual/en/features.http-auth.php also mentions that http
auth does not work when running php as a CGI, which may also give these
symptoms.

Warren Vail
Tools, Metrics & Quality Processes

-Original Message-
From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 26, 2002 7:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] PHP: User Authentication Script


Thanks for the reply Warren.

It says...

[Mon Aug 26 20:46:13 2002] [error] [client 127.0.0.1] malformed header from
script. Bad header=HTTP/1.0 401 Unauthorized: c:/php4/php.exe
...


- Original Message -
From: Vail, Warren <[EMAIL PROTECTED]>
To: 'Anthony Ritter' <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 7:49 PM
Subject: RE: [PHP] PHP: User Authentication Script


> What does your apache server log say?
>
>
> Warren Vail
> Tools, Metrics & Quality Processes
> (415) 667-7814
> Pager (877) 774-9891
> 215 Fremont 02-658
.

> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 6:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP: User Authentication Script
>
>
> Using Apache / Windows 98 / PHP / mySQL
>
> The following script is from Julie Meloni's book "PHP Essentials"
> (PrimaTech) on page 138.
>
> I've copied the script from her site and tried to run it and get the
> following:
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable
> to complete your request.
> Please contact the server administrator, [EMAIL PROTECTED] and inform them of
> the time the error occurred, and anything you might have done that may
have
> caused the error.
>
> More information about this error may be available in the server error
log.
>
> --
>
> Apache/1.3.12 Server at localhost Port 80
> ---
>
> The following is the script:
>
> 
> if (!isset($PHP_AUTH_USER))
>
>
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else
>
>
> if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == "mypassword"))
>
>
> echo "You have entered this username: $PHP_AUTH_USER";
> echo "You have entered this password: $PHP_AUTH_PW";
> echo "The authorization type is: $PHP_AUTH_TYPE.";
>
> } else
>
>
> echo "You are not authorized!";
>
> }
>
> }
>
> ?>




Warren Vail <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What does your apache server log say?
>
>
> Warren Vail
> Tools, Metrics & Quality Processes
> (415) 667-7814
> Pager (877) 774-9891
> 215 Fremont 02-658
>
>
> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 6:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP: User Authentication Script
>
>
> Using Apache / Windows 98 / PHP / mySQL
>
> The following script is from Julie Meloni's book "PHP Essentials"
> (PrimaTech) on page 138.
>
> I've copied the script from her site and tried to run it and get the
> following:
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable
> to complete your request.
> Please contact the server administrator, [EMAIL PROTECTED] and inform them of
> the time the error occurred, and anything you might have done that may
have
> caused the error.
>
> More information about this error may be available in the server error
log.
>
> --
>
> Apache/1.3.12 Server at localhost Port 80
> ---
>
> The following is the script:
>
> 
> if (!isset($PHP_AUTH_USER))
>
>
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else
>
>
> if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == "mypassword"))
>
>
> echo "You have entered this username: $PHP_AUTH_USER";
> echo "You have entered this password: $PHP_AUTH_PW";
> echo "The authorization type is: $PHP_AUTH_TYPE.";
>
> } else
>
>
> echo "You are not authorized!";
>
> }
>
> }
>
> ?>
>
>
>
>
> --
> 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/unsu

RE: [PHP] Re: Trouble Downloading Files

2002-08-26 Thread Roger Lewis

Richard Lynch responded
Monday, August 26, 2002 3:28 PM
to Roger Lewis

>I'm not certain this is the right place to ask, but here goes.  For
security
> >reasons I have placed certain document files in a directory outside my
web
> >root. There are many types of files included (e.g. jpg, gif, txt, pdf,
xls,
> >doc, mdb, ppt, and dwg).  Clicking links on my web page will download the
> >files through a php script (getdocfile.php) into a new pop-up window.
The
> >following is how I have coded the link:
> >
> > >onclick="window.open('../getdocfile.php?file= >$DrawingGroups->Value("filename")?>',
> >'_blank','resizable=yes,scrollbars=yes,width=700,height=500');return
> >false">Value("is_viewable")?>
> >
> >
> >Problem: The download fails with IE5.5 when trying to retrieve files
other
> >than jpg, gif, txt, and pdf.  One of the following happens depending on
> >whether or not I force the download dialog box for the file to appear:
> >(Note: I force the download dialog by commenting out the appropriate mime
> >types in the code below)
>
> IE is stupid.
>
> Really, really stupid.
>
> Not that Netscape is any smarter, or anything, but IE is really really
> really stupid.
>
> In particular, their hack to have embedded documents in a browser and
stuff
> rely on the URL of the thing being downloaded and when you start crossing
> that with your .php URL and JavaScript's popup windows, all hell breaks
> loose, as you've noted.
>
> Things you *might* try:
> 1. Rename the getdocfile.php to getdocfile.htm and force Apache to make it
a
> PHP file.
>
> 2. Get rid of the ?file= part, and just use
> /Value('filename')?> and then use $path_info in your
> getdocfile.htm script instead of $_GET['file']
>
> 3. Whoops.  2. conflicts with 3.  You maybe be "stuck" with something
really
> stupid like using:
> /Value('filename')?>.htm and then
> inside of getdocfile.htm you'll need to de-construct the foo_pdf.htm back
> into foo.pdf to get the file you actually want.
> Yes, your URLs will now look very strange, but remember how stupid IE is?
> It's really stupid.
>
> 4. You may even need to go so far as to have the popup window have a META
> tag to re-locate to the actual document you want, so that only an HTML
> document is the first thing to appear in the popup window.  Again, IE is
> really stupid, and as soon as you cross a popup with a non-HTML document
(of
> certain types you have begun to discover empirically) it screws up.
>
> I never have figured out which/why/when IE screws up popups with non-HTML
> content and don't really care cuz I hate popups...  But it's a known
issue,
> and there's not much you can do about it other than make IE happy by
> following the adage:  "Don't do that."




Richard,

Did you see my reply to your recent response to David Buerer in "Re: set
filename of file open/download"?

After searching everything I could find on the subject, and hours of trying
as many combinations of headers as I could think of, I got everything to
work the way I wanted in "both" IE and NN.  The pop-up pops up. The jpg and
pdf, etc. files open in the windows.  If it's an xls or some such file, the
dialog asks if I want to save or open.  Whatever my response, it knows the
filename and behaves as requested.  Hard to believe.  :)  I believe the key
was to add:

header('Cache-Control: public');

Any thoughts as to why this is needed for MSIE.

Roger

--
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: User Authentication Script

2002-08-26 Thread Anthony Ritter

Thanks for the reply Warren.

It says...

[Mon Aug 26 20:46:13 2002] [error] [client 127.0.0.1] malformed header from
script. Bad header=HTTP/1.0 401 Unauthorized: c:/php4/php.exe
...


- Original Message -
From: Vail, Warren <[EMAIL PROTECTED]>
To: 'Anthony Ritter' <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 7:49 PM
Subject: RE: [PHP] PHP: User Authentication Script


> What does your apache server log say?
>
>
> Warren Vail
> Tools, Metrics & Quality Processes
> (415) 667-7814
> Pager (877) 774-9891
> 215 Fremont 02-658
.

> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 6:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP: User Authentication Script
>
>
> Using Apache / Windows 98 / PHP / mySQL
>
> The following script is from Julie Meloni's book "PHP Essentials"
> (PrimaTech) on page 138.
>
> I've copied the script from her site and tried to run it and get the
> following:
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable
> to complete your request.
> Please contact the server administrator, [EMAIL PROTECTED] and inform them of
> the time the error occurred, and anything you might have done that may
have
> caused the error.
>
> More information about this error may be available in the server error
log.
>
> --
>
> Apache/1.3.12 Server at localhost Port 80
> ---
>
> The following is the script:
>
> 
> if (!isset($PHP_AUTH_USER))
>
>
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else
>
>
> if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == "mypassword"))
>
>
> echo "You have entered this username: $PHP_AUTH_USER";
> echo "You have entered this password: $PHP_AUTH_PW";
> echo "The authorization type is: $PHP_AUTH_TYPE.";
>
> } else
>
>
> echo "You are not authorized!";
>
> }
>
> }
>
> ?>




Warren Vail <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What does your apache server log say?
>
>
> Warren Vail
> Tools, Metrics & Quality Processes
> (415) 667-7814
> Pager (877) 774-9891
> 215 Fremont 02-658
>
>
> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 6:51 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] PHP: User Authentication Script
>
>
> Using Apache / Windows 98 / PHP / mySQL
>
> The following script is from Julie Meloni's book "PHP Essentials"
> (PrimaTech) on page 138.
>
> I've copied the script from her site and tried to run it and get the
> following:
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable
> to complete your request.
> Please contact the server administrator, [EMAIL PROTECTED] and inform them of
> the time the error occurred, and anything you might have done that may
have
> caused the error.
>
> More information about this error may be available in the server error
log.
>
> --
>
> Apache/1.3.12 Server at localhost Port 80
> ---
>
> The following is the script:
>
> 
> if (!isset($PHP_AUTH_USER))
>
>
> header('WWW-Authenticate: Basic realm="My Private Stuff"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else
>
>
> if (($PHP_AUTH_USER == "jane") && ($PHP_AUTH_PW == "mypassword"))
>
>
> echo "You have entered this username: $PHP_AUTH_USER";
> echo "You have entered this password: $PHP_AUTH_PW";
> echo "The authorization type is: $PHP_AUTH_TYPE.";
>
> } else
>
>
> echo "You are not authorized!";
>
> }
>
> }
>
> ?>
>
>
>
>
> --
> 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: User Authentication Script

2002-08-26 Thread Vail, Warren

What does your apache server log say?


Warren Vail
Tools, Metrics & Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-Original Message-
From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 26, 2002 6:51 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP: User Authentication Script


Using Apache / Windows 98 / PHP / mySQL

The following script is from Julie Meloni's book "PHP Essentials"
(PrimaTech) on page 138.

I've copied the script from her site and tried to run it and get the
following:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform them of
the time the error occurred, and anything you might have done that may have
caused the error.

More information about this error may be available in the server error log.

--

Apache/1.3.12 Server at localhost Port 80
---

The following is the script:

You have entered this username: $PHP_AUTH_USER";
echo "You have entered this password: $PHP_AUTH_PW";
echo "The authorization type is: $PHP_AUTH_TYPE.";

} else


echo "You are not authorized!";

}

}

?>




-- 
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: User Authentication Script

2002-08-26 Thread Anthony Ritter

Using Apache / Windows 98 / PHP / mySQL

The following script is from Julie Meloni's book "PHP Essentials"
(PrimaTech) on page 138.

I've copied the script from her site and tried to run it and get the
following:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, [EMAIL PROTECTED] and inform them of
the time the error occurred, and anything you might have done that may have
caused the error.

More information about this error may be available in the server error log.

--

Apache/1.3.12 Server at localhost Port 80
---

The following is the script:

You have entered this username: $PHP_AUTH_USER";
echo "You have entered this password: $PHP_AUTH_PW";
echo "The authorization type is: $PHP_AUTH_TYPE.";

} else


echo "You are not authorized!";

}

}

?>




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




[PHP] Forcing browsers to use cached pages

2002-08-26 Thread Mike Mannakee

Hi all,

Is there any way to force a browser to use a cached version of a page if the
user hits the back button?

Mike



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




[PHP] Re: setcookie() failure

2002-08-26 Thread Richard Lynch

>Can anyone tell me why the following setcookie()s fail?

>$expDate = mktime(12, 50, 30, 6, 20, 2010);
>setcookie("tzusercookie", $uid, $expDate);
>setcookie("tzpasscookie", $password, $expDate);

Among other stupidities, some versions of IE require that you provide *both*
date and directory, or *neither*, but not just the date.

In addition, Cookie expirations more than 2 years in the future are assumed
by some browsers (and by the Cookie spec) to be BOGUS, so 2010 is going to
mess up some browsers.

It's also a Bad Idea to bury 2010 in there anyway.  What's gonna happen if
this code actually survives through 6/20/2010?  Bam!  It breaks for no
apparent reason and some poor schnook (maybe you) has to go figure out why. 
Use $expDate = time() + 60*60*24*365*2; for the maximum two-year Cookie
time-out.  (Roughly two years, natch.)

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Reading URL in address bar

2002-08-26 Thread Richard Lynch

>I want to pass the current url (appearing on the browser address bar), say
>http://www.mydomain.com?cat.php=234 to appear in a form field
>in the a new page, say category.php.
>I am sure it's something to do with HTTP_variables or CGI.referrer but can't
>seem to get the one needed.

Either use this in the "from" page:



Or use $_SERVER['HTTP_REFERER'] in the "to" page.

Or is it $_ENV['HTTP_REFERER']?  I can never remember what comes from which.
 Use  to be sure.

Note that some browsers may choose to give you very strange things for
HTTP_REFERER, but PHP_SELF is pretty much going to be what you set it.

On the other hand, it's trivial for a hacker to alter your INPUT TYPE=HIDDEN
tag and send whatever they like.

In either case, you can't trust the data you are getting, since any bozo
could make it be anything they want.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: strange error message when trying to start apache

2002-08-26 Thread Richard Lynch

>Hello again, so earlier I was trying to install
>PHP-4.2.2 with Apache-2.0.40 and was having some sapi
>problems.  I then read that I might be better off
>going with Apache-1.3.26.  Well, I installed 1.3.26,
>and then configured and installed php into apache as a
>DSO.  Everything appeared to go smoothly, except when
>I try to start up Apache, I get the following error
>message:
>
>Syntax error on line 205 of
>/usr/local/apache/conf/httpd.conf:
>API module structure `php4_module' in file
>/usr/local/apache/libexec/libphp4.so is garbled
>-perhaps this is not an Apache module DSO?
>/usr/local/apache/bin/apachectl start: httpd could not
>be started

When you compiled PHP, it didn't really work.

There are some error messages you missed as they flew by during that whole
./configure make make install thing.

Re-do that part, only do things like this:

./configure --with-apxs=... --with-mysql=... 2>&1 > configure.output &
make 2>&1 > make.output &
make install 2>&1 > install.output &

You'll be able to watch things happen by doing:

tail -f configure.output

(Hit control-C when it's done)

and similarly for make.output and install.output

When you're all done, search through configure.output and make.output for
"Error" or "Warning" messages.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Posting variable without form

2002-08-26 Thread Richard Lynch

>I tried it but it is not successful. I think it is because I tried to
>post to a https(SSL link).

You are correct.

If you want to use SSL, you're better off using cURL.

The above code would be about 100 X as large if it was trying to do all the
encryption and SSL interchanges to get an SSL connection to work.  It could
be done, but cURL will be much easier.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Date conversion problems

2002-08-26 Thread Richard Lynch

>Having a little trouble with converting dates.
>
>I have, in my database, a bunch of dates stored like this: -M. Month is
>obviously the number of the month (5), not the name (May).
>
>I want to convert the format to MMM,  (ex: May, 2002), so I used the
>mktime function. Basically I extract the date with a regular MySQL query,
>then explode the date, and my components look great. However, when I put the
>components into my mktime function, sometimes it'll work and sometimes it
>won't. It won't work if the date is too far off in the future (2085, etc.),
>but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
>works fine.
>
>My code is this (after grabbing the query results):
>$enddate = explode("-", $datereuslt[0]);
>$fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
>$finaldate = date("M, Y", $fullenddate);
>
>Any ideas? Alternatively, if anyone has an easier way of doing this, I'm all
>ears.

mktime() will not work beyond mid-August of 2038 on 32-bit machines.

This is because Unix time-stamps count time by marking off the number of
seconds since 1/1/1970 midnight:

12:00:00 01/01/1970 == 0
12:00:01 01/01/1970 == 1
12:00:02 01/01/1970 == 2
.
.
.
12:01:00 01/01/1970 == 60
.
.
.
??:??:?? ??/??/2038 == 2147483648 == 0x ==
0b

After that you either "wrap around" back to 1970, or you buy a 64-bit
machine and extend your time range another century or so.

MySQL *probably* has some data types that can handle much larger dates, and
probably has something like mktime() only different (different name, and
handles bigger dates).

So your best bet is to figure out what MySQL data type will handle the full
range and precision of the dates you need to work with:

http://mysql.com

Another alternative may be as simple as:

$months = array(1=>'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December');
$enddate = explode("-", $datereuslt[0]);
$month = $enddate[1];
$year = $enddate[0];
$finaldate = $months[$month] . ' ' . $year;

It's crude but it will work for any year no matter how distant.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: New to PHP/mySQL - Help on script

2002-08-26 Thread Richard Lynch

>Thanks for everyones help yesterday but nI have come up against a problem
>(as I am new). I have created my document as detailed below with notes. I
>can see from the form that I have connected to the server, accessed the
>correct database, created the statment and executed it. The problem is how
>to display the information - as far as I can understand from yesterday if
>the result is 0 then the villa is available. So what I need to do is if the
>result = 0 display villa available and if the result is greater than 0 then
>display villa not available . I know that the variables are getting to the
>query as if I change the echo $result; to $sql;  and key in 3 as the id and
>2 dates in the form I get the following:
>
>SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
>booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
>villa_id = ('3')
>
>So, corrcet me if I am wrong but the query is working its just i cannot see
>anything. I have spent hours on this today, reading books and looking at the
>list. I hope that once I have done one good script I can then start to
>understand it and create more :-)
>
>Thanks for all your help
>
>
>Ray
>
>
>
> 
> 
> if ($submit) {
>
> // open connection to database
>
> $db = mysql_connect("localhost", "matrix", "matrix");

Add "or error_log(mysql_error())" to the end of this, so if your database
goes down or something you'll have a record of it in your Apache log.

>
> // pick database to use
>
> mysql_select_db("matrix",$db);

Same here in case some goofball deletes the whole matrix database or
something.

>
> // create the SQL statement
>
> $sql = "SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
>booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
>booking_end AND villa_id = ('$place')";

Get rid of all the () except for count(*).

The rest of them are bogus.

> // execute the SQL statement
>
> $result = mysql_query($sql);
>
> // display the information
>
> echo $result;

NO.

$result is *NOT* your information.

If your SQL is broken, you'll get nothing output here.

You should again have:
or error_log(mysql_error()) at the end of the mysql_query() statement.

If everything goes well, though, $result *still* won't be the information
you want.

It will be a "result identifier"

That's a fancy way of saying it's like a little ticket at the meat counter
in your grocery store so you know whose turn it is.

You need to use http://php.net/mysql_fetch_row (or similar functions) to get
your actual data.

In this case, since you only get one answer, I would just use:

echo mysql_result($result, 0, 0);

to see the answer you want.

Actually, it will be more like this:

$taken = mysql_result($result, 0, 0);
if ($taken){
  echo "Villa $place is not available between $book_start_date and
$book_end_date\n";
}
else{
  echo "Villa $place is available from $book_start_date to
$book_end_date\n";
}

mysql_query() never returns your actual data -- It only returns an
"identifier" so you can go get your data.



>} else{
>
> // display form
>
> ?>
> 
> Villa id number:
> Start date:
> End date:
> 
> 
>  }
>  // end if
> ?>
> 
> 
>
>


-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: check unread messages in a forum

2002-08-26 Thread Richard Lynch

>I have made a forum in PHP, and the users are logged in using cookies. I
>want all new threads (and if there are new replies in an old thread) to be
>highlight or something like that.
>
>How do I check if a user has read a message or not?

Every user has a unique ID when they log in, right?
And every message has a unique ID, right?

create table messages_read(
  user_id int(11) unsigned not null key,
  message_id int(11) unsigned not null key
);

When they read a message:
$query = "insert into messages_read(user_id, message_id) values($user_id,
$messages_id)";

You can then use this in the query that gets the messages for display:

select blah, blah blah, messages_read.user_id from messages
left outer join messages_read on user_id = $user_id and
messages_read.message_id = messages.message_id
where blah, blah, blah

The "left outer join ..." part is the new bit in your query.

Notice also that I've added "messages_read.user_id" to the columns you
select.

As you iterate through the messages to display, either:

1. messages_read.user_id is their $user_id, and they've read that message
or,
2. messages_read.user_id is NULL because there was no row in the
messages_read table, so they ain't seen that message yet.

Be sure to add interface elements so that they can mark a message "Read" or
"Unread" even if they've already read it or haven't -- Let the user have
control over what they consider as "Read" or they'll be only partially happy
about this new feature. :-)

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Object member variable names

2002-08-26 Thread Richard Lynch

>Hi,
>
>I've got a little problem with variable naming of object members. Here is my
>situation: I've got a website form, whoms contents will be saved in a MySQL
>table with two fields: name and value. The name could be anything like
>"bla->test", "array[3]->test[4]->name"...
>
>Now I have a php script reading out the MySQL table, and I want to assign
>the variables like this:
>$object->$name, i.e.
>$object->bla->test = "some value";
>$object->array[3]->tes[4]->name = "some other value"; etc.
>
>Using $object->$name doesn't work, as this seems to ignore submembers and
>arrays.
>Any ideas how to solve my problem?

You might try:

$object->{$name} = "some value";

If all else fails, you could probably dink around with http://php.net/eval
and get what you want.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Call to undefined function mysql_connect()

2002-08-26 Thread Richard Lynch

>Help!
>
>I am getting the following error message for :
> $link=mysql_connect("localhost","$user","$pass"); // line 34
>?>
>
>Fatal error: Call to undefined function: mysql_connect() in 
>/home/www/test.somename.org/aux/db-mod.php on line 34
>
>I have used this call successfully on php v4.0.6, and am now trying it on a 
>new install (which someone else did, as I haven't a clue in setting up a 
>server) which is v4.1.1.  Is mysql_connect a defunct command, or do I need 
>to do something to enable its use?

MySQL support is "optional" and whomever set up this server needs to enable
it during compilation/installation.

Also, version 4.1.1 is "old" and they really really really ought to upgrade
before installing..

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Numbers to Roman Numerals - Native PHP Function?

2002-08-26 Thread Richard Lynch

>Does anyone know if there is a native function within PHP to convert numbers
>to roman numerals?
>
>I could easily write a little convertor, but I was hoping there was an
>simple function - although I couldn't seem to find anything like that in the
>manual.

If http://php.net/printf doesn't do it, you'll probably have to roll your
own...

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Help with matchng strings

2002-08-26 Thread Richard Lynch

>
>I have two list one is listA and the other is listB I would
>like to take the values in listB and compare them with listA if any of
>them match then I what to create a new list listC and put the values
>that match in it. If they do not match I want the values to go into listD.
>I have been messing with this for three days and have not been able to get
>it to work. I have used foreach statements and array_search but what ever
>I try I just can't seam to get it. What I need is something like below.
>Could somebody please help.
>
>
> If LISTB MATCHES LISTA If NO Match
>LISTA LISTB  Make LISTC  Make LISTD
>
>
>test1 test4 test4   test1
>test2 test6 test6   test2
>test3 test8 test8   test3
>test4   test5
>test5   test7
>test6   test9
>test7
>test8
>test9

I think you want these:

$listC = array_intersect($listA, $listB);
$listD = array_difference($listA, $listC);

http://php.net/array_insersect

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: What's the trick ?

2002-08-26 Thread Richard Lynch

>Hi guys,
>
>Am writing a web based mailclient (obviously with PHP+IMAP),
>In the 'ReplyMail' script, inorder to add the "> " string
>at the beginning of everyline, I used the following code,
>$replymessage = $replymessage.str_replace("\n", "\n> ", 
>htmlspecialchars(trim(imap_body($mbox, $msg;
>?>
>
>This is giving an output with one additional \n in the TEXTAREA,
>like below

Maybe put the trim() "outside" the str_replace()...

Also be sure you don't have a hard-coded newline in your HTML/PHP source
inside the  tags.

I also would use htmlentities() rather than htmlspecialchars() personally...
 Probably arguable what's "right"

You may also be the victim of Windoze/Unix/Macintosh newline issues.

Perhaps try:

# Convert Windows to Unix:
$msg = str_replace("\r\n", "\n", $msg);
# Convert Mac to Unix:
$msg = str_replace("\r", "\n", $msg);

before you do the "\n> " part.

You may also wish to consider using textwrap (wraptext?) before you do the
"\n> " part, since some people's mailers will not wrap outgoing text.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: MySQL PASSWORD() Question

2002-08-26 Thread Richard Lynch

>If I insert a row's field's value using the PASSWORD() function, will I need
>to use it or another function to find that row using the same field?

You'll need to do this when somebody tries to log in later:



In other words, you can *NEVER* "go backwards" from the password() function
output to get the original back.  But you can call password() on some
incoming data and see if the two outputs match.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: register_globals off or on, why on

2002-08-26 Thread Richard Lynch

>> "Geeklog needs the register_globals variable turned on in order to work.
>> Since PHP 4.2.0, the default for register_globals is "off". To fix it,
>> simply add the following line to your php.ini file
>
>Is this not *wrong*. It sounds to me like fake laziness. Nothing drives 
>me bonkers more than trying to track down a variable that is inherited 
>from who knows where. 
>
>Perhaps I'm missing something. I've recently worked on a lot of PHP 
>code written by others and it's a nightmare trying to track down where 
>a variable is defined and where it's value might be changed.  Perhaps 
>there is some tool I can use to trace this. I dunno. 
>
>Am I correct in my aversion to globals or I am I missing their true 
>value and perhaps some tools I could use when working on apps that have 
>more than 50 php files floating all over the place and no 
>documentation.

If it's not obvious where the value is coming from, whether they have
register_globals "on" or "off" isn't really going to help.

If the code is that messy, then they'll probably have something like:



in one file, and then start using $i out of the blue 37 files later, and 'i'
is *such* a great variable name, isn't it?

register_globals "off" only stops the over-riding of un-initialized
variables from the "outside" world (GET/POST/COOKIE).

If you've got crappy code with un-initialized variables in the first place,
you've got much bigger problems than register_globals -- You need to throw
out a big pile of code.

Unfortunately, some very popular but crappy code-bases out there continue to
be used by the masses, so we're all stuck with stupid register_globals
settings because of poor programming.

It's the right solution for a [bleeped]-up world, but that doesn't make one
not wish for a better world.

I guess I'm saying that there is only one correct tool to use for
applications with 50 php files floating all over the place and no
documentation:

rm -rf application


YMMV  NAIAA  IANAL

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Session woes

2002-08-26 Thread Richard Lynch

>the problem I have, however, is that on the third page of my wizard, if the
>user submits only some of the required fields, it submits back onto itself
>and displays an error as required, but the problem is that when you fill in
>the missing fields and move on to the next page (in effect back onto itself
>first, then on to the next page) the fields that had their values missing,
>are not passed along...
>
>Does this all make sense?  I can provide all the code samples if need be.

It's almost-for-sure in your logic/code and not really in PHP...

Source code needed.

At a guess, I'd say that you are doing session_start() and/or the relocation
in such a way that the variables are *NOT* getting saved when/where you
think they are.

I think you're probably over-using header("Location: ") and are just going
to be having problems until you stop using it so much.  It's really designed
for web pages that *MOVED*, not as an alternative to programming logic.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Dynamically Downloading Data

2002-08-26 Thread Richard Lynch

>Is it possible to select data from a database and have it be available for
>download without actually creating a file on the server?

Yes, of course :-)

Here is a tab-delimited file of upcoming events from 'whatever' table:

= now()";
  $upcoming = mysql_query($query, $connection) or error_log(mysql_error());
  while ($row = mysql_fetch_row($upcoming)){
echo implode("\t", $row), "\n";
  }
?>

You may or may not want to add something like:

header("Content-type: application/octet-stream");

to force a download, as well as review the posts of the past few days (and
seemingly every week or so for the past 5 years) about how to force the
browsers to pick a "nice" filename for the "Save As..." box.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Trouble Downloading Files

2002-08-26 Thread Richard Lynch

>I'm not certain this is the right place to ask, but here goes.  For security
>reasons I have placed certain document files in a directory outside my web
>root. There are many types of files included (e.g. jpg, gif, txt, pdf, xls,
>doc, mdb, ppt, and dwg).  Clicking links on my web page will download the
>files through a php script (getdocfile.php) into a new pop-up window.  The
>following is how I have coded the link:
>
>onclick="window.open('../getdocfile.php?file=$DrawingGroups->Value("filename")?>',
>'_blank','resizable=yes,scrollbars=yes,width=700,height=500');return
>false">Value("is_viewable")?>
>
>
>Problem: The download fails with IE5.5 when trying to retrieve files other
>than jpg, gif, txt, and pdf.  One of the following happens depending on
>whether or not I force the download dialog box for the file to appear:
>(Note: I force the download dialog by commenting out the appropriate mime
>types in the code below)

IE is stupid.

Really, really stupid.

Not that Netscape is any smarter, or anything, but IE is really really
really stupid.

In particular, their hack to have embedded documents in a browser and stuff
rely on the URL of the thing being downloaded and when you start crossing
that with your .php URL and JavaScript's popup windows, all hell breaks
loose, as you've noted.

Things you *might* try:
1. Rename the getdocfile.php to getdocfile.htm and force Apache to make it a
PHP file.

2. Get rid of the ?file= part, and just use
/Value('filename')?> and then use $path_info in your
getdocfile.htm script instead of $_GET['file']

3. Whoops.  2. conflicts with 3.  You maybe be "stuck" with something really
stupid like using:
/Value('filename')?>.htm and then
inside of getdocfile.htm you'll need to de-construct the foo_pdf.htm back
into foo.pdf to get the file you actually want.
Yes, your URLs will now look very strange, but remember how stupid IE is? 
It's really stupid.

4. You may even need to go so far as to have the popup window have a META
tag to re-locate to the actual document you want, so that only an HTML
document is the first thing to appear in the popup window.  Again, IE is
really stupid, and as soon as you cross a popup with a non-HTML document (of
certain types you have begun to discover empirically) it screws up.

I never have figured out which/why/when IE screws up popups with non-HTML
content and don't really care cuz I hate popups...  But it's a known issue,
and there's not much you can do about it other than make IE happy by
following the adage:  "Don't do that."

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Output Compression & output buffering..

2002-08-26 Thread Gerard Samuel

In an included file, I have an error handler that is using the 'output 
buffering' trick to
dump a page in progress to display the error page.
I also happened to have a switch to turn on output compression.
When output compression is on, if an error is comitted while the page is 
displaying, I get an empty page,
instead of the expected error page or the page hangs, depending on the 
browser.

Has anyone gotten both forms of output control to work together without 
ill side effects??

Thanks

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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




[PHP] Re: Need example of Next 5>>

2002-08-26 Thread Justin Garrett

Let's try that again.

SELECT * FROM table LIMIT 5,5;   # get rows 6 - 10
SELECT * FROM table LIMIT 10,5  # get rows 11 - 15

Justin Garrett

> Hi,
>
> I am looking for an example in php/MySql dealing with Next 5 > type of
> queries ..does anyone have any links?
>
> Thank you for your help
> Pax
>
>



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




[PHP] Re: Need example of Next 5>>

2002-08-26 Thread Justin Garrett

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SEL
ECTSELECT * FROM table LIMIT 5,5;  # Retrieve rows 6-10
SELECT * FORM table LIMIT 10,5; # Retrieve rows 11 - 15Justin Garrett"Pax"
<[EMAIL PROTECTED]> wrote in message
001901c24d49$e7830530$6401a8c0@pawel">news:001901c24d49$e7830530$6401a8c0@pawel...
>
> Hi,
>
> I am looking for an example in php/MySql dealing with Next 5 > type of
> queries ..does anyone have any links?
>
> Thank you for your help
> Pax
>
>



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




RE: [PHP] Date conversion problems

2002-08-26 Thread David Freeman


 > I have, in my database, a bunch of dates stored like this: 
 > -M. Month is obviously the number of the month (5), not 
 > the name (May).
 > 
 > I want to convert the format to MMM,  (ex: May, 2002), 

Do the conversion in MySQL - it'll save you grief in the long run...

SELECT DATE_FORMAT(-M, '%b %y') AS DisplayDate FROM SomeTable WHERE
some = 'condition'

Will work with appropriate substitutions for your table structure.

CYA, Dave




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




[PHP] Re: uploading problems...please help

2002-08-26 Thread Richard Lynch

>I'm trying to upload files from my PC to my website.  The code is a little
>nuts, but it's all I got to work locally, butonce I take the code to the web
>I get this message.  Can anyone tell me what I'm doing wrong?
>
>I'm trying to upload a file, strip all the information so as to just use the
>name of the file to store in the database.  I'm using explode and array_pop
>for this, but I'm sure there's a better way.  The problem seems to be in
>writing the file to the web server.  I changed the permissions on the
>directories, so I don't think that's the problem.  Please help.
>
>Thanks,
>
>Brian
>
>---ERROR FROM WEB SERVER---
>
>Warning: Unable to open 'D:\harley\images\DSC00447.jpg' for reading: No such
>file or directory in /public_html/harleyuppic_fsp.php on line 19

Do a trial with the same code below but put a sleep(120) right before the
copy() line, and have a window open on the directory D:\harly\images\ and
hit F5 a lot to refresh it.  See if the file DSC00447.jpg (or whatever)
appears before you try to copy it.  If not, why not?

I'm also getting more than a bit nervous about this harleyuppic_fsp.php on
my second read-through...

Are you trying to do a header("Location: ") or something before you deal
with the uploaded file?  You can't do that.  PHP is gonna nuke the file that
uploaded as soon as the script that "catches" it ends.  You *must* copy that
file or otherwise preserve its contents within that script or it's *GONE*.

>
>
>---PHP CODE
>
>
>
>
>if ($submit) {
>
>  $db = mysql_connect("localhost", "user", "password")
> or die("Could not connect to databse.");
>  mysql_select_db("database") or
> die("Cannot select database");
>
>$hope2 = explode("\\",$imagefile);
>$hope4 = array_pop($hope2);
>
>copy ($imagefile, "\\public_html\\images\\".$hope4);
>
>mysql_query ("insert into imagefiles (img) values ('$hope4')");
>
>  $sql = "select img from imagefiles";
>  $result = mysql_query($sql) or
> die( mysql_error() );
>
>$number_cols = mysql_num_fields($result);
>
>//layout table header
>echo "\n";
>echo "\n";
>for ($i=0; $i<$number_cols; $i++)
>{
> echo "" . mysql_field_name($result, $i). "\n";
>}
>echo "\n";//end table header
>
>//layout table body
>
>while ($row = mysql_fetch_row($result))
>{
> echo "\n";
> for ($i=0; $i<$number_cols; $i++)
> {
>  echo "";
>   {echo "";}
>   {echo $row[$i];}
>  echo "\n";
> }
> echo "\n";
>}
>
>echo "";
>
>
>} else {
>
>?>
>
>
>="post">

For starters, you shouldn't have two nested FORM tags.  That won't work.

I don't even know if admin_product.php or whatever $PHP_SELF is will end up
being the page loaded.

I'm guessing from the error message that it's $PHP_SELF which is
harleyuppinc.php, but who knows?

>
>
>
>
>
>
>
>} // end if
>
>?>
>

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: comparing string data with database data

2002-08-26 Thread Richard Lynch

>Can somebody help me with this or point me in the right direction.
>an example of what i need
>I have a string that has 4 items in it separated by a space
>$string="item1 item2 item3 item4";
>I also have a database with a lot of other items in it.
>
>I what to compare the items in the string with the items in the
>database and if any of them match to branch of and do something
>different with the data. if they don't match do something else with the
>data. I hope this makes sense

You haven't described the database in enough detail to be sure, but assuming
you have one row for every item, you could do this:



-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] Re: Seeding for php functions

2002-08-26 Thread Richard Lynch

>Im using array_rand() and shuffle() in my scripts.
>Im seeding using mt_srand().
>I noticed the manual didn't suggest that mt_srand() can be used to seed 
>array_rand() and shuffle() but the older srand().
>The mt_srand man page states that its a drop in replacement for srand().
>I just would like to double check with the gurus that mt_srand() can be 
>used to seed array_rand() and shuffle().

Most likely mt_srand() will not affect array_rand() and shuffle().

MT_ is a "drop-in" replacement, but it's a "package deal" that you replace
rand/srand with mt_rand/mt_srand.

It won't change the underlying code within array_rand() and shuffle()

On the plus side, PHP has automatically seeded the random numbers for
several versions now...

Don't know for 100% sure that that applies to array_rand and/or shuffle,
however -- Perhaps only built-in seeding for rand() and/or mt_srand()

-- 
Like Music?  http://l-i-e.com/artists.htm


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




[PHP] FW: Need example of Next 5>>

2002-08-26 Thread pax


Hi,

I am looking for an example in php/MySql dealing with Next 5 > type of
queries ..does anyone have any links?

Thank you for your help
Pax



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




Re: [PHP] Date conversion problems

2002-08-26 Thread Matt

>From: "Matt" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Monday, August 26, 2002 5:42 PM
>Subject: Re: [PHP] Date conversion problems


> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> >Sent: Monday, August 26, 2002 3:58 PM
> >Subject: [PHP] Date conversion problems

> mktime generally only works thru 2037.  Why not create an array of the
> months, and index in:
> $months = array('Jan','Feb',);
> $enddate = explode("-", $datereuslt[0]);
> $finaldate =  $months[$enddate-1] . "-$enddate[1]";

Ooops, should have been:
$months = array('Jan','Feb',);
$enddate = explode("-", $datereuslt[0]);
$finaldate =  $months[$enddate[1]-1] . "-$enddate[0]";



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




Re: [PHP] when was array_unique fixed?

2002-08-26 Thread Jason Reid

Check the changelog --> http://www.php.net/ChangeLog-4.php

Jason Reid
[EMAIL PROTECTED]
--
AC Host Canada
www.achost.ca

- Original Message - 
From: "Greg Martin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 3:36 PM
Subject: [PHP] when was array_unique fixed?


> i know that array_unique was broken in version 4.0.4, but does anyone
> know which version was it fixed in?
> 
> thanks,
> greg martin
> [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] Date conversion problems

2002-08-26 Thread Matt

> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
>Sent: Monday, August 26, 2002 3:58 PM
>Subject: [PHP] Date conversion problems


> Having a little trouble with converting dates.
>
> I have, in my database, a bunch of dates stored like this: -M. Month
is
> obviously the number of the month (5), not the name (May).
>
> I want to convert the format to MMM,  (ex: May, 2002), so I used the
> mktime function. Basically I extract the date with a regular MySQL query,
> then explode the date, and my components look great. However, when I put
the
> components into my mktime function, sometimes it'll work and sometimes it
> won't. It won't work if the date is too far off in the future (2085,
etc.),
> but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
> works fine.
>
> My code is this (after grabbing the query results):
> $enddate = explode("-", $datereuslt[0]);
> $fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
> $finaldate = date("M, Y", $fullenddate);
>
> Any ideas? Alternatively, if anyone has an easier way of doing this, I'm
all
> ears.

mktime generally only works thru 2037.  Why not create an array of the
months, and index in:
$months = array('Jan','Feb',);
$enddate = explode("-", $datereuslt[0]);
$finaldate =  $months[$enddate-1] . "-$enddate[1]";




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




Re: [PHP] Posting variable without form

2002-08-26 Thread Matt

>From: "Then Nam Kheong" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Monday, August 26, 2002 12:26 PM
>Subject: [PHP] Posting variable without form
> I tried it but it is not successful. I think it is because I tried to
> post to a https(SSL link).
> 
> I would like to know if I can perform a SSL posting using the above
> code, or if anyone could point to me how I can post variables without
> using a form, please point to me.

http://marc.theaimsgroup.com/?l=php-general&w=2&r=1&s=post+form+ssl&q=b



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




[PHP] when was array_unique fixed?

2002-08-26 Thread Greg Martin

i know that array_unique was broken in version 4.0.4, but does anyone
know which version was it fixed in?

thanks,
greg martin
[EMAIL PROTECTED]

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




Re: [PHP] Re: HTML-based mail with PHP

2002-08-26 Thread Kevin Stone

I've seen this before.  I believe it had something to do with Microsoft's
screwed up cacheing routine.  No guarantees, but delete the contents of your
temporary internet files folder and try again.
-Kevin

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 2:32 PM
Subject: [PHP] Re: HTML-based mail with PHP


> > I'm having trouble with some HTML-based mail with PHP.
> > It's not the regular thing where I can't get it to use
> > the tags instead of just printing them. That part's
> > fine; it comes out HTML-based.
> >
> > My problem is the way it's not accessing a certain
> > image. I get a broken link instead of an image at the
> > top of my e-mail. I had it print the URL at which it
> > should find the image, and then cut and paste that in
> > my browser, and the image comes up fine. But, as far
> > as putting it in the e-mail, it's not working out.
>
> < the image files in the message. That is done with multipart/related
> messages.>>
>
> Yup, it's an absolute URL, http and everything.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Re: filter files in a directory

2002-08-26 Thread Joel Boonstra

> I am showing a directory of files and I don't what all the files to
> show on the screen. I was able to get the . and the .. not to show
> with what I have below but there are some other files in there that look
> like this mylist.confg. I don't want them to show in the directory
> list. I tried && $files != "*.config"  but this did not work .
> Anybody have an suggestions on how to do this . I have look through
> the manual and the mailing list but can't figure out how to make the
> pattern to keep this from showing
>
> if ($handle = opendir('/path/to/list/directory')) {
> while (false !== ($files = readdir($handle))) {
>  if ($files != "." && $files != "..") {
>   echo $files;
>  }

!= doesn't understand the glob (*) character, so the easiest way to make
your example work is to use a regular expression match.  Something like:

  if ($files != "." && $files != ".." && !preg_match("/\.config$/", $files)) {

should do the trick.  However, if you anticipate adding any more filters
on the listing (.cfg, .txt, .conf, etc...) you might want to come up
with a more general way to add filters besides simply tacking on stuff
with &&.  One thought might be to keep an array of patterns, and do a
match on the whole array.  When a new file needs to be filtered, simply
add an entry to the array, keeping your code more-or-less clean.

It's up to you, though.

-- 
[ joel boonstra | [EMAIL PROTECTED] ]


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




[PHP] Re: HTML-based mail with PHP

2002-08-26 Thread Liam . Gibbs

> I'm having trouble with some HTML-based mail with PHP.
> It's not the regular thing where I can't get it to use
> the tags instead of just printing them. That part's
> fine; it comes out HTML-based.
> 
> My problem is the way it's not accessing a certain
> image. I get a broken link instead of an image at the
> top of my e-mail. I had it print the URL at which it
> should find the image, and then cut and paste that in
> my browser, and the image comes up fine. But, as far
> as putting it in the e-mail, it's not working out.

<>

Yup, it's an absolute URL, http and everything.


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




[PHP] Date conversion problems

2002-08-26 Thread Liam . Gibbs

Having a little trouble with converting dates.

I have, in my database, a bunch of dates stored like this: -M. Month is
obviously the number of the month (5), not the name (May).

I want to convert the format to MMM,  (ex: May, 2002), so I used the
mktime function. Basically I extract the date with a regular MySQL query,
then explode the date, and my components look great. However, when I put the
components into my mktime function, sometimes it'll work and sometimes it
won't. It won't work if the date is too far off in the future (2085, etc.),
but I'm not exactly sure what the cutoff is. If it's recent, say 2005, it
works fine.

My code is this (after grabbing the query results):
$enddate = explode("-", $datereuslt[0]);
$fullenddate = mktime(0, 0, 0, $enddate[1], 0, $enddate[0]);
$finaldate = date("M, Y", $fullenddate);

Any ideas? Alternatively, if anyone has an easier way of doing this, I'm all
ears.

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




Re: [PHP] How do I call a CGI script from PHP?

2002-08-26 Thread Bas Jobsen

> PHP page, nothing fancy. .In SSI, I just use the "#exec cgi=" line--is

$test = `path_to_your_cgi 2>&1`;

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




Re: [PHP] How do I call a CGI script from PHP?

2002-08-26 Thread Adam Williams

exec() and system()

Adam

On Mon, 26 Aug 2002, Matthew wrote:

> I'm new to PHP and want to build a basic page. The one thing I cannot
> find any documentation on is the seemingly simplistic question of how to run
> a Perl script. I just want to execute a site-tracking script from my PHP
> page, nothing fancy. .In SSI, I just use the "#exec cgi=" line--is there an
> analogous command in PHP?
> Thank you for your help!
>
> Matthew
>
>
>
>


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




[PHP] How do I call a CGI script from PHP?

2002-08-26 Thread Matthew

I'm new to PHP and want to build a basic page. The one thing I cannot
find any documentation on is the seemingly simplistic question of how to run
a Perl script. I just want to execute a site-tracking script from my PHP
page, nothing fancy. .In SSI, I just use the "#exec cgi=" line--is there an
analogous command in PHP?
Thank you for your help!

Matthew



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




[PHP] Re: [PHP-DB] Radio buttons

2002-08-26 Thread Support @ Fourthrealm.com

Your radio buttons look fine.  I would ensure to add quotes (single or 
double) around the attribute settings, for HTML compliance.  If you must go 
without quotes, then make sure that you don't put spaces in any of the 
attribute values.



As for the form not working... do you have a JavaScript that works with 
these radio buttons?

Or, is the radio button name the same as the "Submit" button?



At 07:25 PM 8/26/2002 +0200, you wrote:
>Hello, I get forms posted and working, but as soon as I include radio
>buttons, the whole form doesn't function anymore. The code of the radio
>button part is included in this posting.
>Can you tell me, what I'm doing wrong?
>Help would be greatly appreciated!
>
>S. Maier
>
>
> 
>   Wie häufig surfen Sie im Internet? 
>   
> selten
>   
>  name=surf_erf> 
>   
>  name=surf_erf> 
>   
>  name=surf_erf> 
>   
>  name=surf_erf> 
>   
>  name=surf_erf> 
>   
>  name=surf_erf> 
>   oft 
>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -


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




Re: [PHP] search in serialized string

2002-08-26 Thread Rodrigo Peres

I mean double ouch!!! :-)

well..

1 no, it's a select for the language ( Rodrigo,
> 
> Inherited problems = ouch!
> 
> Sorry I don't keep old list msgs, perhaps you mentioned this before: does
> the language skills field contain:
> 1 both the language and the skill-level, eg English - Advanced
> 1b what separator is used between the two words?
> 2 more than one language/skill-level where applicable, eg English -
> Advanced, German - Intro.
> 2b what separator is used between language entries?
> 
> What is the database field description in the table schema?
> 
> Please advise,
> =dn
> 
> 
> 
>> well, I my opinion is not the way to work, but like I said the work was
> done
>> by other guy, and now I have the problem to solve. So i back to old
> question
>> :-)
>> How can I search with some precision in a serialized string?
>> 
>> 
>> 
>> on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote:
>> 
>>> Rodrigo,
>>> 
>>> Then the question to be asked is: is serialize()ing this data good
>>> design/technique, or is there a better way?
>>> 
>>> Regards,
>>> =dn
>>> 
>>> 
>> 
>> 
>> --
>> 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] Reading URL in address bar

2002-08-26 Thread Jerome Houston

CGI.referrer?  are you a foxweb user? :-)

you can use  $_SERVER['REQUEST_URI'] for the page itself, plus (i think...) 
$_SERVER['SERVER_NAME'] if you need the hostname (of the server), too.

check out 
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server

jerome


>From: "YC Nyon" <[EMAIL PROTECTED]>
>
>I want to pass the current url (appearing on the browser address bar), say
>http://www.mydomain.com?cat.php=234 to appear in a form field
>in the a new page, say category.php.
>I am sure it's something to do with HTTP_variables or CGI.referrer but 
>can't
>seem to get the one needed.
>
>TIA
>Nyon
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




[PHP] Reading URL in address bar

2002-08-26 Thread YC Nyon


I want to pass the current url (appearing on the browser address bar), say
http://www.mydomain.com?cat.php=234 to appear in a form field
in the a new page, say category.php.
I am sure it's something to do with HTTP_variables or CGI.referrer but can't
seem to get the one needed.

TIA
Nyon




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




[PHP] Re: filter files in a directory

2002-08-26 Thread Philip Hallstrom

Try adding

&& !ereg("*.config", $files)

-philip

On Mon, 26 Aug 2002 [EMAIL PROTECTED] wrote:

> I am showing a directory of files and I don't what all the files to
> show on the screen. I was able to get the . and the .. not to show
> with what I have below but there are some other files in there that look
> like this mylist.confg. I don't want them to show in the directory
> list. I tried && $files != "*.config"  but this did not work .
> Anybody have an suggestions on how to do this . I have look through
> the manual and the mailing list but can't figure out how to make the
> pattern to keep this from showing
>
> if ($handle = opendir('/path/to/list/directory')) {
> while (false !== ($files = readdir($handle))) {
>  if ($files != "." && $files != "..") {
>   echo $files;
>  }
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Re: PHP Cookies

2002-08-26 Thread Seairth Jacobs

Each cookies is it's own name/value pair.  If you want to store multiple
pairs, you need to encode them in some manner and store them in the value.
Otherwise, you can just create multiple cookies, one for each variable.
Assuming that the browser is configured to accept cookies, all cookies that
you set will be returned to you with each request.

---
Seairth Jacobs
[EMAIL PROTECTED]


"Erich Kolb" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Why cant I use more than 1 variable in a cookie?
>
>



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




[PHP] filter files in a directory

2002-08-26 Thread rdkurth

I am showing a directory of files and I don't what all the files to
show on the screen. I was able to get the . and the .. not to show
with what I have below but there are some other files in there that look
like this mylist.confg. I don't want them to show in the directory
list. I tried && $files != "*.config"  but this did not work .
Anybody have an suggestions on how to do this . I have look through
the manual and the mailing list but can't figure out how to make the
pattern to keep this from showing

if ($handle = opendir('/path/to/list/directory')) {
while (false !== ($files = readdir($handle))) {
 if ($files != "." && $files != "..") {
  echo $files;
 }


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




[PHP] Cyrillic & MySql issue

2002-08-26 Thread Vladislav Kulchitski


Hi guys,

I am working on a multilingual web site (English and Ukrainian); so far,
I was working on English part and now time to work on Ukrainian. The
problem I ran into was that if I submit information to Mysql database
something written in cyrillic, I can't get it to display properly when I
try to take that info from database at a later time. One person told me
I have to recompile mysql, another said that I have to change the column
type (now it's 'longtext')

If anyone knows how to help me, please let me know,
Thanks,
Vladislav Kulchitski
http://vladik.tripod.com



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




Re: [PHP] PHP and LDAP over SSL

2002-08-26 Thread Curtis Robinson

Yea, I am using OpenLDAP.  Putting the .ldaprc in the user homedir for
the web server worked like a charm.  Thanks.

On Mon, Aug 26, 2002 at 08:37:52AM +0200, Stig Venaas wrote:
> On Fri, Aug 23, 2002 at 11:52:11AM -0500, Curtis Robinson wrote:
> > So, I see that php does not have the CA.  But, I have no clue as to where
> > to define the location of the CA in the php configuration.  So, does
> > anyone know how I can configure this option?
> 
> Are you using OpenLDAP? The below is only valid for OpenLDAP.
> 
> When you tested on the command line, didn't you modify your ldap.conf?
> Anyway, in ldap.conf you can specify:
> 
> TLS_CACERT /path/to/ca.crt
> 
> Make sure that this file is readable by your webserver.
> 
> You might also want to specify the following in .ldaprc (in the
> users home directory):
> 
> TLS_CERT /path/to/client.crt
> TLS_KEY /path/to/client.key
> 
> If you run apache as say nobody, they must be in the home directory
> of nobody I guess...
> 
> Stig

-- 
Curtis Robinson
[EMAIL PROTECTED]

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




RE: [PHP] strange error message when trying to start apache

2002-08-26 Thread Matt Schroebel

> From: Jesse Lawrence [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, August 26, 2002 9:36 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] strange error message when trying to start apache

> Everything appeared to go smoothly, except when
> I try to start up Apache, I get the following error
> message:
> 
> Syntax error on line 205 of
> /usr/local/apache/conf/httpd.conf:
> API module structure `php4_module' in file
> /usr/local/apache/libexec/libphp4.so is garbled
> -perhaps this is not an Apache module DSO?
> /usr/local/apache/bin/apachectl start: httpd could not
> be started

Take a look here:
http://www.onlamp.com/pub/a/php/2001/03/15/php_admin.html


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




[PHP] setcookie() failure

2002-08-26 Thread Tony Harrison

Can anyone tell me why the following setcookie()s fail?






 - Tabzilla.com























--
-
[EMAIL PROTECTED]
http://www.cool-palace.com



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




Re: [PHP] Virtual includes

2002-08-26 Thread Steve Keller

At 11:12 AM 8/26/2002 +0200, you wrote:

 > I'm trying include .php files which reside in alternative directories or
 > sub-directories. Such as a file which reside in www/chat/page.php, and for
 > this page I would like to include a file which resides in www/forum/include/

Using $DOCUMENT_ROOT has always worked just fine for me when working in 
other directories. It's much easier to have a solid point of reference than 
have to change levels.

For example:

$userDataFile = "$DOCUMENT_ROOT/forums/users/{$userName}.php";

would look for the file in $userDataFile in www.mypage.com/forums/users/
--
S. Keller
UI Engineer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Pkwy.
Anchorage, AK 99508
907.770.6200 ext.220
907.336.6205 (fax)
Email: [EMAIL PROTECTED]
Web: www.healthtvchannel.org


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




[PHP] Posting variable without form

2002-08-26 Thread Then Nam Kheong

Hello,

I saw searching in the archive for posting variable without using a
form.

I saw the answer by one of you, which is in this link:

http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51

The code is actually a senttohost() function:

=
function sendToHost($host,$method,$path,$data,$useragent=0)
{
// Supply a default method of GET if the one passed was empty
if (empty($method))
$method = 'GET';
$method = strtoupper($method);
$fp = fsockopen($host,80);
if ($method == 'GET')
$path .= '?' . $data;
fputs($fp, "$method $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Content-length: " . strlen($data) . "\n");
if ($useragent)
fputs($fp, "User-Agent: MSIE\n");
fputs($fp, "Connection: close\n\n");
if ($method == 'POST')
fputs($fp, $data);

while (!feof($fp))
$buf .= fgets($fp,128);
fclose($fp);
return $buf;
}
=

I tried it but it is not successful. I think it is because I tried to
post to a https(SSL link).

I would like to know if I can perform a SSL posting using the above
code, or if anyone could point to me how I can post variables without
using a form, please point to me.

Thanks.


-- 
Best regards,
 Then Nam Kheong  
 [EMAIL PROTECTED]


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




[PHP] PHP Cookies

2002-08-26 Thread Erich Kolb

Why cant I use more than 1 variable in a cookie?



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




Re: [PHP] New to PHP/mySQL - Help on script

2002-08-26 Thread Adam Williams

you need

$query = SELECT COUNT(*) as count FROM bookings WHERE ('2002-04-04')
BETWEEN booking_start AND booking_end OR ('2002-04-10')BETWEEN
booking_start AND booking_end AND villa_id = ('3')

$villa = mysql_query($query);

while ($result = mysqul_result($villa))
{
echo "We have $result[count] villas booked";
}

and do the same again but change the statement to villa_id = 0

Adam

On Mon, 26 Aug 2002, Ray Healy (Data Net Services) wrote:

> Thanks for everyones help yesterday but nI have come up against a problem
> (as I am new). I have created my document as detailed below with notes. I
> can see from the form that I have connected to the server, accessed the
> correct database, created the statment and executed it. The problem is how
> to display the information - as far as I can understand from yesterday if
> the result is 0 then the villa is available. So what I need to do is if the
> result = 0 display villa available and if the result is greater than 0 then
> display villa not available . I know that the variables are getting to the
> query as if I change the echo $result; to $sql;  and key in 3 as the id and
> 2 dates in the form I get the following:
>
> SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
> booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
> villa_id = ('3')
>
> So, corrcet me if I am wrong but the query is working its just i cannot see
> anything. I have spent hours on this today, reading books and looking at the
> list. I hope that once I have done one good script I can then start to
> understand it and create more :-)
>
> Thanks for all your help
>
>
> Ray
>
>
> 
>  
>  
>  if ($submit) {
>
>  // open connection to database
>
>  $db = mysql_connect("localhost", "matrix", "matrix");
>
>  // pick database to use
>
>  mysql_select_db("matrix",$db);
>
>  // create the SQL statement
>
>  $sql = "SELECT COUNT(*) FROM bookings WHERE ('$book_start_date') BETWEEN
> booking_start AND booking_end OR ('$book_end_date')BETWEEN booking_start AND
> booking_end AND villa_id = ('$place')";
>
>  // execute the SQL statement
>
>  $result = mysql_query($sql);
>
>  // display the information
>
>  echo $result;
>
> } else{
>
>  // display form
>
>  ?>
>  
>  Villa id number:
>  Start date:
>  End date:
>  
>  
>}
>   // end if
>  ?>
>  
>  
>
>
>
>


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




RE: [PHP] Re: set filename of file open/download

2002-08-26 Thread Roger Lewis

Richard Lynch wrote
On Saturday, August 24, 2002 4:52 PM
To: David Buerer

> >I'm using a php script to stream a microsoft word file to a browser.
> >
> >I'm sending header("Content-type: {$mimetype[DOC]} \n"); to set the mime
> >type to application/msword so that the browser knows how to open the
file.
> >
> >
> >However, some users systems are configured to allow the choice of open or
> >saveas.  The problem is that when the user selects saveas the filename it
> >uses is the name of the php script which streams the file, not the actual
> >filename of the file.  How do I set this filename?

> Alas, different browsers do this differently...

> The *BEST* way to do it is to make your link be named the filename you
want
> them to download:

> Example:
> http://uncommonground.com/events.pdf

> This is *really* a PHP script that happens to have a filename of
> 'events.pdf'

> I've put this into my .htaccess file to force Apache to parse events.pdf
as
> PHP:

> 
>  ForceType application/x-httpd-php
> 

> So Apache "knows" it's a PHP file and PHP spews out valid PDF content and
> the browser never even "sees" .php anywhere, so the browser thinks it's
just
> getting a static PDF file.

> If you have a zillion files to link to, you might want to consider:

> Creating "broken" links to http://example.com/index/nonexistent.doc *BUT*
> you have a file named 'index' and a ForceType like above to make Apache
> parse it as PHP, and inside 'index' you do:

>   # Use $path_info to determine what file they wish to download.
>  # NOTE: It's going to be $_ENV['path_info'] or $_SERVER['path_info'] or
> something like that now...
>  # Use phpinfo() to figure out what it is...
>?>

> Or, if that sounds too "tricky" just put the filename into the link, even
> though it looks "bogus":

> http://example.com/download.php/whatever.doc?filename=whatever.doc

> Even though your PHP file is really 'download.php', Apache and PHP don't
> care about that extra crap in there '/whatever.doc' and the browsers are
so
> stupid they think you've got an actual file with that name in it.

> You can also dink with headers involving Content-disposition and something
> else I forgot, since IE and Netscape and different versions of each look
at
> different headers to "decide" what to use for "Save As..."  *BUT* there
will
> always be some minor version of IE or Netscape that doesn't follow their
own
> rules, and the headers won't work for it.  Thus I usually go with the
first
> option, and don't even give the browser any way to "know" that it's not a
> plain old static URL.


I have been struggling with this problem for the last several days.  (See my
recent post, "Trouble Downloading Files, 8.24.02".  The problem I had was
mostly with IE.  Here is how I solved it.
I used the code from the following as the basis of my code:
http://www.zend.com/zend/trick/tricks-august-2001.php
To make it work in IE, I had to add two lines to the section on "send
headers" (See commented lines below).
//send headers
if(($pc > 1) AND isset($mimetype[$p[$pc - 1]]))
{
//display file inside browser
header("Content-type: " . $mimetype[$p[$pc - 1]] . "\n");
header("Content-disposition: attachment; filename=\"$file\"\n");   // THIS
LINE IS ADDED TO GIVE A CHOICE TO OPEN, OR SAVE AS FILENAME.
}
else
{
//force download dialog
header("Content-type: application/octet-stream\n");
header("Content-disposition: attachment;
filename=\"$file\"\n");
}
header('Cache-Control: public');// THIS LINE IS ADDED TO MAKE  MSIE 
WORK
AT ALL
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($path) . "\n");
//send file contents
$fp=fopen($path, "r");
fpassthru($fp);

The Cache-Control header came from comments by [EMAIL PROTECTED], 04-Apr-2002
12:25, in http://www.php.net/manual/en/function.fpassthru.php
I'm not sure why these additions fixed the problem, but they did.  Maybe
someone out there with a better understanding than I can explain.  Hope this
helps.
Roger




--
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] New to PHP/mySQL - Help on script

2002-08-26 Thread Ray Healy \(Data Net Services\)

Thanks for everyones help yesterday but nI have come up against a problem
(as I am new). I have created my document as detailed below with notes. I
can see from the form that I have connected to the server, accessed the
correct database, created the statment and executed it. The problem is how
to display the information - as far as I can understand from yesterday if
the result is 0 then the villa is available. So what I need to do is if the
result = 0 display villa available and if the result is greater than 0 then
display villa not available . I know that the variables are getting to the
query as if I change the echo $result; to $sql;  and key in 3 as the id and
2 dates in the form I get the following:

SELECT COUNT(*) FROM bookings WHERE ('2002-04-04') BETWEEN booking_start AND
booking_end OR ('2002-04-10')BETWEEN booking_start AND booking_end AND
villa_id = ('3')

So, corrcet me if I am wrong but the query is working its just i cannot see
anything. I have spent hours on this today, reading books and looking at the
list. I hope that once I have done one good script I can then start to
understand it and create more :-)

Thanks for all your help


Ray



 
 
 
 Villa id number:
 Start date:
 End date:
 
 
 
 
 



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




Re: [PHP] PHP/MYSQL query error

2002-08-26 Thread Chris Crane

I got it working. It did not like the single quotes around the column names.

"Chris Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thank you. I will try that.
> "Justin French" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Why don't you do
> >
> > $result = mysql_query($query) or die(mysql_error());
> >
> > or
> >
> > $result = mysql_query($query);
> > echo mysql_error();
> >
> > That way, instead of "Query Failed" you'll get something meaningful...
> > probably something that will solve the problem.
> >
> >
> > Justin French
> >
> >
> > on 26/08/02 11:55 PM, Chris Crane ([EMAIL PROTECTED]) wrote:
> >
> > > Initially there was an error with too many values verses columns. But
I
> > > think it was fixed. I am double checking now.
> > >
> > >
> > > "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> > > 003201c24d07$b8560470$8102a8c0@000347D72515">news:003201c24d07$b8560470$8102a8c0@000347D72515...
> > >> [snip]
> > >> /* Performing SQL query */
> > >> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> > >> 'Address1', 'Address2',
> > >> 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
> > >> 'IP', 'Status', 'Comments')
> > >> VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
> > >> 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
> > >> '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
> > >> Requested', 'Testing')";
> > >> $result = mysql_query($query) or die("Query failed");
> > >> [/snip]
> > >>
> > >> Have you printed the query to make sure that the syntax is right? The
> > > first
> > >> thing that I see is that there are 13 items in your INSERT statement
> and
> > > 15
> > >> items in your VALUES statement ... these must match in order for the
> query
> > >> to work.
> > >>
> > >>
> > >> HTH!
> > >>
> > >> Jay
> > >>
> > >> Ask smart questions:
> > >> http://www.tuxedo.org/~esr/faqs/smart-questions.html
> > >> Top Questions on php-general;
> > >> (Answers can be found by RTFM, STFW, or STFA,
> > >> save for #3 and #6 which can probably be found
> > >> the same way, since they are usually one of the
> > >> other questions on this list.)
> > >> 1. How can I make file uploads work?
> > >> 2. How come my form will not pass variables?
> > >> 3. HELP! HELP! Please HELP!
> > >> 4. Register_Globals ?!?
> > >> 5. Is there a function to ... [insert thought here]?
> > >> 6. Anyone see the error in this code?
> > >>
> > >>
> > >
> > >
> >
>
>



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




RE: [PHP] Re: Automatic Download using URL, HELP!

2002-08-26 Thread Hankley, Chip

Bogdan - 

Sorry for the delay to your follow-up.

The total script is below... first let me explain a little more of what I'm
doing for clarity's sake.

I'm downloading a lot of data files from a site. The way the site works, you
supply some information in a form regarding the data set you want. This goes
to a PERL script which creates a packaged (zipped) data set and puts it in
an FTP directory.

What I wanted to do was write a script that would automatically do the form
submission, retrieve the name and location of the zip file, and save it to
my local hard disk. I happened to have a list of over 1000 data set names
that I wanted to get... so I just needed to loop through them.

FWIW, the "faking a form post" part of this, which is really the core of
what I'm doing, is based on the following in the pgp_general archives:

  http://marc.theaimsgroup.com/?l=php-general&m=101899239727991&w=2

You can search for this by searching the archives for the term "asphttp".
ASPHTTP is a tool for ASP that does the same thing... only it costs money,
and this little function is free! How cool is that?

Here's the script (got it working, BTW).

Chip

http://www.someserver.com/cgi-bin/some_script.pl
  $host="www.someserver.com;
  $path="/cgi-bin/some_script.pl";

  //The next line makes up the 'data to send' in the form. Apparently
  // if you start the string with a "&", this will use the POST method,
  // while if you start with a "?" it will use the GET method (or at
  // least it's acting like it's doing one or the other).
  $data_to_send = "&myDataSetName=" . $a .
"&FormVar1=Value1&FormVar2=Value2";
  PostToHost($host, $path, $data_to_send);
}

function PostToHost($host, $path, $data_to_send)
{
  //This part of the function creates a file that essentially POSTs the
  // $data_to_send information to the $host . $path location, and retrieves
  // the information into a variable called $returnData
  $returnData="";
  $fp = fsockopen($host,80);
  fputs($fp, "POST $path HTTP/1.1\n");
  fputs($fp, "Host: $host\n");
  fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
  fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
  fputs($fp, "Connection: close\n\n");
  fputs($fp, $data_to_send);

  //Loop through the variable $returnData line-by-line. In this case,
  // I'm searching for a keyword. The name of the resulting file is always
  // on a line like this:
  //  YOURFTPFILENAME = some_file_name_.
  //Once I hit this line, I want to save the entire line into a variable
  // called $filename, and break out of the loop.
  while(!feof($fp)) {
$returnData=fgets($fp, 128);
$filename = strstr($returnData, 'YOURFTPFILENAME');
if ($filename)
  break;
  }

  //Use some simple string parsing functions to strip out the
"YOURFTPFILENAME = "
  // part of the filename.
  $filename = substr($filename, 18);
  $filename = trim($filename);

  //Now, I'm going to connect to and read the file that was created. In this
case
  // it is always saved to the same location, so all I need to do is specify
the
  // file name. The file will be read into a variable called $contents.
  $host = "http://www.someserver.com/ftp_downloads/images/";;
  $fp2 = fopen($host . $filename, "rb+");
  $contents = fread ($fp2, 2500); //use some rediculously large number
in fread
  // to ensure that you get the whole
thing.

  //make a file to write to on the local system, and dump $contents into the
new
  // file.
  $fp3 = fopen("D:\\myFiles\\SomeDirectory\\" . $filename, "w");
  fputs($fp3, $contents);

  //close all of the documents
  fclose($fp);
  fclose($fp2);
  fclose($fp3);
}
/* End of Script ---*/
?>

> -Original Message-
> From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 22, 2002 10:29 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Automatic Download using URL, HELP!
> 
> 
> Just out of curiousity, how did you ever get PHP to prompt you where to 
> save a file? Could you post a more complete code sample?
> 
> Bogdan

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




Re: [PHP] PHP/MYSQL query error

2002-08-26 Thread Chris Crane

Thank you. I will try that.
"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Why don't you do
>
> $result = mysql_query($query) or die(mysql_error());
>
> or
>
> $result = mysql_query($query);
> echo mysql_error();
>
> That way, instead of "Query Failed" you'll get something meaningful...
> probably something that will solve the problem.
>
>
> Justin French
>
>
> on 26/08/02 11:55 PM, Chris Crane ([EMAIL PROTECTED]) wrote:
>
> > Initially there was an error with too many values verses columns. But I
> > think it was fixed. I am double checking now.
> >
> >
> > "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> > 003201c24d07$b8560470$8102a8c0@000347D72515">news:003201c24d07$b8560470$8102a8c0@000347D72515...
> >> [snip]
> >> /* Performing SQL query */
> >> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> >> 'Address1', 'Address2',
> >> 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
> >> 'IP', 'Status', 'Comments')
> >> VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
> >> 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
> >> '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
> >> Requested', 'Testing')";
> >> $result = mysql_query($query) or die("Query failed");
> >> [/snip]
> >>
> >> Have you printed the query to make sure that the syntax is right? The
> > first
> >> thing that I see is that there are 13 items in your INSERT statement
and
> > 15
> >> items in your VALUES statement ... these must match in order for the
query
> >> to work.
> >>
> >>
> >> HTH!
> >>
> >> Jay
> >>
> >> Ask smart questions:
> >> http://www.tuxedo.org/~esr/faqs/smart-questions.html
> >> Top Questions on php-general;
> >> (Answers can be found by RTFM, STFW, or STFA,
> >> save for #3 and #6 which can probably be found
> >> the same way, since they are usually one of the
> >> other questions on this list.)
> >> 1. How can I make file uploads work?
> >> 2. How come my form will not pass variables?
> >> 3. HELP! HELP! Please HELP!
> >> 4. Register_Globals ?!?
> >> 5. Is there a function to ... [insert thought here]?
> >> 6. Anyone see the error in this code?
> >>
> >>
> >
> >
>



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




[PHP] curl and UTF-8, follow up

2002-08-26 Thread Merijn van den Kroonenberg

I did some further testing, and i found that this behaviour is not
consistent. Actually i am pretty puzzled about this.

When i wrote the message below is was testing with a xml document that
contained only the following multi byte utf chacracter:
\303\253(octal utf8) (LATIN SMALL LETTER E WITH DIAERESIS)
The output from CURL got automatically decoded to latin1.

Then after i wrote the message i tested with another xml document that
contained the following multi byte utf character:
\342\202\254 (octal utf8) (EURO SIGN)
I was suprised to see that the output was now correct UTF-8.

Now i modified the first document and inserted the EURO SIGN in this
document. When i process this document again, the CURL output is UTF-8. So
it seems the output of CURL depends on what it detects on its imput, and it
will try to convert the data to latin1 if possible??

Does anyone know how i can disable this behaviour? For me, CURL should not
do any encoding of my data.

Greetings,
  Merijn van den Kroonenberg


- Original Message -
From: "Merijn van den Kroonenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 2:36 PM
Subject: [PHP] curl and UTF-8


> Hello List,
>
> I have a problem with the php CURL module and UTF-8 data.
> My php script uses curl to do a post to a perl/cgi script. This perl
script
> returns UTF-8 encoded XML. The perl script returns utf-8, i have verified
> that using the webserver logfiles, but the data that i receive in $result
> (see below) is decoded to ISO-8859-1.
>
> $ch = curl_init();
> curl_setopt($ch, CURLOPT_URL, $post_url);
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_VERBOSE, 0);
> curl_setopt($ch, CURLOPT_POST, 1);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
> $result = curl_exec ($ch);//  UTF compatible?
> curl_close ($ch);
>
> Anyone an idea how i can get curl to return me UTF-8 data?
>
> Thank you,
>
> Merijn van den Kroonenberg
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Re: Help with script

2002-08-26 Thread Erich Kolb

Please see below.  I have posted the entire script.

"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Then you're doing something wrong. Can you post a piece of code?
>
> Bogdan
>
> Erich Kolb wrote:
> > I have already downloaded the entire file so that Im not constantly
> > accessing FreshMeat.net's servers.  I will be processing the update
files as
> > soon as I can get the big one done.
> > I have also tried to use htmlspecialchars, and nl2br, but it doesnt look
> > like there is any output to process.
> >
> > "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]...
> >
> >>Hi!
> >>
> >>You can get the content of that file with php, using  >>$projects_rdf=file("http://www.freshmeat.net/backend/fm-projects.rdf";);
> >>?> - then you can do whatever you please with it. Make sure to
> >>htmlspecialchars() it before outputting to a browser - and consider a
> >>nl2br() while you're at it as well.
> >>
> >>Please be warned that it's a huge download though - you may consider
> >>only downloading the updates, available from freshmeat from another
> >>location (I'm sure you can find it easily, I don't have the link at
hand).
> >>
> >>HTH
> >>
> >>Bogdan
> >>
> >>Erich Kolb wrote:
> >>
> >>>I am trying to write a script that will take a look at the
freshmeat.net
> >>>database (http://www.freshmeat.net/backend/fm-projects.rdf), parse the
> >>
> > file,
> >
> >>>and insert it into a MySQL DB.  I have already wrote one for
> >>
> > slashdot.org
> >
> >>>that puts the output into html and displays it in a web browser and it
> >>
> > works
> >
> >>>fine.  I am trying to do the same to start with for freshmeat (I am
> >>
> > learning
> >
> >>>as I go) but there is nothing displayed on the browser.  Can someone
> >>
> > help me
> >
> >>>out with this?
> >>>
> >>>Here is the code I have written for slashdot:
> >>> >>>
> >>>$insideitem = false;
> >>>$tag = "";
> >>>$title = "";
> >>>$description = "";
> >>>$link = "";
> >>>
> >>>function startElement($parser, $name, $attrs) {
> >>> global $insideitem, $tag, $title, $description, $link;
> >>> if ($insideitem) {
> >>>  $tag = $name;
> >>> } elseif ($name == "STORY") {
> >>>  $insideitem = true;
> >>> }
> >>>}
> >>>
> >>>function endElement($parser, $name) {
> >>> global $insideitem, $tag, $title, $description, $link;
> >>> if ($name == "STORY") {
> >>>  printf("%s",
> >>>   trim($description),htmlspecialchars(trim($title)));
> >>>  #printf("%s",htmlspecialchars(trim($description)));
> >>>  $title = "";
> >>>  $description = "";
> >>>  $link = "";
> >>>  $insideitem = false;
> >>> }
> >>>}
> >>>
> >>>function characterData($parser, $data) {
> >>> global $insideitem, $tag, $title, $description, $link;
> >>> if ($insideitem) {
> >>> switch ($tag) {
> >>>  case "TITLE":
> >>>  $title .= $data;
> >>>  break;
> >>>  case "URL":
> >>>  $description .= $data;
> >>>  break;
> >>> }
> >>> }
> >>>}
> >>>
> >>>$xml_parser = xml_parser_create();
> >>>xml_set_element_handler($xml_parser, "startElement", "endElement");
> >>>xml_set_character_data_handler($xml_parser, "characterData");
> >>>$fp = fopen("http://www.slashdot.org/slashdot.xml","r";)
> >>> or die("Error reading RSS data.");
> >>>while ($data = fread($fp, 4096))
> >>> xml_parse($xml_parser, $data, feof($fp))
> >>>  or die(sprintf("XML error: %s at line %d",
> >>>   xml_error_string(xml_get_error_code($xml_parser)),
> >>>   xml_get_current_line_number($xml_parser)));
> >>>fclose($fp);
> >>>xml_parser_free($xml_parser);
> >>>
> >>>?>
> >>>
> >>>And here is what I have so far for FreshMeat.net.  Its pretty much the
> >>
> > same,
> >
> >>>but the elements are a little different:
> >>> >>>
> >>>$insideitem = false;
> >>>$tag = "";
> >>>$project_id = "";
> >>>$date_added = "";
> >>>$date_updated = "";
> >>>$projectname_short = "";
> >>>$projectname_full = "";
> >>>$desc_short = "";
> >>>$desc_full = "";
> >>>$url_homepage = "";
> >>>
> >>>function startElement($parser, $name, $attrs){
> >>>global $insideitem, $tag, $project_id, $date_added, $date_updated,
> >>>$projectname_short, $projectname_full, $desc_short, $desc_full,
> >>>$url_homepage;
> >>> if($insideitem){
> >>>  $tag = $name;
> >>>  }
> >>> elseif ($name == "project"){
> >>>  $insideitem = true;
> >>>  }
> >>>}
> >>>
> >>>function characterData($parser, $data){
> >>>global $insideitem, $tag, $project_id, $date_added, $date_updated,
> >>>$projectname_short, $projectname_full, $desc_short, $desc_full,
> >>>$url_homepage;
> >>> if($insideitem){
> >>>  switch ($tag){
> >>>   case "project_id":
> >>>   $project_id .=$data;
> >>>   break;
> >>>
> >>>   case "date_added":
> >>>   $date_added .=$data;
> >>>   break;
> >>>
> >>>   case "date_updated":
> >>>   $date_updated .=$data;
> >>>   break;
> >>>
> >>>   case "projectname_short":
> >>>   $projectname_short .=$data;
> >>>   break;
> >>>
> >>>   case "projectname_full":
> >>>   $projectname_full .=$data;
> >>>   break;
> >>>
> >>>   case "desc_short":
> >>>   $desc

Re: [PHP] PHP/MYSQL query error

2002-08-26 Thread Justin French

Why don't you do

$result = mysql_query($query) or die(mysql_error());

or 

$result = mysql_query($query);
echo mysql_error();

That way, instead of "Query Failed" you'll get something meaningful...
probably something that will solve the problem.


Justin French


on 26/08/02 11:55 PM, Chris Crane ([EMAIL PROTECTED]) wrote:

> Initially there was an error with too many values verses columns. But I
> think it was fixed. I am double checking now.
> 
> 
> "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> 003201c24d07$b8560470$8102a8c0@000347D72515">news:003201c24d07$b8560470$8102a8c0@000347D72515...
>> [snip]
>> /* Performing SQL query */
>> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
>> 'Address1', 'Address2',
>> 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
>> 'IP', 'Status', 'Comments')
>> VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
>> 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
>> '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
>> Requested', 'Testing')";
>> $result = mysql_query($query) or die("Query failed");
>> [/snip]
>> 
>> Have you printed the query to make sure that the syntax is right? The
> first
>> thing that I see is that there are 13 items in your INSERT statement and
> 15
>> items in your VALUES statement ... these must match in order for the query
>> to work.
>> 
>> 
>> HTH!
>> 
>> Jay
>> 
>> Ask smart questions:
>> http://www.tuxedo.org/~esr/faqs/smart-questions.html
>> Top Questions on php-general;
>> (Answers can be found by RTFM, STFW, or STFA,
>> save for #3 and #6 which can probably be found
>> the same way, since they are usually one of the
>> other questions on this list.)
>> 1. How can I make file uploads work?
>> 2. How come my form will not pass variables?
>> 3. HELP! HELP! Please HELP!
>> 4. Register_Globals ?!?
>> 5. Is there a function to ... [insert thought here]?
>> 6. Anyone see the error in this code?
>> 
>> 
> 
> 


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




Re: [PHP] PHP/MYSQL query error

2002-08-26 Thread Chris Crane

There are 15 columns and 15 pieces of data. In my second post I fixed this
error and pasted it into PHPMYADMIN and it worked fine, but not here...


"Chris Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Initially there was an error with too many values verses columns. But I
> think it was fixed. I am double checking now.
>
>
> "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> 003201c24d07$b8560470$8102a8c0@000347D72515">news:003201c24d07$b8560470$8102a8c0@000347D72515...
> > [snip]
> > /* Performing SQL query */
> > $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> > 'Address1', 'Address2',
> >  'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
> > 'IP', 'Status', 'Comments')
> > VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
> > 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
> >  '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
> > Requested', 'Testing')";
> > $result = mysql_query($query) or die("Query failed");
> > [/snip]
> >
> > Have you printed the query to make sure that the syntax is right? The
> first
> > thing that I see is that there are 13 items in your INSERT statement and
> 15
> > items in your VALUES statement ... these must match in order for the
query
> > to work.
> >
> >
> > HTH!
> >
> > Jay
> >
> > Ask smart questions:
> > http://www.tuxedo.org/~esr/faqs/smart-questions.html
> > Top Questions on php-general;
> > (Answers can be found by RTFM, STFW, or STFA,
> > save for #3 and #6 which can probably be found
> > the same way, since they are usually one of the
> > other questions on this list.)
> > 1. How can I make file uploads work?
> > 2. How come my form will not pass variables?
> > 3. HELP! HELP! Please HELP!
> > 4. Register_Globals ?!?
> > 5. Is there a function to ... [insert thought here]?
> > 6. Anyone see the error in this code?
> >
> >
>
>



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




Re: [PHP] PHP/MYSQL query error

2002-08-26 Thread Chris Crane

Initially there was an error with too many values verses columns. But I
think it was fixed. I am double checking now.


"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
003201c24d07$b8560470$8102a8c0@000347D72515">news:003201c24d07$b8560470$8102a8c0@000347D72515...
> [snip]
> /* Performing SQL query */
> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> 'Address1', 'Address2',
>  'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
> 'IP', 'Status', 'Comments')
> VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
> 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
>  '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
> Requested', 'Testing')";
> $result = mysql_query($query) or die("Query failed");
> [/snip]
>
> Have you printed the query to make sure that the syntax is right? The
first
> thing that I see is that there are 13 items in your INSERT statement and
15
> items in your VALUES statement ... these must match in order for the query
> to work.
>
>
> HTH!
>
> Jay
>
> Ask smart questions:
> http://www.tuxedo.org/~esr/faqs/smart-questions.html
> Top Questions on php-general;
> (Answers can be found by RTFM, STFW, or STFA,
> save for #3 and #6 which can probably be found
> the same way, since they are usually one of the
> other questions on this list.)
> 1. How can I make file uploads work?
> 2. How come my form will not pass variables?
> 3. HELP! HELP! Please HELP!
> 4. Register_Globals ?!?
> 5. Is there a function to ... [insert thought here]?
> 6. Anyone see the error in this code?
>
>



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




RE: [PHP] PHP/MYSQL query error

2002-08-26 Thread Jay Blanchard

[snip]
/* Performing SQL query */
$query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
'Address1', 'Address2',
 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
'IP', 'Status', 'Comments')
VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
 '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
Requested', 'Testing')";
$result = mysql_query($query) or die("Query failed");
[/snip]

Have you printed the query to make sure that the syntax is right? The first
thing that I see is that there are 13 items in your INSERT statement and 15
items in your VALUES statement ... these must match in order for the query
to work.


HTH!

Jay

Ask smart questions:
http://www.tuxedo.org/~esr/faqs/smart-questions.html
Top Questions on php-general;
(Answers can be found by RTFM, STFW, or STFA,
save for #3 and #6 which can probably be found
the same way, since they are usually one of the
other questions on this list.)
1. How can I make file uploads work?
2. How come my form will not pass variables?
3. HELP! HELP! Please HELP!
4. Register_Globals ?!?
5. Is there a function to ... [insert thought here]?
6. Anyone see the error in this code?



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




[PHP] Re: PHP/MYSQL query error

2002-08-26 Thread Chris Crane

I did some more testing and I found that I forgot the first field in the
columns section of the Statement. So now it looks like this:
I also copy and pasted the statement into PHPMYADMIN and it worked fine. It
just doesn't work here


function AddSignupRequest($Signup_FName, $Signup_LName, $Signup_Address1,
$Signup_Address2, $Signup_City,
$Signup_State, $Signup_Zip, $Signup_Email, $Signup_Phone,
$Signup_ContactMethod,
$Signup_Date, $Signup_IP, $Signup_Status, $Signup_Comments) {
/* Connecting, selecting database */
$dbh=mysql_connect ($MySQL_Host,  $MySQL_User, $MySQL_Password) or die
('I cannot connect to the database.');
 mysql_select_db ("havasuin_Signups");

/* Performing SQL query */
$query = "INSERT INTO SignupRequests ('SignupID', 'FirstName',
'LastName', 'Address1', 'Address2',
 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
'IP', 'Status', 'Comments')
VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
 '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
Requested', 'Testing')";
$result = mysql_query($query) or die("Query failed");

/* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);
 print "$Signup_LName, $Signup_FName\n";

}

"Chris Crane" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am getting a failed query error message. Could someone take a look and
let
> me know.
>
> //F U N C T I O N S
> //=
> function AddSignupRequest($Signup_FName, $Signup_LName, $Signup_Address1,
> $Signup_Address2, $Signup_City,
> $Signup_State, $Signup_Zip, $Signup_Email, $Signup_Phone,
> $Signup_ContactMethod,
> $Signup_Date, $Signup_IP, $Signup_Status, $Signup_Comments) {
> /* Connecting, selecting database */
> $dbh=mysql_connect ($MySQL_Host,  $MySQL_User, $MySQL_Password) or die
> ('I cannot connect to the database.');
>  mysql_select_db ("havasuin_Signups");
>
> /* Performing SQL query */
> $query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
> 'Address1', 'Address2',
>  'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
> 'IP', 'Status', 'Comments')
> VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
> 'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
>  '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
> Requested', 'Testing')";
> $result = mysql_query($query) or die("Query failed");
>
> /* Free resultset */
> mysql_free_result($result);
>
> /* Closing connection */
> mysql_close($link);
>  print "$Signup_LName, $Signup_FName\n";
>
> }
>
>



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




[PHP] PHP/MYSQL query error

2002-08-26 Thread Chris Crane

I am getting a failed query error message. Could someone take a look and let
me know.

//F U N C T I O N S
//=
function AddSignupRequest($Signup_FName, $Signup_LName, $Signup_Address1,
$Signup_Address2, $Signup_City,
$Signup_State, $Signup_Zip, $Signup_Email, $Signup_Phone,
$Signup_ContactMethod,
$Signup_Date, $Signup_IP, $Signup_Status, $Signup_Comments) {
/* Connecting, selecting database */
$dbh=mysql_connect ($MySQL_Host,  $MySQL_User, $MySQL_Password) or die
('I cannot connect to the database.');
 mysql_select_db ("havasuin_Signups");

/* Performing SQL query */
$query = "INSERT INTO SignupRequests ('FirstName', 'LastName',
'Address1', 'Address2',
 'City', 'State', 'Zip', 'Email', 'Phone', 'ContactMethod', 'Date',
'IP', 'Status', 'Comments')
VALUES ('', 'Chris', 'Crane', '655 Talcottville Road', 'Apt. 185',
'Vernon', 'CT', '06066', '[EMAIL PROTECTED]',
 '860-659-6464', 'Email', 'August 25, 2002', '64.252.232.82', 'Newly
Requested', 'Testing')";
$result = mysql_query($query) or die("Query failed");

/* Free resultset */
mysql_free_result($result);

/* Closing connection */
mysql_close($link);
 print "$Signup_LName, $Signup_FName\n";

}



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




[PHP] strange error message when trying to start apache

2002-08-26 Thread Jesse Lawrence

Hello again, so earlier I was trying to install
PHP-4.2.2 with Apache-2.0.40 and was having some sapi
problems.  I then read that I might be better off
going with Apache-1.3.26.  Well, I installed 1.3.26,
and then configured and installed php into apache as a
DSO.  Everything appeared to go smoothly, except when
I try to start up Apache, I get the following error
message:

Syntax error on line 205 of
/usr/local/apache/conf/httpd.conf:
API module structure `php4_module' in file
/usr/local/apache/libexec/libphp4.so is garbled
-perhaps this is not an Apache module DSO?
/usr/local/apache/bin/apachectl start: httpd could not
be started

Can anyone lend me a hand with this?

Thanks very much,
Jesse Lawrence



__ 
Post your ad for free now! http://personals.yahoo.ca

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




Re: [PHP] check unread messages in a forum

2002-08-26 Thread Eric Pignot

the method explained by Stas is the most common method used on all boards.
But if you need a more precise method, that will also require more
ressources from you server, what you can do is have a specific DB table
called "msg_read" taking 2 parameters : msg_id, user_id.
- Each time a user reads a message, you insert the pair "msg_id"/"user_id".
- Each time the user reloads a page,you do something like this :
$sql = "select msg_id from msg_read where user_id = ".addslashes($user_id);
// process $sql query
$msg_list = array();
while ( $row = getNextRow($mysqlResult)){
array_push($msg_list, $row[0]);
}
- when displaying the list of all message you just check if the message is
in the array $msg_list
if ( in_array($currentMsg, $msg_list)){
echo "READ";
}else{
echo "UNREAD";
}

regards

Eric






> Just store the user's last log-in date/time either in the database or in
> cookie. On the next log-in "select * messages where creationDate >
> $userLastLoginDate" and highlight those selected. It won't work for every
> particular unread message, but I doubt if one needs to be that much
> specific.
>
> HTH, Stas
>
> - Original Message -
> From: "Charlotte" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 26, 2002 1:04 PM
> Subject: [PHP] check unread messages in a forum
>
>
> > I have made a forum in PHP, and the users are logged in using cookies. I
> > want all new threads (and if there are new replies in an old thread) to
be
> > highlight or something like that.
> >
> > How do I check if a user has read a message or not?
> >
> >
> >
> > /Charlotte
> >
> >
> >
> >
> > --
> > 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] check unread messages in a forum

2002-08-26 Thread Eric Pignot

the method explained by Stas is the most common method used on all boards.
But if you need a more precise method, that will also require more
ressources from you server, what you can do is have a specific DB table
called "msg_read" taking 2 parameters : msg_id, user_id.
- Each time a user reads a message, you insert the pair "msg_id"/"user_id".
- Each time the user reloads a page,you do something like this :
$sql = "select msg_id from msg_read where user_id = ".addslashes($user_id);
// process $sql query
$msg_list = array();
while ( $row = getNextRow($mysqlResult)){
array_push($msg_list, $row[0]);
}
- when displaying the list of all message you just check if the message is
in the array $msg_list
if ( in_array($currentMsg, $msg_list)){
echo "READ";
}else{
echo "UNREAD";
}

regards

Eric






> Just store the user's last log-in date/time either in the database or in
> cookie. On the next log-in "select * messages where creationDate >
> $userLastLoginDate" and highlight those selected. It won't work for every
> particular unread message, but I doubt if one needs to be that much
> specific.
>
> HTH, Stas
>
> - Original Message -
> From: "Charlotte" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, August 26, 2002 1:04 PM
> Subject: [PHP] check unread messages in a forum
>
>
> > I have made a forum in PHP, and the users are logged in using cookies. I
> > want all new threads (and if there are new replies in an old thread) to
be
> > highlight or something like that.
> >
> > How do I check if a user has read a message or not?
> >
> >
> >
> > /Charlotte
> >
> >
> >
> >
> > --
> > 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] Object member variable names

2002-08-26 Thread Karl Moritz Hermann

Hi,

I've got a little problem with variable naming of object members. Here is my
situation: I've got a website form, whoms contents will be saved in a MySQL
table with two fields: name and value. The name could be anything like
"bla->test", "array[3]->test[4]->name"...

Now I have a php script reading out the MySQL table, and I want to assign
the variables like this:
$object->$name, i.e.
$object->bla->test = "some value";
$object->array[3]->tes[4]->name = "some other value"; etc.

Using $object->$name doesn't work, as this seems to ignore submembers and
arrays.
Any ideas how to solve my problem?

Regards,

Karl

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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




Re: [PHP] search in serialized string

2002-08-26 Thread DL Neil

Rodrigo,

Inherited problems = ouch!

Sorry I don't keep old list msgs, perhaps you mentioned this before: does
the language skills field contain:
1 both the language and the skill-level, eg English - Advanced
1b what separator is used between the two words?
2 more than one language/skill-level where applicable, eg English -
Advanced, German - Intro.
2b what separator is used between language entries?

What is the database field description in the table schema?

Please advise,
=dn



> well, I my opinion is not the way to work, but like I said the work was
done
> by other guy, and now I have the problem to solve. So i back to old
question
> :-)
> How can I search with some precision in a serialized string?
>
>
>
> on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote:
>
> > Rodrigo,
> >
> > Then the question to be asked is: is serialize()ing this data good
> > design/technique, or is there a better way?
> >
> > Regards,
> > =dn
> >
> >
>
>
> --
> 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] check unread messages in a forum

2002-08-26 Thread Stas Maximov

Hi,

Just store the user's last log-in date/time either in the database or in
cookie. On the next log-in "select * messages where creationDate >
$userLastLoginDate" and highlight those selected. It won't work for every
particular unread message, but I doubt if one needs to be that much
specific.

HTH, Stas

- Original Message -
From: "Charlotte" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 1:04 PM
Subject: [PHP] check unread messages in a forum


> I have made a forum in PHP, and the users are logged in using cookies. I
> want all new threads (and if there are new replies in an old thread) to be
> highlight or something like that.
>
> How do I check if a user has read a message or not?
>
>
>
> /Charlotte
>
>
>
>
> --
> 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] check unread messages in a forum

2002-08-26 Thread Matt Schroebel

> From: Charlotte [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, August 26, 2002 8:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] check unread messages in a forum
> 
> 
> I have made a forum in PHP, and the users are logged in using 
> cookies. I
> want all new threads (and if there are new replies in an old 
> thread) to be
> highlight or something like that.
> 
> How do I check if a user has read a message or not?

I'd say you'd need to keep a list of messages read by users somewhere.

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




[PHP] make problems, sapi

2002-08-26 Thread Jesse Lawrence

Hello all, I'm trying to install php 4.2.2 as a DSO
with Apache-2.0.40 on a Mandrake Linux machine, and
have come come upon a problem.  It's having problems
with sapi(?).  I'm just wondering if anyone might know
what is causing this problem, and if you could
possibly point me towards a solution.  Here's the
error message:

sapi_apache2.c: In function `php_register_hook':
sapi_apache2.c:534: warning: passing arg 3 of
`ap_register_output_filter' makes pointer from integer
without a cast
sapi_apache2.c:534: too few arguments to function
`ap_register_output_filter'
sapi_apache2.c:535: warning: passing arg 3 of
`ap_register_input_filter' makes pointer from integer
without a cast
sapi_apache2.c:535: too few arguments to function
`ap_register_input_filter'
make[3]: *** [sapi_apache2.lo] Error 1
make[3]: Leaving directory
`/home/jalaw/downloads/php-4.2.2/sapi/apachefilter'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/jalaw/downloads/php-4.2.2/sapi/apachefilter'
make[1]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/jalaw/downloads/php-4.2.2/sapi/'
make: *** [all-recursive] Error 1
Thanks very much,
Jesse Lawrence

__ 
Post your ad for free now! http://personals.yahoo.ca

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




[PHP] curl and UTF-8

2002-08-26 Thread Merijn van den Kroonenberg

Hello List,

I have a problem with the php CURL module and UTF-8 data.
My php script uses curl to do a post to a perl/cgi script. This perl script
returns UTF-8 encoded XML. The perl script returns utf-8, i have verified
that using the webserver logfiles, but the data that i receive in $result
(see below) is decoded to ISO-8859-1.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $post_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec ($ch);//  UTF compatible?
curl_close ($ch);

Anyone an idea how i can get curl to return me UTF-8 data?

Thank you,

Merijn van den Kroonenberg



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




[PHP] check unread messages in a forum

2002-08-26 Thread Charlotte

I have made a forum in PHP, and the users are logged in using cookies. I
want all new threads (and if there are new replies in an old thread) to be
highlight or something like that.

How do I check if a user has read a message or not?



/Charlotte




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




Re: [PHP] search in serialized string

2002-08-26 Thread Rodrigo Peres

well, I my opinion is not the way to work, but like I said the work was done
by other guy, and now I have the problem to solve. So i back to old question
:-)
How can I search with some precision in a serialized string?



on 8/24/02 12:13 PM, DL Neil at [EMAIL PROTECTED] wrote:

> Rodrigo,
> 
> Then the question to be asked is: is serialize()ing this data good
> design/technique, or is there a better way?
> 
> Regards,
> =dn
> 
> 


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




  1   2   >