|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Wed Jun 27 2001 - 17:29:12 CDT
php-general Digest 27 Jun 2001 22:29:12 -0000 Issue 723
Topics (messages 55315 through 55420):
error in running apache while --with-apxs is a config option
55315 by: Yamin Prabudy
Re: LDAP
55316 by: Nick Talbott
Re: Strange error on mysql_fetch_array
55317 by: elias
55340 by: Richard Lynch
55363 by: CC Zona
55393 by: Ronny Mandal
55399 by: Chadwick, Russell
Re: search for a better php source code viewer
55318 by: ReDucTor
55362 by: José León Serna
55406 by: Jorg Krause
55416 by: Aral Balkan
Re: passing variables from - to frames
55319 by: elias
55331 by: Richard Lynch
55358 by: Taylor, Stewart
Re: Problem with returning value from function
55320 by: elias
55353 by: Richard Lynch
55361 by: CC Zona
Re: PHP crashing IIS 5 on Wnidows 2K
55321 by: Phil Driscoll
55400 by: Jason Lustig
55413 by: Aral Balkan
Re: Batch Coding Help Please [LONG]
55322 by: Richard Lynch
Re: mail() always returns false. Why?
55323 by: Richard Lynch
Re: file("http://www.php.net") error?
55324 by: Richard Lynch
Re: Installation problems with MySQL
55325 by: Richard Lynch
55373 by: Ryan Ware
Re: Passing an array to a C program from a php script??
55326 by: Richard Lynch
Re: Trapping Fatal Errors
55327 by: Richard Lynch
Re: Fetching binaires from an e-mail
55328 by: Richard Lynch
Re: Oracle and PHP
55329 by: Richard Lynch
Re: Expand/parse variables in file
55330 by: Richard Lynch
Re: Operation must use an updateable query?? help.!
55332 by: Richard Lynch
Re: MIME type
55333 by: Richard Lynch
55365 by: teo.gecadsoftware.com
55412 by: scott [gts]
Re: Events Listings
55334 by: Richard Lynch
55402 by: scott [gts]
55420 by: Rick Proctor
Re: [OT-ish] Optional Extras.
55335 by: Richard Lynch
Re: --with-zlib/--with-zlib-dir and --enable-xslt
55336 by: Richard Lynch
Re: a standalone PHP script to update MySql server
55337 by: Richard Lynch
Re: shared object not open
55338 by: Richard Lynch
Re: How to get PHP to do a POST??
55339 by: Richard Lynch
55360 by: CC Zona
Re: Session over SSL
55341 by: Richard Lynch
Re: Filtering out \ when a ' is user entered?
55342 by: Richard Lynch
55374 by: Jamie Thompson
55376 by: dempsejn.georgetown.edu
55377 by: ReDucTor
55379 by: Matt Williams
55381 by: Steve
55390 by: Meir Kriheli - MKsoft
55391 by: Jason Stechschulte
55392 by: Christian Reiniger
55395 by: James Cox
55404 by: Steve Edberg
55405 by: Aral Balkan
55408 by: scott [gts]
55417 by: Philip Olson
55419 by: Steve Werby
Re: Latest documentation in PDF format?
55343 by: Richard Lynch
Re: back from a search form
55344 by: Richard Lynch
55386 by: Jason Stechschulte
Re: Accessing a Berkeley DB V1.85 using PHP V4.0.5
55345 by: Richard Lynch
Re: I want to get the input of keyboard
55346 by: Richard Lynch
Re: Remove value from array
55347 by: Richard Lynch
Re: About Integration PHP- VPOS
55348 by: Richard Lynch
Re: looking for a class that handles cookies and sessions
55349 by: Richard Lynch
55385 by: Jason Stechschulte
55398 by: teo.gecadsoftware.com
Re: Associated arrays
55350 by: Richard Lynch
Re: [PHP-WIN] Problems running php from samba network shares...
55351 by: Richard Lynch
Re: POST method invocation of C CGI
55352 by: Richard Lynch
Re: Enter to BR
55354 by: Richard Lynch
Re: $REMOTE_ADDR error
55355 by: Richard Lynch
55357 by: Colin May
55364 by: Brave Cobra
Re: HOW TO: Reload a frame with a different URL? [LONG]
55356 by: Richard Lynch
55384 by: Marc Johnson
mssql and uniqueidentifier's
55359 by: Thomas Häger
55411 by: scott [gts]
Re: Auction PHP Solution?
55366 by: Ralph Guzman
PHP code secrity on VirtualHost
55367 by: Aaron Bennett
Mail()'s not playing nicely :(
55368 by: Jamie Thompson
Re: PHP with JAVA support
55369 by: Andrzej Swedrzynski
Help - Lotus
55370 by: TV Karthick Kumar
Re: run a fuction at each intervals
55371 by: Tom Carter
Re: HOW TO: Reload a frame with a different URL?
55372 by: elias
55387 by: Marc Johnson
PHP Menu.
55375 by: Deon Heunis
Bug Database.
55378 by: Jorge Faria
problem with header()
55380 by: Sheni R. Meledath
Lotus - help
55382 by: tvkarthick.myrealbox.com
Missing arguments for function in class? (object-oriented programming)
55383 by: Thomas David Kehoe
Re: sending e-mail with variables
55388 by: Jason Stechschulte
Mail slow
55389 by: Tim Ward
calculate download time
55394 by: Rhett Hermer
quoted printable decode
55396 by: tvkarthick.myrealbox.com
55397 by: tvkarthick.myrealbox.com
Re: PHP 4.0.6 and APXS2
55401 by: Chadwick, Russell
Stopping stolen / spoofed / linked sessions
55403 by: adam (dahamsta)
Re: PHP Uptime error
55407 by: scott [gts]
OT MS error messages
55409 by: scott [gts]
variables in text or placeholders
55410 by: scott [gts]
dbf+index
55414 by: Szommer Ákos
PHP finally working...
55415 by: bcpunch.netunlimited.net
Re: problems with round ..
55418 by: Chad Day
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
i got this error
Syntax error on line 205 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server:
/usr/local/apache/libexec/libphp4.so: Undefined
symbol "alloc_globals"
can anybody help me fix it i used php4.05 with apache 1.3.20
with ./configure --with-apxs=/usr/local/apache/bin/apxs
--with-mysql=/usr/local
the configure and make process is just OK no error....
Yamin Prabudy
attached mail follows:
Hello, Derek
[snip]
>However I decided to include another objectclass (uidObject) and now it
>returns with:
> error - Object class violation
> error number - 65
>
[snip]
>
>$ds=ldap_connect("localhost");
>if ($ds) {
> $r=ldap_bind($ds, "cn=admin,dc=domain,dc=com","mypassword");
> $rdn = "o=$username,ou=suppliers,ou=customers,dc=domain,dc=com";
>
> $info["userPassword"]="$password";
> $info["o"]="$organisation";
> $info["uid"]="$username";
> $info["objectclass"]="organization";
> $info["objectclass"]="uidObject";
>
[snip]
There is a mistake in your code with the way you are trying to provide multiple
values for the objectclass attribute.
Your code first assigns "organization" to the objectclass, then replaces this by
assigning "uidObject" to the same variable.
I think what you need is
$info["objectclass"][0]="organization";
$info["objectclass"][1]="uidObject";
This is the way you assign multiple values to an attribute.
I suspect that from the error message you were getting your LDAP server was
doing schema checking and probably the rules were not allowing an entry that was
missing the objectclass "organization".
Regards
Nick Talbott
IT Policy and Strategy Manager, Powys County Council, UK
email nickt
powys.gov.uk
FAX +44 (0) 1597 824781
web http://www.powys.gov.uk and http://www.powysweb.co.uk
attached mail follows:
dunno....
but my it's just failing at the mysql_connect()
shouldn't you specify the password too?
<tjacobs-php
codegnome.org> wrote in message
news:Pine.LNX.4.33.0106261356390.29634-100000
cyrix.codegnome.org...
> The following code fragment works properly, in that I get the output I'm
> expecting. However, if I don't disable error messages with
, I get an
> error message from PHP saying: "Warning: Supplied argument is not a valid
> MySQL result resource in /var/www/htdocs/cgcm/test2.php on line 9."
>
> How can the resource be invalid if I'm getting the results back? I'd
> appreciate any explaination.
>
> $connection_id =
mysql_connect ('localhost', 'root') or die('No
> connection.');
> $database_id =
mysql_select_db ('cgcms', $connection_id) or die('No
> connection.');
>
> ...
>
> $result_id =
mysql_query("DESC $table_name $field_name");
> $row = mysql_fetch_array($result_id); # This is line 9
>
> --
> Todd A. Jacobs
> CodeGnome Consulting, LTD
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
> How can the resource be invalid if I'm getting the results back? I'd
> appreciate any explaination.
What results are you getting?...
> $connection_id =
mysql_connect ('localhost', 'root') or die('No
> connection.');
> $database_id =
mysql_select_db ('cgcms', $connection_id) or die('No
> connection.');
>
> ...
>
> $result_id =
mysql_query("DESC $table_name $field_name");
I don't think "DESC $table_name $field_name" is valid SQL, is it?...
DESC is DESCENDING in an ORDER BY clause...
Perhaps if you used DESCRIBE?... Is that what you are doing?...
There are built-in functions for getting the table definitions and so forth.
They may work better...
> $row = mysql_fetch_array($result_id); # This is line 9
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
In article <046401c0fee3$a6c789e0$6401a8c0
Lynchux100>,
ceo
l-i-e.com ("Richard Lynch") wrote:
> > $result_id =
mysql_query("DESC $table_name $field_name");
>
> I don't think "DESC $table_name $field_name" is valid SQL, is it?...
>
> DESC is DESCENDING in an ORDER BY clause...
>
> Perhaps if you used DESCRIBE?... Is that what you are doing?...
DESC {table name} [{field name}] is a valid expression in MySQL. It's a synonym for the DESCRIBE keyword. Though the query could still be failing for any number of reasons (invalid table name, invalid field name, older version of MySQL that doesn't support that syntax, etc.).
Throw in die(), mysql_error(), $php_errormsg; turn down error_reporting,
and/or turn off display_errors...anything but using the
sign by itself (a
surefire way to never clue in to much stuff is silently going wrong).
-- CC
attached mail follows:
----- Original Message -----
From: "David Robley" <huntsman
www.nisu.flinders.edu.au>
To: <tjacobs-php
codegnome.org>; "PHP General" <php-general
lists.php.net>
Sent: Wednesday, June 27, 2001 8:47 AM
Subject: Re: [PHP] Strange error on mysql_fetch_array
> On Wed, 27 Jun 2001 06:31, tjacobs-php
codegnome.org wrote:
> > The following code fragment works properly, in that I get the output
> > I'm expecting. However, if I don't disable error messages with
, I get
> > an error message from PHP saying: "Warning: Supplied argument is not a
> > valid MySQL result resource in /var/www/htdocs/cgcm/test2.php on line
> > 9."
> >
> > How can the resource be invalid if I'm getting the results back? I'd
> > appreciate any explaination.
> >
> > $connection_id =
mysql_connect ('localhost', 'root') or die('No
> > connection.');
> > $database_id =
mysql_select_db ('cgcms', $connection_id) or
> > die('No connection.');
> >
> > ...
> >
> > $result_id =
mysql_query("DESC $table_name $field_name");
> > $row = mysql_fetch_array($result_id); # This is line 9
>
> Try using mysql_error() to see if there is some feedback from mysql. Put
> it just after your mysql_query().
>
> --
> David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
> CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
>
> Common sense isn't...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
Hmm, maybe the prefix '
' suppresses the returning link-identifier. Just a
suggestion!
--RM
attached mail follows:
From experience with oracle, desc only works in an sql prompt, not through code. So use the more lengthy method
in mysql: SHOW FIELDS FROM $table_name
in oracle: SELECT c.column_name, c.data_type, c.data_length, c.data_precision, c.data_scale, c.nullable FROM sys.dba_tab_columns c WHERE c.owner = '$owner' AND c.table_name = '$table_name'
---
Toolshed Computer Productions - Professional PHP Hosting
Hosting - Dedicated Servers - Design - Programming
http://www.toolshed51.com
-----Original Message-----
From: tjacobs-php
codegnome.org [mailto:tjacobs-php
codegnome.org]
Sent: Tuesday, June 26, 2001 2:01 PM
To: PHP General
Subject: [PHP] Strange error on mysql_fetch_array
The following code fragment works properly, in that I get the output I'm
expecting. However, if I don't disable error messages with
, I get an
error message from PHP saying: "Warning: Supplied argument is not a valid
MySQL result resource in /var/www/htdocs/cgcm/test2.php on line 9."
How can the resource be invalid if I'm getting the results back? I'd
appreciate any explaination.
$connection_id =
mysql_connect ('localhost', 'root') or die('No
connection.');
$database_id =
mysql_select_db ('cgcms', $connection_id) or die('No
connection.');
...
$result_id =
mysql_query("DESC $table_name $field_name");
$row = mysql_fetch_array($result_id); # This is line 9
--
Todd A. Jacobs
CodeGnome Consulting, LTD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
For additional commands, e-mail: php-general-help
lists.php.net
To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
EditPlus is the best program EVER!!!!
I use it for every thing... :) :)
----- Original Message -----
From: "Patrick Calkins" <_pcalkins
oemsupport.com>
To: <php-general
lists.php.net>
Sent: Wednesday, June 27, 2001 9:45 AM
Subject: Re: [PHP] search for a better php source code viewer
> You should try EditPlus !!! I love it!
> http://www.editplus.com/
> It runs on Win95/98/2000/NT and will create a Unix/Mac/PC file. Has custom
> syntax highlighting, spell checker, integrated web browser, etc, etc. It
> handles PHP, ASP, Perl, C++, and more...
>
>
> ""scott [gts]"" <scott
graphictype.com> wrote in message
> news:KFEKLFMNHDILCMFAEKJCMEKKCLAA.scott
graphictype.com...
> > im a textpad fan. (for windows)
> > http://textpad.com/
> >
> > it supports custom syntax hilighting,
> > line numbers, and a ton of other features
> > that i use :)
> >
> >
> > > > -----Original Message-----
> > > > From: Tyler Longren [mailto:tyler
captainjack.com]
> > > > Sent: Tuesday, June 26, 2001 10:26 AM
> > > > To: joerg
krause.net; php
> > > > Subject: Re: [PHP] search for a better php source code viewer
> > > >
> > > >
> > > > I suggest ConTEXT. It's free, and it's for windows.
> > > > http://www.fixedsys.com/context
> > > >
> > > > And for Linux, I suggest Nedit.
> > > > http://www.nedit.org/
> > > >
> > > > Tyler
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> > For additional commands, e-mail: php-general-help
lists.php.net
> > To contact the list administrators, e-mail: php-list-admin
lists.php.net
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hello: > try http://astro.phpwebhosting.com/~ttm/ You can access using this address, or http://www.visualphpstudio.com or http://www.qadram.com
> however I do think, though am not sure, visual Php is available on linex & windows (I'm using windows) QaDRAM it's not still available on Linux, according the survey I will finish the windows version first, and then I will port it to Linux.
Best Regards -------------------------------------------------------- QaDRAM, RAD development for the WEB http://www.qadram.com
attached mail follows:
Hi,
> -----Original Message-----
> From: Jason Lotito [mailto:jason
lehighweb.com]
> Sent: Tuesday, June 26, 2001 11:05 PM
> To: 'Tyler Longren'; joerg
krause.net; 'php'
> Subject: RE: [PHP] search for a better php source code viewer
>
>
> You mean something like this:
>
> http://www.newbienetwork.net/phpcodems.php?as=viewcode&id=14
>
> Jason Lotito
> www.NewbieNetwork.net
> PHP Newsletter: http://www.newbienetwork.net/ciao.php
> PHP, MySQL, PostgreSQL Tutorials, Code Snippets, and so much more
>
[...]
Yes, that's I mean, but this I've allready. The usage of
the output buffer is interesting, but it is still based on
highlight_string(). What I want is a function, in plain PHP,
which runs on the server, not on the client, act as a
pretty printer for php code, expandable for my own functions.
Has nobody ever written a better/customizable
highlight_file()-function?
Joerg
attached mail follows:
I second that, EditPlus rules!
It's also very easy to create your own custom syntax highlighting rules, templates and auto-completes so it can highlight custom libraries, etc. that you use. For example, if anyone's using Manuel's excellent Metabase database abstraction class, I've uploaded syntax files, etc. for the XML tags it uses to describe the database schemas.
Aral :)
______________________________
(aral
kismia.com)
New Media Producer, Kismia, Inc.
(aral
american.edu)
Adj. Prof., American University
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
attached mail follows:
Hey sorry 'M' about my last post...
I was giving you ideas mixed with how to access an IFRAME ;)
anyway to access frames you have to do like:
window.parent.framea.window.document.forma.texta.value = window.parent.frameb.window.document.formb.textb.value
"M" <mavem
usa.net> wrote in message news:3B3856E1.DB33AAF
usa.net...
> Hello, sorry this question here (it is not true PHP question), but I use
> some variables into PHP scripts and need
> pass these variables from one frame to another.
>
> I want pass variable values between frames, these definded via input
> hidden tags into form definition.
> I have first frame name=framea containing form name=forma
> then second frame name=frameb form name=formb
> I have forma input type=hidden name=vara value=valuea and want to pass
> this value to formb type=hidden name=varb
>
> I wrote little javascript into framea something like
> frameb.formb.varb.value = framea.forma.vara.value but only got
> 'javascript error'. Java doesnt reckognizes frameb.formb.varb names at
> all. I tried also by creating <object id=frameb> into frameb header
> but this also didnt work.
> Is there some other solution?
>
> Please help to solve this one
>
> Thanks very much
>
> Miguel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
framea and frameb don't know about each other, but their document and their window should know both of them.
So, you can use document.framea... and document.frameb... to access each other's variables.
Also, if these variables are coming from PHP, and if you are using FRAMEs mostly for looks, and not so much to save downloading one of the frames all the time, another alternative, avoiding JavaScript, which you can never trust to be on, much less to work properly when it is on, is to actually send all your links back to the main frameset page, and pass the variables down in parallel:
---- main.php ---- <?php $foo = isset($foo) ? $foo : ''; ?> <HTML> <FRAMESET> <FRAME SRC=framea.php?foo=<?php echo urlencode($foo);?>> <FRAME SRC=frameb.php?foo=<?php echo urlencode($foo);?>> </FRAMESET> </HTML>
---- framea.php <HTML><BODY> <?php echo "foo is $foo<BR>\n"; ?> <A HREF=main.php?foo=bar TARGET="_top">bar</A> <A HREF=main.php?foo=different TARGET="_top">different</A> </BODY></HTML>
---- frameb.php <HTML><BODY> <?php echo "foo is $foo<BR>\n"; ?>
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
The correct javascript syntax is.
parent.frames[1].document.formb.varb.value = parent.frames[0].document.forma.vara.value;
-Stewart
-----Original Message-----
From: Greg Donald [mailto:greg
destiney.com]
Sent: 26 June 2001 16:18
To: mavem
usa.net; php-general
lists.php.net
Subject: Re: [PHP] passing variables from - to frames
> Hello, sorry this question here (it is not true PHP question), but I use > some variables into PHP scripts and need > pass these variables from one frame to another. > > I want pass variable values between frames, these definded via input > hidden tags into form definition. > I have first frame name=framea containing form name=forma > then second frame name=frameb form name=formb > I have forma input type=hidden name=vara value=valuea and want to pass > this value to formb type=hidden name=varb > > I wrote little javascript into framea something like > frameb.formb.varb.value = framea.forma.vara.value but only got > 'javascript error'. Java doesnt reckognizes frameb.formb.varb names at > all. I tried also by creating <object id=frameb> into frameb header > but this also didnt work. > Is there some other solution?
If you're using Apache, you can use $QUERY_STRING
---------------------------------------------------------------------------- -------------------- destiney - (des-ti-ny) - n. 1. deity of all things "html", 2. common internet addict, 3. lover of late 80's heavy metal music, 4. Activist for the terminally un-elite; see also - cool guy, des, mr. php...
It's 4:00am, your web site is still up, why are you? http://phplinks.org/ http://destiney.com/ ---------------------------------------------------------------------------- --------------------
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Or if you want to keep your code as is just define proc() as:
function proce(&$line) { .... }
"CC Zona" <cczona
nospam.invalid> wrote in message
news:9hb78a$5a7$1
w153.z064000151.sjc-ca.dsl.cnc.net...
> In article <17753609234.20010626151431
pacifier.com>,
> rkurth
pacifier.com (Richard Kurth) wrote:
>
> > I am having problem getting the info back after I send it to a
> > function.
> <snip>
> >
> > if ($line1){ //This is what is in Line1 Dear ##fullname##
> > $line=$line1;
> > proce($line);
> > $line1=$line;
> > }
> >
> > Function proce($line){
> <snip>
> > return $line;
> > }
>
> You're returning a value to nowhere. Change"proce($line)" to
> "$returnedvalue=proce($line)".
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
> if ($line1){ file://This is what is in Line1 Dear ##fullname## > $line=$line1; > proce($line); > $line1=$line; > }
I think you just want:
if ($line1){ $line1 = proce($line1); }
And, since proce won't do much with an empty $line1 anyway, you can probably get rid of the if() parts.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> > You're returning a value to nowhere. Change"proce($line)" to > > "$returnedvalue=proce($line)".
> Or if you want to keep your code as is just define proc() as: > > function proce(&$line) { .... }
Or use "global $line;" or add $line to the $GLOBALS array, so that the function's local changes to $line carry over into the global namespace.
-- CC
attached mail follows:
On Tuesday 26 June 2001 21:35, Jason Lustig wrote: > I have PHP 4.04pl1 set up on a IIS 5 server on Windows 2k. However, it > keeps on crashing the server -- not all the time, but sometimes it does, > sometimes it doesn't. And I have no idea whatsoever what is causing it. I > *think* that it has to do with my include()s. I end up including all my > function and nav libraries into each and every page, which turns out to > maybe 10 includes. Theoretically, yes, it would put a hit on the server > because PHP uses the file system so much, but it shouldn't crash it. > > Is this possibly the reason it is crashing?
Assuming that you are using the ISAPI version of PHP, it is probably crashing because that version of PHP is not very stable. You should upgrade to 4.0.6 which contains improvements in that area, but it is still not perfect. If you find 4.0.6 unstable either change from ISAPI to CGI or if you can, change from IIS to Apache and use the Apache module version of PHP.
Cheers
-- Phil Driscoll
attached mail follows:
>Assuming that you are using the ISAPI version of PHP, it is >probably crashing >because that version of PHP is not very stable. You should upgrade >to 4.0.6 >which contains improvements in that area, but it is still not >perfect. If you >find 4.0.6 unstable either change from ISAPI to CGI or if you can, change >from IIS to Apache and use the Apache module version of PHP.
OK, cool. :) I *think* I'm using the ISAPI version. Unfortunately, I don't have much control over the server situation for this particular site...
--Jason
attached mail follows:
I would agree, I had PHP 4 installed on IIS running on Win2000 and it was very unstable. Since switching to Apache, I've had no problems whatsoever -- it's rock solid!
Aral :)
______________________________
(aral
kismia.com)
New Media Producer, Kismia, Inc.
(aral
american.edu)
Adj. Prof., American University
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
attached mail follows:
> mail($Email, $MsgTitle, "$Message\n\n\n$Content", $Header);
Here is the "culprit" -- This is going to fire up a sendmail process for every single email.
You are going to choke your server to death with tons and tons of sendmail processes.
Actually, after about 50 of these, the mail() function is going to fail. With an "Unable to fork" message, I think. Then, a few of those early sendmails will finish, and your loop will still be going, and some more will go through okay, until you're back up to 50 concurrent sendmails, and some more will choke, and... You'll never be able to keep track of which ones worked.
Here is an excerpt from some code I wrote recently.
This uses PostgreSQL, so you'll have to adjust it a bit.
Hopefully the comments and debug output I've left in there until this is in production awhile will be sufficient as-is.
Better more general-purpose code is available in Manuel Lemos' mail class at UpperDesign and several other SMTP email functions/classes. This is pretty raw and unplugged, but that's the way I like it :-)
*ALL* of these lines are needed to essentially replace the one line above...
<?php # This is to be run as a cron job. # This script: # Opens the SMTP port # Initiates an SQL transaction (thus making this script thread-safe) # Grabs any queued email, in "liame" order, and for each email: # Attempts to send that email via SMTP # Snags the emailid from SMTP # Updates the database with the emailid and marks that email "sent" # # I may also code it to: # Move any sent emails from "queue" to "sent" # Or maybe I'll do that in another script, to reduce execution time of this one
# Open SMTP socket: $smtp = fsockopen('localhost', 25, &$errorno, &$errorstr, 2.0); if (!$smtp){ if ($errno){ die("SMPT returned Error #$errno: $errorstr<BR>\n"); } else{ die("Unable to open SMTP<BR>\n"); } } # ... and let SMTP say "Hi": $greeting = fgets($smtp, 1024); switch((int) $greeting){ case 220: # Everything is beautiful echo $greeting, "<BR>\n"; break; default: die("SMTP was expected to greet us, but said<BR>\n$greeting<BR>\n"); break; }
echo "Saying HELO<BR>\n"; flush(); # Now, we say "Hi" back: $bytes = fputs($smtp, "HELO listbaby.com\r\n"); if (!$bytes){ die("SMTP wouldn't even take our 'HELO'<BR>\n"); } # ... and let SMTP say, yeah, yeah, let's go: $gotit = fgets($smtp, 1024); switch((int) $gotit){ case 250: # Everything is beautiful echo $gotit, "<BR>\n"; break; default: die("SMTP didn't like us when we said HELO<BR>\n$gotit<BR>\n"); break; }
# Now, we're ready to start spewing out the emails!
# I'm not real clear if I need both the transaction and SELECT ... FOR UPDATE ... # But I reckon having both won't hurt, eh?
# Serializable is "more" transactional than the default: /* But I don't have that in my version... Hopefully you do... $query = "set transaction isolation level serializable"; echo $query, "<BR>\n"; flush(); $serialize = pg_exec($connection, $query); */
# Hmmmm. What I *really* want here is to mark the emails I'm sending # as "pending" right away for all transactions to see, # so if *another* copy of this script runs in parallel, no duplicates are sent... # I'm going to ignore this for now, really, and just not run two in parallel, # because I haven't quite figured out which isolation level does that... $query = "begin transaction"; echo $query, "<BR>\n"; flush(); $transaction = pg_exec($connection, $query);
# "for update" locks these rows, so if another "sendmail.htm" runs in the middle of this, we # won't step on our own feet... # Or, at least, that's how I sort of understand it...
# liame is "email" backwards -- As I understand it, SMTP can go faster if it your emails # are pre-sorted by destination. IE, all the AOLusers are together, all the Hotmails etc. # So, as a poor man's sort, I keep everybody's email reversed in liame. $query = "select queue_id, email, reply, headers, body from queue where not sent = 't' order by liame "; # Looks like I don't have "for update" in my PostgreSQL either... //$query .= " for update "; echo $query, "<BR>\n"; flush(); $emails = pg_exec($connection, $query);
echo "Starting loop<BR>\n";
flush();
$emailcount = 0;
while (list($queue_id, $email, $reply, $headers, $body) =
pg_fetch_row($emails, $emailcount++)){
$error = 0;
echo "Sending queue_id $queue_id<BR>\n"; flush(); # Tell SMTP who it's from: $command = "MAIL FROM: $reply\r\n"; echo $command, "<BR>\n"; flush(); $mailfrom = fputs($smtp, $command); if (!$mailfrom){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like this at all $command<BR>\n"; flush(); $error++; } $mailfrom = fgets($smtp, 1024); switch((int) $mailfrom){ case 250: # Every thing is beautiful echo $mailfrom, "<BR>\n"; flush(); break; default: echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like $command<BR>\n"; echo $mailfrom, "<BR>\n"; flush(); $error++; break; }
# Tell SMTP who it's to: $command = "RCPT TO: $email\r\n"; echo $command, "<BR>\n"; flush(); $rcptto = fputs($smtp, $command); if (!$rcptto){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like this at all $command<BR>\n"; flush(); $error++; } $rcptto = fgets($smtp, 1024); switch((int) $rcptto){ case 250: # Everything is beautiful echo $rcptto, "<BR>\n"; flush(); break; default: echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like $command<BR>\n"; echo $rcptto, "<BR>\n"; flush(); $error++; break; } # Tell SMTP we're about to spew the actual email: $command = "DATA\r\n"; # No, it's not Star Trek: The Next Generation echo $command, "<BR>\n"; flush(); $data = fputs($smtp, $command); if (!$data){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like this at all $command<BR>\n"; flush(); $error++; } $data = fgets($smtp, 1024); switch ((int) $data){ case 354: # Everything is beautiful echo $data, "<BR>\n"; flush(); break; default: echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like $command<BR>\n"; echo $data, "<BR>\n"; flush(); $error++; break; } # The definition of the end of an email for SMTP is a "." all by itself on a line # What if one of our emails actually *HAS* that as part of its content? # I later found out that there's a flag to sendmail to alter the end of message signal # I'm betting there's a SMTP command for that too. # You'll have to find that on your own. $body = str_replace("\n.\n", "\n. \n", $body); $body = ereg_replace("^.\\n", ". \\n", $body);
# There's no way our headers should be so messed up, but... # Am I paranoid enough? $headers = str_replace("\n.\n", "\n. \n", $headers); $headers = ereg_replace("^.\\n", ". \\n", $headers); $headout = fputs($smtp, $headers); echo nl2br($headers); flush(); if (!$headout){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like these headers:<BR>\n"; echo nl2br($headers); flush(); } $newline = fputs($smtp, "\r\n"); echo "<BR>\n"; $bodyout = fputs($smtp, $body); echo nl2br($body); flush(); if (!$bodyout){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like this body:<BR>\n"; echo nl2br($body); flush(); } # End this email: $dotout = fputs($smtp, ".\r\n"); if (!$dotout){ echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't get the email ending...<BR>\n"; flush(); }
$sent = fgets($smtp, 1024); if (!$sent){ echo "queue_id $queue_id<BR>\n"; echo "SMTP really didn't like that email.<BR>\n"; flush(); } switch((int) $sent){ case 250: # Everything is beautiful # But let's snag that sendmail unique identifier # So we can literally backtrack to our data $twofifty = strtok($sent, ' '); $sendmail_id = strtok(' '); if (!$error){ $query = "update queue set sent = 't', sendmail_id = '$sendmail_id' where queue_id = $queue_id"; echo $query, "<BR>\n"; flush(); $update = pg_exec($connection, $query); } break; default: echo "queue_id $queue_id<BR>\n"; echo "SMTP didn't like that email.<BR>\n"; flush(); break; } echo "Next<BR>\n"; flush(); }
# Tell SMPT we're quitting: $command = "QUIT\r\n"; $quit = fputs($smtp, $command); if (!$quit){ echo "SMTP didn't like $command<BR>\n"; flush(); } $quit = fgets($smtp, 1024); switch ((int) $quit){ case 221: # Everything is beautiful echo $quit, "<BR>\n"; break; default: echo "SMTP didn't like $command<BR>\n"; echo $quit, "<BR>\n"; flush(); break; }
$query = "commit transaction"; echo $query, "<BR>\n"; pg_exec($connection, $query);
# Close it down: fclose($smtp); ?>
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Do you have quotes around that?
sendmail_path = "/usr/bin/sendmail -t -i"
Also, what's the -i for?... Use "man sendmail" to find out, and see if it makes sense to have it there.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: "Martin Cabrera Diaubalick" <martin
notodo.com> Newsgroups: php.general Sent: Monday, June 25, 2001 3:05 AM Subject: [PHP] mail() always returns false. Why?
> Hello everyone! > > Good to see the list back! > > I had this weird problem switching from PHP3.0.16 to PHP 4.0.4pl1. After > changing Apache httpd.conf file, everything went ok except that mail() > function always returns false even though mails are sent. > > phpinfo() says my sendmail configuration is this one: > /usr/sbin/sendmail -t -i > > Does anyone know why is this happening? > > Thanks in advance. > Regards > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
> ""atan"" <22877
163.net> wrote in message
> news:9h0s59$l4h$1
w153.z064000151.sjc-ca.dsl.cnc.net...
> > file("http://www.163.com") error?
> > this is a test:
> > ////////////////////////
> > <?php
> > $fcontents = file ('http://www.php.net');
> > while (list ($line_num, $line) = each ($fcontents)) {
> > echo "<b>Line $line_num:</b> " . htmlspecialchars ($line) . "<br>\n";
> > }
> > ?>
> > /////////////////////////////////////////
> > This program run no error in my server ;
> > but it not work when i sent it to the Server (mtkj.51.net)
> > The message:
> >
> > Warning: file("http://www.163.com") - Permission denied in
> > /z1/mtkj/public_html/test.php on line 2
> > Warning: Variable passed to each() is not an array or object in
> > /z1/mtkj/public_html/test.php on line 3
> >
> > why?
I'm betting on your ISP having a version of PHP so old that the URL-wrapper isn't in the file() function, so it can only open local files, not URLs.
You *may* be able to fopen("http://www.php.net", "r") and read it that way -- The file() function lagged behind fopen() in terms of when URL support got added, I believe.
Use <?php phpinfo();?> to check the PHP version on your ISP box, and nag your ISP to upgrade to something from this doggie-decade.
attached mail follows:
Here's the deal:
mysqld, the database server, has to be running and sitting there waiting for mysql, the client, to be able to talk to it.
Before you can use any of the other mysql things, you *MUST* run mysqld (or safe_mysqld).
So, start up an extra DOS Windows, and run mysqld.
It will start up, and then just sit there. It's not hung. It's supposed to do that. It's now a database server waiting for somebody in another DOS window to do something interesting to talk to it, like mysql.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: "Cesar Cuneo" <ccuneo
corpsoftinc.com> Newsgroups: php.general Sent: Monday, June 25, 2001 3:59 PM Subject: [PHP] Installation problems with MySQL
> Hello, > > Can anyone please help me with MySQL installation? > > I am installing MYSQL on Windows 2000 version 3.23.38-win.zip > > But when I try to run it in the command line I receive the following > statements: > > > > > C:\mysql>cd bin > > C:\mysql\bin>mysql -p > Enter password: > ERROR 2003: Can't connect to MySQL server on 'localhost' (10061) > > C:\mysql\bin>scripts/mysql_install_db > 'scripts' is not recognized as an internal or external command, > operable program or batch file. > > C:\mysql\scripts>cd.. > > C:\mysql>cd bin > > C:\mysql\bin>mysqladmin -password newpassword > mysqladmin: connect to server at 'localhost' failed > error: 'Can't connect to MySQL server on 'localhost' (10061)' > Check that mysqld is running on localhost and that the port is 3306. > You can check this by doing 'telnet localhost 3306' > > C:\mysql\bin> > > Please help me . > > Cesar > > -----Original Message----- > From: infoz [mailto:infoz
earthlink.net] > Sent: Monday, June 25, 2001 8:38 AM > To: php-general
lists.php.net; Peter Van Dijck > Subject: Re: [PHP] damn $REQUEST_URI > > > $HTTP_HOST > > Run a page with <? phpinfo() ?> on your server & you'll see all sorts of > goodies in there. > > - Tim > http://www.phptemplates.org > > ----- Original Message ----- > From: "Peter Van Dijck" <peter
vardus.com> > To: <php-general
lists.php.net> > Sent: Monday, June 25, 2001 7:10 AM > Subject: [PHP] damn $REQUEST_URI > > > > $REQUEST_URI gets me home/dir/index.php > > but I need to get the domain name. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
I hadn't heard of that one. I use Nusphere which is Apache, Perl, PHP, Mysql, Sendmail all rolled into one easy Windows install. http://www.nusphere.com
> -----Original Message-----
> From: Aral Balkan [SMTP:aral
aralbalkan.com]
> Sent: Monday, June 25, 2001 11:05 PM
> To: ccuneo
corpsoftinc.com; infoz; php-general
lists.php.net; Peter Van
> Dijck
> Subject: Re: [PHP] Installation problems with MySQL
>
> Have you tried FoxServ? I think it's a godsent if you're running on
> Windows -- installs Apache, PHP and MySQL without a hitch (at least it did
> for me!)
>
> --> http://sourceforge.net/projects/foxserv/
>
> Hope this helps.
>
> Aral :)
> ______________________________
> (aral
kismia.com)
> New Media Producer, Kismia, Inc.
> (aral
american.edu)
> Adj. Prof., American University
> ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
>
>
attached mail follows:
> I have a big array (nearly 1000 lines) that I would like to pass to a C > program. I don't want to create a temporary file to pass my array (If > possible ?!?), and I don't think the command line will fit my needs. > > Is there a way to execute a program with a php string as the standard > input. Something like shell redirection 'c_program < input.file' but with > input.file being a php variable and not a real file ?? Any other solution > ??
2 choices:
#1 (for the real hacker geek) Compile your C program *into* PHP as a function, using the PEAR stuff. You may need to use PHP's http://php.net/serialize function to turn your array into a giant string and write a C routine to unserialize it, or, by the time you get done converting your program to PEAR, it will just accept your PHP array as an argument.
#2 (pretty slick, though...) Run your C program using http://php.net/psockopen and use http://php.net/fputs to spew your data at it one line at a time.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> Has anyone come up with a way to trap and log fatal PHP errors? I understand > how to implement and use a custom error handler for all other error > conditions, but there doesn't appear to be any way to log fatal errors (such > as a parse error or errors resulting from declaring the same function name > multiple times). > > I was only able to unearth one thread on this list pertaining to this topic > and the question never seemed to get answered. If you're interested an > archive of that thread is located at: > http://marc.theaimsgroup.com/?l=php-general&m=98803976202673&w=2
Well...
Neither of these solutions is practical, much less elegant, but...
I *THINK* that if you wrapped everything in an http://php.net/eval you'd be
able to stick an
in front of it and suppress parse errors... But don't
quote me on that...
Another option would be to write a PHP page that fetched (using fopen or file) the PHP page you really wanted, and then parsed the results looking for a PHP parse error message, and then either sending the results on out or, err, doing whatever it is you want done.
Your final option, of course, is to "Use the source, Luke" and either (A) alter it to actually allow a higher level of error_reporting that suppresses even parse errors, or (B) whip up a try/catch mechanism to donate back to PHP-Dev in your copious spare time. Yeah, right :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Try Manuel Lemos mail class.
I think it does that... I'm pretty sure it can *send* the attachments, so should at least give you an idea how to go about reading them.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Nicklas af Ekenstam <n
nille.org> Newsgroups: php.general Sent: Monday, June 25, 2001 11:09 PM Subject: [PHP] Fetching binaires from an e-mail
> Hi > > I'm currently trying to rewrite one of my old perl applications to php > and everything works great except one thing: > I can't figure out how to write a piece of code that will fetch and > unencode all binaires, if any, from an e-mail message in an imap stream > and return them so that I can save them to disk And rest assured it's > not for lack of trying ;-) > > If anybody here has seen or written something like that and wouldn't > mind sharing that code with me I'd be forever grateful. > > Thanks! > > - Nicklas > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
> // Define Oracle_Home and Oracle_Sid > putenv("ORACLE_HOME=/opt/ORACLE/product"); > putenv("ORACLE_SID=MYDATA");
IIRC, Thies posted once that the Environment variables *must* be defined in the environment, before PHP starts, for things to really work properly.
That's all he said (IIRC), so I don't know why it would matter, but if Thies *did* say that, you can bet that it's right :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
$b = 'abc $a def'; $a = 'whatever';
Actually, what I think you'll end up with needing is more like:
eval("$c = \"$b\"");
You can't just eval($b) because that would be like typing: <?php abc $a def ?>
You need something roughly equivalent to:
<?php $c = "abc $a def"; ?>
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation > must use an updateable query., SQL state S1000 in SQLExecDirect
Disclaimer: I only vaguely recall this stuff from suppressed memories of fighting with Microsoft software...
That might be a Microsoft-ism for "You don't have permission to do that". Check your GRANT permissions, or whatever they heck they are in Access...
Or, it might mean that you have your DSN in your ODBC control panel set to use the wrong kind of connection... There's some weird parameter to an ODBC connection that limits what sorts of things you can do...
Or, maybe even in your odbc_connect there's that extra parameter for what kind of cursor (?) to use...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> is there a function to get the mime of a given file? if so what?
Probably not...
For starters, PHP doesn't really know much about mime-types, because they are defined by Apache*, not PHP.
Secondly, mime-types *can* change on the fly in different directories based on .htaccess files, if your httpd.conf has .htaccess turned on. ISPs turn it on for their customers to have whatever weird-o file types they want. Dedicated boxes turn it off and set them all in httpd.conf for a big performance gain. Checking for, and reading, an .htaccess file in every directory above the current one for every single file served is pretty expensive. So any such function would either return suspect results (ie, subject to change by .htaccess) or would require the URI of the file, not just the name, and be rather slow.
Post why you think you need this function, and maybe somebody will have a suggestion for how to work without it.
* If you are working under Windows, I have no idea how they decide what the mime-type of a file is, and I don't really want to know...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Hi Jon! On Sat, 26 May 2001, Jon Yaggie wrote:
> is there a function to get the mime of a given file? if so what? > unless you upload it, nope you may try : using `magic' -- really, that one installed by Apache for mod_mime_magic.c parsing 'file' output
-- teodor
attached mail follows:
MSIE pretty much throws away any header information about a file that the server sends and tries to make a determination itself about the file based on the file extension....
> -----Original Message-----
> From: Richard Lynch [mailto:ceo
l-i-e.com]
> Subject: Re: [PHP] MIME type
>
> * If you are working under Windows, I have no idea how they decide what the
> mime-type of a file is, and I don't really want to know...
attached mail follows:
> A.) Do it for me :-)
Okay, but you have to go listen to http://ellenrosner.com/
Not as whiny as Alanis, but you might like it :-)
> <?php
# Create an array to hold all the shows: $shows = array();
> if ($max_days == ""){ > $max_days = 365; > } > $current_day = date( "z"); > echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" > bgcolor=\"#000000\">\n"; > echo "<tr bgcolor=\"#E5E5E5\"><td colspan=\"6\" align=\"right\"><b>alanis > guide</b></td></tr>\n"; > echo "<tr bgcolor=\"#E5E5E5\">\n"; > echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" > bgcolor=\"#E5E5E5\">date</FONT></td>\n"; > echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" > bgcolor=\"#E5E5E5\">time</FONT></td>\n"; > echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" > bgcolor=\"#E5E5E5\">where</FONT></td>\n"; > echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" > bgcolor=\"#E5E5E5\">what</FONT></td>\n"; > echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" > bgcolor=\"#E5E5E5\">days till</FONT></td>\n"; > echo "</tr>\n"; > > //Create Function > function create($listing, $max_days){ > list ($month, $day, $year, $time,$channel,$show) = split('/', $listing); > $year = "20$year"; > if ($channel == "VH1"){ > $url = "http://www.vh1.com"; > } > if ($channel == "MTV"){ > $url = "http://www.mtv.com"; > } > if ($channel == "COM"){ > $url = "http://www.comedycentral.com"; > } > if ($channel == "HBO"){ > $url = "http://www.hbo.com"; > } > if ($channel == "HBOZ"){ > $url = "http://www.hbo.com"; > } > if ($channel == "HBOS"){ > $url = "http://www.hbo.com"; > } > if ($channel == "TRIO"){ > $url = "http://www.triotv.com"; > } > $current_day = date( "z"); > $show_day = date( "z", mktime( 0, 0, 0, $month, $day, $year ) ); > $time_till_event = $show_day - $current_day; > > if ($time_till_event < $max_days){ > > if ($time_till_event == '0'){ > $time_till_event = "Today"; > } > if ($time_till_event == '1'){ > $time_till_event = "Tomorrow"; > } > if ($time_till_event < 0){ > return; > } > if ($url != ''){ > $start = "<a href=\"$url\">"; > $end = "</a>"; > } > if ($confirmed == 'yes'){ > $image = "images/yes.gif"; > } > if ($confirmed == 'no'){ > $image = "images/no.gif"; > } >
/* Comment out all this, so create() doesn't do any actual output. See below:
> echo "<tr bgcolor=\"#E5E5E5\">\n"; > echo "<td><font face=\"Arial\" > size=\"1\">$start$month.$day.$year$end</FONT></td>\n"; > echo "<td><font face=\"Arial\" size=\"1\">$start$time$end</FONT></td>\n"; > echo "<td><font face=\"Arial\" size=\"1\">$start$channel$end</FONT></td>\n"; > echo "<td><font face=\"Arial\" size=\"1\">$start$show$end</FONT></td>\n"; > echo "<td align=\"center\"><font face=\"Arial\" > size=\"1\">$start$time_till_event$end</FONT></td>\n"; > echo "</tr>\n"; */
# Use the $shows variable that lives outside this function: global $shows;
# Throw the date and the table row in it: # Muck with your time/date to get Unix time-stamp: if ($time){ $time_parts = explode(' ', $time); $hourmin = $time_parts[0]; $ampm = $time_parts[1]; $time_parts2 = explode(':', $hourmin); $hour = $time_parts2[0]; $min = $time_parts2[1]; $unixdate = mktime($hour, $min, 0, $month, $day, $year); } else{ $unixdate = mktime(0, 0, 0, $month, $day, $year); }
# Add this event to the array with the Unix time stamp as the key:
$shows[$unixdate] = "<tr bgcolor=e5e5e5><td><font face=Arial size=1>$start$month.$day.$year</td><td><font face=Arial size=1>$start$time$end</td><td><font face=Arial>$start$channel$end</td><td><font face=Arial size=1>$start$show$end</td><td align=center><font face=Arial size=1>$start$time_till_event$end</td></tr>";
> } > else{ > return; > } > } > //Dates > > $listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music"; > create($listing, $max_days); > $listing = "06/24/01/05:00 pm/VH1/Before They Were Rock Stars"; > create($listing, $max_days); > $listing = "06/24/01/11:00 pm/HBOZ/Reverb"; > create($listing, $max_days); > $listing = "06/28/01/01:00 am/HBOZ/Reverb"; > create($listing, $max_days); > $listing = "06/28/01/11:00 am/VH1/VH1: All Access"; > create($listing, $max_days); > $listing = "06/28/01/10:00 pm/VH1/VH1: All Access"; > create($listing, $max_days); > $listing = "06/28/01/11:30 pm/VH1/VH1: All Access"; > create($listing, $max_days); > $listing = "06/29/01/09:30 pm/HBOS/Sex And The City"; > create($listing, $max_days); > $listing = "06/30/01/07:00 pm/VH1/VH1: All Access"; > create($listing, $max_days); > $listing = "07/01/01/01:00 am/TRIO/Paris Concert for Amnesty International"; > create($listing, $max_days); > $listing = "07/09/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; > create($listing, $max_days); > $listing = "07/09/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; > create($listing, $max_days); > $listing = "07/13/01/12:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop > Songs "; > create($listing, $max_days); > $listing = "07/13/01/08:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop > Songs "; > create($listing, $max_days); > $listing = "07/27/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; > create($listing, $max_days); > $listing = "07/27/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; > create($listing, $max_days); > $listing = "07/01/01//Ottawa, ON/Canada Day"; > create($listing, $max_days); > $listing = "07/03/01//Kristiansand, NOR/Quart Festival "; > create($listing, $max_days); > $listing = "07/05/01//Stockholm, SWE/Annex "; > create($listing, $max_days); > $listing = "07/06/01//Sundsvall, SWE/City Festival "; > create($listing, $max_days); > $listing = "07/07/01//Odense, DEN/Midtfyns Festival "; > create($listing, $max_days); > $listing = "07/09/01//Hamburg, GER/Stadtpark "; > create($listing, $max_days); > $listing = "07/11/01//Montreux, SWI/Montreux Jazz Festival "; > create($listing, $max_days); > $listing = "07/12/01//Brescia, ITA/Piazza Duomo "; > create($listing, $max_days); > $listing = "07/13/01//Palermo, ITA/To Be Announced "; > create($listing, $max_days); > $listing = "07/28/01//Nigata, JPN/Fuji Rock Festival "; > create($listing, $max_days); > $listing = "07/31/01//Anchorage, AK/Egan Civic & Conv. Ctr. "; > create($listing, $max_days);
# So now we have this array we can sort:
ksort($shows);
# And now we can spew them out in order: reset($shows); while (list($unixdate, $table_row) = each($shows)){ echo $table_row; }
> echo "<tr align=\"center\" bgcolor=\"#E5E5E5\"><td colspan=\"6\"><font > size=\"-2\">All shows are Eastern Standard Time unless otherwise > noted</font></td></tr>\n"; > echo "</table>\n"; > ?>
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
if you dont know PHP that well, you should implement it in a language that you know, then work from that and translate it into PHP.
i used to do that with perl/PHP when i was first learning PHP... sometimes, things are more obvious when expressed in a language that you're more familiar with.
> -----Original Message-----
> From: Rick Proctor [mailto:am69
mediaone.net]
> Sent: Tuesday, June 26, 2001 2:04 PM
> To: php-general
lists.php.net
> Subject: [PHP] RE: Events Listings
>
>
> Hi Everyone,
>
> I want to thank the response I've gotten for this posts but unfortunately
> non of them have helped significantly. I don't know PHP that well so ideas
> you give me I can't implement.
>
> If someone could either
> A.) Do it for me :-)
> B.) Show some examples that directly relate to me
>
> It would be more than greatly appreciated.
>
> I can usely figure things out, but I guess I'm just slow to this.
>
> Rick
>
> -----Original Message-----
> From: Rick Proctor [mailto:am69
mediaone.net]
> Sent: Saturday, June 23, 2001 9:15 PM
> To: php-general
lists.php.net
> Subject: Events Listings
>
>
> Hello,
>
> I have a script that does TV/Tour listings for artist, I need it to sort the
> list automatically so that it goes in date order but I have absolutely no
> idea. I have put together the script with little to no PHP skills so it look
> pretty horrific.
>
> If you could help me out with figuring out how to fix it, it would be muchly
> appreciated.
>
> The code is below
>
> Rick
>
> <?php
> if ($max_days == ""){
> $max_days = 365;
> }
> $current_day = date( "z");
> echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"
> bgcolor=\"#000000\">\n";
> echo "<tr bgcolor=\"#E5E5E5\"><td colspan=\"6\" align=\"right\"><b>alanis
> guide</b></td></tr>\n";
> echo "<tr bgcolor=\"#E5E5E5\">\n";
> echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
> bgcolor=\"#E5E5E5\">date</FONT></td>\n";
> echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
> bgcolor=\"#E5E5E5\">time</FONT></td>\n";
> echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
> bgcolor=\"#E5E5E5\">where</FONT></td>\n";
> echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
> bgcolor=\"#E5E5E5\">what</FONT></td>\n";
> echo "<td align=\"center\"><font face=\"Arial\" size=\"1\"
> bgcolor=\"#E5E5E5\">days till</FONT></td>\n";
> echo "</tr>\n";
>
> //Create Function
> function create($listing, $max_days){
> list ($month, $day, $year, $time,$channel,$show) = split('/', $listing);
> $year = "20$year";
> if ($channel == "VH1"){
> $url = "http://www.vh1.com";
> }
> if ($channel == "MTV"){
> $url = "http://www.mtv.com";
> }
> if ($channel == "COM"){
> $url = "http://www.comedycentral.com";
> }
> if ($channel == "HBO"){
> $url = "http://www.hbo.com";
> }
> if ($channel == "HBOZ"){
> $url = "http://www.hbo.com";
> }
> if ($channel == "HBOS"){
> $url = "http://www.hbo.com";
> }
> if ($channel == "TRIO"){
> $url = "http://www.triotv.com";
> }
> $current_day = date( "z");
> $show_day = date( "z", mktime( 0, 0, 0, $month, $day, $year ) );
> $time_till_event = $show_day - $current_day;
>
> if ($time_till_event < $max_days){
>
> if ($time_till_event == '0'){
> $time_till_event = "Today";
> }
> if ($time_till_event == '1'){
> $time_till_event = "Tomorrow";
> }
> if ($time_till_event < 0){
> return;
> }
> if ($url != ''){
> $start = "<a href=\"$url\">";
> $end = "</a>";
> }
> if ($confirmed == 'yes'){
> $image = "images/yes.gif";
> }
> if ($confirmed == 'no'){
> $image = "images/no.gif";
> }
>
> echo "<tr bgcolor=\"#E5E5E5\">\n";
> echo "<td><font face=\"Arial\"
> size=\"1\">$start$month.$day.$year$end</FONT></td>\n";
> echo "<td><font face=\"Arial\" size=\"1\">$start$time$end</FONT></td>\n";
> echo "<td><font face=\"Arial\" size=\"1\">$start$channel$end</FONT></td>\n";
> echo "<td><font face=\"Arial\" size=\"1\">$start$show$end</FONT></td>\n";
> echo "<td align=\"center\"><font face=\"Arial\"
> size=\"1\">$start$time_till_event$end</FONT></td>\n";
> echo "</tr>\n";
> }
> else{
> return;
> }
> }
> //Dates
>
> $listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music";
> create($listing, $max_days);
> $listing = "06/24/01/05:00 pm/VH1/Before They Were Rock Stars";
> create($listing, $max_days);
> $listing = "06/24/01/11:00 pm/HBOZ/Reverb";
> create($listing, $max_days);
> $listing = "06/28/01/01:00 am/HBOZ/Reverb";
> create($listing, $max_days);
> $listing = "06/28/01/11:00 am/VH1/VH1: All Access";
> create($listing, $max_days);
> $listing = "06/28/01/10:00 pm/VH1/VH1: All Access";
> create($listing, $max_days);
> $listing = "06/28/01/11:30 pm/VH1/VH1: All Access";
> create($listing, $max_days);
> $listing = "06/29/01/09:30 pm/HBOS/Sex And The City";
> create($listing, $max_days);
> $listing = "06/30/01/07:00 pm/VH1/VH1: All Access";
> create($listing, $max_days);
> $listing = "07/01/01/01:00 am/TRIO/Paris Concert for Amnesty International";
> create($listing, $max_days);
> $listing = "07/09/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks";
> create($listing, $max_days);
> $listing = "07/09/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks";
> create($listing, $max_days);
> $listing = "07/13/01/12:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop
> Songs ";
> create($listing, $max_days);
> $listing = "07/13/01/08:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop
> Songs ";
> create($listing, $max_days);
> $listing = "07/27/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks";
> create($listing, $max_days);
> $listing = "07/27/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks";
> create($listing, $max_days);
> $listing = "07/01/01//Ottawa, ON/Canada Day";
> create($listing, $max_days);
> $listing = "07/03/01//Kristiansand, NOR/Quart Festival ";
> create($listing, $max_days);
> $listing = "07/05/01//Stockholm, SWE/Annex ";
> create($listing, $max_days);
> $listing = "07/06/01//Sundsvall, SWE/City Festival ";
> create($listing, $max_days);
> $listing = "07/07/01//Odense, DEN/Midtfyns Festival ";
> create($listing, $max_days);
> $listing = "07/09/01//Hamburg, GER/Stadtpark ";
> create($listing, $max_days);
> $listing = "07/11/01//Montreux, SWI/Montreux Jazz Festival ";
> create($listing, $max_days);
> $listing = "07/12/01//Brescia, ITA/Piazza Duomo ";
> create($listing, $max_days);
> $listing = "07/13/01//Palermo, ITA/To Be Announced ";
> create($listing, $max_days);
> $listing = "07/28/01//Nigata, JPN/Fuji Rock Festival ";
> create($listing, $max_days);
> $listing = "07/31/01//Anchorage, AK/Egan Civic & Conv. Ctr. ";
> create($listing, $max_days);
>
>
> echo "<tr align=\"center\" bgcolor=\"#E5E5E5\"><td colspan=\"6\"><font
> size=\"-2\">All shows are Eastern Standard Time unless otherwise
> noted</font></td></tr>\n";
> echo "</table>\n";
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hi Everyone,
Thanks to the suggestions from everyone I got it working..
Thanks
And Check it out
http://www.alanis-morissette.com/am69/
(It's the TV Guide :-)
Rick
-----Original Message-----
From: Rick Proctor [mailto:am69
mediaone.net]
Sent: Tuesday, June 26, 2001 2:04 PM
To: php-general
lists.php.net
Subject: [PHP] RE: Events Listings
Hi Everyone,
I want to thank the response I've gotten for this posts but unfortunately non of them have helped significantly. I don't know PHP that well so ideas you give me I can't implement.
If someone could either A.) Do it for me :-) B.) Show some examples that directly relate to me
It would be more than greatly appreciated.
I can usely figure things out, but I guess I'm just slow to this.
Rick
-----Original Message-----
From: Rick Proctor [mailto:am69
mediaone.net]
Sent: Saturday, June 23, 2001 9:15 PM
To: php-general
lists.php.net
Subject: Events Listings
Hello,
I have a script that does TV/Tour listings for artist, I need it to sort the list automatically so that it goes in date order but I have absolutely no idea. I have put together the script with little to no PHP skills so it look pretty horrific.
If you could help me out with figuring out how to fix it, it would be muchly appreciated.
The code is below
Rick
<?php if ($max_days == ""){ $max_days = 365; } $current_day = date( "z"); echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\" bgcolor=\"#000000\">\n"; echo "<tr bgcolor=\"#E5E5E5\"><td colspan=\"6\" align=\"right\"><b>alanis guide</b></td></tr>\n"; echo "<tr bgcolor=\"#E5E5E5\">\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">date</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">time</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">where</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">what</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\" bgcolor=\"#E5E5E5\">days till</FONT></td>\n"; echo "</tr>\n";
//Create Function function create($listing, $max_days){ list ($month, $day, $year, $time,$channel,$show) = split('/', $listing); $year = "20$year"; if ($channel == "VH1"){ $url = "http://www.vh1.com"; } if ($channel == "MTV"){ $url = "http://www.mtv.com"; } if ($channel == "COM"){ $url = "http://www.comedycentral.com"; } if ($channel == "HBO"){ $url = "http://www.hbo.com"; } if ($channel == "HBOZ"){ $url = "http://www.hbo.com"; } if ($channel == "HBOS"){ $url = "http://www.hbo.com"; } if ($channel == "TRIO"){ $url = "http://www.triotv.com"; } $current_day = date( "z"); $show_day = date( "z", mktime( 0, 0, 0, $month, $day, $year ) ); $time_till_event = $show_day - $current_day;
if ($time_till_event < $max_days){
if ($time_till_event == '0'){ $time_till_event = "Today"; } if ($time_till_event == '1'){ $time_till_event = "Tomorrow"; } if ($time_till_event < 0){ return; } if ($url != ''){ $start = "<a href=\"$url\">"; $end = "</a>"; } if ($confirmed == 'yes'){ $image = "images/yes.gif"; } if ($confirmed == 'no'){ $image = "images/no.gif"; }
echo "<tr bgcolor=\"#E5E5E5\">\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$month.$day.$year$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$time$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$channel$end</FONT></td>\n"; echo "<td><font face=\"Arial\" size=\"1\">$start$show$end</FONT></td>\n"; echo "<td align=\"center\"><font face=\"Arial\" size=\"1\">$start$time_till_event$end</FONT></td>\n"; echo "</tr>\n"; } else{ return; } } //Dates
$listing = "06/24/01/04:00 pm/VH1/Saturday Night Live 25: The Music"; create($listing, $max_days); $listing = "06/24/01/05:00 pm/VH1/Before They Were Rock Stars"; create($listing, $max_days); $listing = "06/24/01/11:00 pm/HBOZ/Reverb"; create($listing, $max_days); $listing = "06/28/01/01:00 am/HBOZ/Reverb"; create($listing, $max_days); $listing = "06/28/01/11:00 am/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/28/01/10:00 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/28/01/11:30 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "06/29/01/09:30 pm/HBOS/Sex And The City"; create($listing, $max_days); $listing = "06/30/01/07:00 pm/VH1/VH1: All Access"; create($listing, $max_days); $listing = "07/01/01/01:00 am/TRIO/Paris Concert for Amnesty International"; create($listing, $max_days); $listing = "07/09/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/09/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/13/01/12:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop Songs "; create($listing, $max_days); $listing = "07/13/01/08:00 pm/MTV/MTV and Rolling Stone's 100 Greatest Pop Songs "; create($listing, $max_days); $listing = "07/27/01/09:00 am/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/27/01/03:00 pm/TRIO/Alanis Morissette & Stevie Nicks"; create($listing, $max_days); $listing = "07/01/01//Ottawa, ON/Canada Day"; create($listing, $max_days); $listing = "07/03/01//Kristiansand, NOR/Quart Festival "; create($listing, $max_days); $listing = "07/05/01//Stockholm, SWE/Annex "; create($listing, $max_days); $listing = "07/06/01//Sundsvall, SWE/City Festival "; create($listing, $max_days); $listing = "07/07/01//Odense, DEN/Midtfyns Festival "; create($listing, $max_days); $listing = "07/09/01//Hamburg, GER/Stadtpark "; create($listing, $max_days); $listing = "07/11/01//Montreux, SWI/Montreux Jazz Festival "; create($listing, $max_days); $listing = "07/12/01//Brescia, ITA/Piazza Duomo "; create($listing, $max_days); $listing = "07/13/01//Palermo, ITA/To Be Announced "; create($listing, $max_days); $listing = "07/28/01//Nigata, JPN/Fuji Rock Festival "; create($listing, $max_days); $listing = "07/31/01//Anchorage, AK/Egan Civic & Conv. Ctr. "; create($listing, $max_days);
echo "<tr align=\"center\" bgcolor=\"#E5E5E5\"><td colspan=\"6\"><font size=\"-2\">All shows are Eastern Standard Time unless otherwise noted</font></td></tr>\n"; echo "</table>\n"; ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
How about solving both problems at once? :-)
Yes, go with the N:N (the technical term for that car_option table) relation, *AND* give yourself a weighted search engine to boot!
create table car (car_id auto_increment...); create table option (option_id auto_increment...); create table car_option(car_id int4, option_id int4, key(option_id));
insert into car(name) values('Chevy Nova'); insert into car(name) values('Lexus'); insert into option(name) values('a/c'); insert into option(name) values('power window'); insert into option(name) values('power locks'); insert into car_option(car_id, option_id) values(1, 1); insert into car_option(car_id, option_id) values(2, 1); insert into car_option(car_id, option_id) values(2, 2); insert into car_option(car_id, option_id) values(2, 3);
NOTE: The Lexus has all those options (at that price it had better!) and the Nova, well... It has a/c! :-)
Now, assume the user wants everything, so you have: $options[1] $options[2] $options[3] all "set" to some value by your checkbox.
#Untested code. $query = "select count(car_id), car.name from car, car_option "; $query .= " where car.car_id = car_option.car_id " $query .= " and (1 = 0"; # 1 = 0 is a "starter yeast" for the following: while (list($option_id) = each($options)){ $query .= " or option_id = $option_id "; } # finish off our options OR list... $query .= ")"; $query .= " group by car_id ";
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> Been trying to compile PHP.4.0.6 with --with-zlib directive and failing. > Using --with-zlib-dir, however succeeds. > > Does anyone knows the difference between the two ?
--with-zlib-dir works and --with-zlib doesn't? :-) :-) :-)
If you got it to work, leave it alone :-)
> Also, in a related problem, if I try with --enable-xslt I get the > following results: > > checking for XML support... yes > checking external libexpat install dir... no > checking whether to enable xslt support... yes > checking whether to enable the XSLT Sablotron backend... no > checking libexpat dir for Sablotron XSL support... no > configure: error: not found. Please re-install the distribution
I'm guessing that PHP is not finding one or more of libexpat and/or Sablotron, whatever those are, so while you asked for XSLT, whatever that is, you can't have it bacause PHP can't find the stuff it needs to provide it.
See if there's some --with-libexpat-dir or --with-sablotron-dir (or similar) directives you can use to tell configure where to find the stuff it needs.
Oh yeah: Add this to the http://bugs.php.net database, since the error message is just a little bit bogus, eh?
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> It's pretty easy to use PHP to update MySql server through the web sever. Is there an easy way to use PHP scripts to update the MySql sever in a standalone mode (without the web sever)? Any sample scripts?
You use the same scripts, but a "different" PHP.
If you are on Windows, you can do:
c:/path/to/php.exe -q c:/path/to/your/script.php
and it will run it.
On Un*x, if you compiled PHP from source, go back to the source directory and copy "config.nice" to "config.cgi"
Then, edit "config.cgi" and take out the line that says: --with-apxs=/path/to/your/apxs
Or, if you compiled as a static Module, the line that says: --with-apache=/path/to/apache/source
Then, make "config.cgi" executable: chmod +x config.cgi and run it: ./config.cgi
It will (hopefully) produce a binary file called "php".
Last time I did this, I had to rip out some fancy stuff like GD or TTF support or something, because I couldn't get it to compile as CGI (stand-alone) with some things... YMMV.
Throw that file some place convenient, like, /usr/bin and make it world-executable: chmod +x /usr/bin/php
Then, you can call PHP scripts from the command line a variety of ways:
#1 /usr/bin/php -q /path/to/your/script.php
#2 Add a line to the tip-top of a PHP script: #!/usr/bin/php -q
Now, all that compiling and stuff *may* be just too geeky or tricky or something for some people. There is a hack (slow, inefficient, ugly) way:
You can use "wget" or "lynx --dump" from the command line to "surf" to a page, which wastes an HTTP connection for as long as that script takes to run. But it works. :-)
Once you've got that working, several cool things are possible:
cron jobs, to run PHP scripts at specific time intervals. See man cron, man crontab, and man 5 crontab
PHP shell scripts for people who consider Perl ASCII soup [like me :-)]
Web pages that do double-duty as shell scripts, if you don't mind either very bare-bones web-site, or some <TAGS> in your shell output :-)
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
Try running ldconfig from your command line.
I think you just run it and it does things, and it all then works...
It's been ages since I did it though...
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Martin Schmidt <martin.schmidt
jielo.de> Newsgroups: php.general Sent: Monday, June 25, 2001 4:14 PM Subject: [PHP] shared object not open
> Hi, > > I am just starting with PHP, I installed the new version on my Suse 7.1 > with apache 1.3.14, because I need a tool for accessing databases > (Informix/Oracle). > > Everything seemed fine, until I tried to start apache, it told me: > > Cannot load /usr/lib/apache/libphp4.so into server: shared object not > open > > All my investigations showed me a very "kind" member of bug.php.net, who > told someone else, that this isn't a bug and we should connect the > mailing-lists. He generously had a hint : /etc/ld.so.conf and ldconfig. > In the archive of the mailing lists I found the same informations ( a > little bit more informative), but my ld.so.conf is o.k. and at this > point any help stops. > I hope, that someone found out what's happening here and helps me. > > So I have: > Intel Celreon 366 on Asus Mainboard, 256 MB RAM, Adaptec 2940UW with all > together 20GB HD, 5 swap-Areas with 128MB each. > SuSE 7.1 Prof-Edition, from this distribution I installed apache and PHP > (everything working fine, but no idea how to activate > informix/oracle-support) > > Apache says, PHP4-module installed. > > Thanks a lot for any help > > > Martin Schmidt > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
> tried it on my own server and found that php assigns the values 'name_x' and
Those are really name.x and name.y in HTTP, but since "." is not allowed in a PHP variable name, you get "_" instead.
So UPS is using, almost for sure, name.x and name.y in their "variables".
(Well, they probably have something else as well, but if you give them name.x and name.y, they'll convert it like they always do.)
> button on my form, then all works fine, except for the fact that I can't > intercept the data comming back from UPS so that I can adjust the prices.
Search the archives for Rasmus' "posttohost" function from way, way, way back when.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
In article <046101c0fee3$a5d4ec80$6401a8c0
Lynchux100>,
ceo
l-i-e.com ("Richard Lynch") wrote:
> > tried it on my own server and found that php assigns the values 'name_x' > and > > Those are really name.x and name.y in HTTP, but since "." is not allowed in > a PHP variable name, you get "_" instead. > > So UPS is using, almost for sure, name.x and name.y in their "variables".
Or they're using an image input named "name"; for instance, as a graphic button. When the user clicks on it, HTTP automatically passes the click's x and y coordinates as {input's name).x and {input's name}.y.
Before spending too much time hassling over this, it might be worthwhile to check with UPS about whether they're even using these two values. If they're being passed from an image map or something, they may care ("click on the shipping center nearest you", etc.); OTOH, if it's just a standard submit button, they may be ignoring that variable anyway.
-- CC
attached mail follows:
> Will Session have problem when people browse from a http page to a https > page and go out again?
Almost for sure, yes.
You'll need to transfer by hand any info that must transfer.
>From a security view-point the less crap you transfer to the https site the better, to avoid anybody trying to shove bad data in that will break into it.
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
> I'm pretty new to PHP but all I've seen of it so far I pretty much love! > > I've built a web log but when the user enters their data and they use ' > or " (and you know they will) php always shows it from the included > web log as > > \' How can I filter out these backslashes so they don't appear on the > final public viewable page?
You need those \ in there to store it into a database.
If you don't use a database, you can turn MagicQuotes off in php.ini
If you *do* use a database, you can use http://php.net/stripslashes to strip out the slashes.
If, after turning off MagicQuotes, or calling stripslashes, you find you need them back in there after all for something, you use http://addslashes
-- WARNING richardzend.com address is an endangered species -- Use ceo
l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm
attached mail follows:
use the str_replace() function http://www.php.net/manual/en/function.str-replace.php
-----Original Message-----
From: Marcus James Christian [mailto:marcus
mjchristianunlimited.com]
Sent: 27 June 2001 05:19
To: php-general
lists.php.net
Subject: [PHP] Filtering out \ when a ' is user entered?
Hello,
I'm pretty new to PHP but all I've seen of it so far I pretty much love!
I've built a web log but when the user enters their data and they use ' or " (and you know they will) php always shows it from the included web log as
\' How can I filter out these backslashes so they don't appear on the final public viewable page?
Thanks, Marcus
-- Marcus James Christian - UNLIMITED - Multimedia Internet Design http://mjchristianunlimited.com-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hey Marcus,
Lots of different ways...first, the \ is being added because you have magic_quotes turned on...you can use set_magic_quotes_runtime to turn them off in a specific script, edit your php.ini file to turn them off completely, or just do a string replace - replace \' with ' and \" with " best of luck, jack dempsey
----- Original Message -----
From: Marcus James Christian <marcus
mjchristianunlimited.com>
Date: Wednesday, June 27, 2001 0:18 am
Subject: [PHP] Filtering out \ when a ' is user entered?
> Hello,
>
> I'm pretty new to PHP but all I've seen of it so far I pretty much
> love!
> I've built a web log but when the user enters their data and they
> use '
> or " (and you know they will) php always shows it from the included
> web log as
>
> \' How can I filter out these backslashes so they don't appear on the
> final public viewable page?
>
> Thanks,
> Marcus
>
> --
> Marcus James Christian - UNLIMITED -
> Multimedia Internet Design
> http://mjchristianunlimited.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-
> admin
lists.php.net
>
attached mail follows:
stripslashes($string)
----- Original Message -----
From: "Marcus James Christian" <marcus
mjchristianunlimited.com>
To: <php-general
lists.php.net>
Sent: Wednesday, June 27, 2001 2:18 PM
Subject: [PHP] Filtering out \ when a ' is user entered?
> Hello,
>
> I'm pretty new to PHP but all I've seen of it so far I pretty much love!
>
> I've built a web log but when the user enters their data and they use '
> or " (and you know they will) php always shows it from the included
> web log as
>
> \' How can I filter out these backslashes so they don't appear on the
> final public viewable page?
>
> Thanks,
> Marcus
>
> --
> Marcus James Christian - UNLIMITED -
> Multimedia Internet Design
> http://mjchristianunlimited.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
> Hello, > > I'm pretty new to PHP but all I've seen of it so far I pretty much > love! > > I've built a web log but when the user enters their data and they > use ' or " (and you know they will) php always shows it from the > included web log as > > \' How can I filter out these backslashes so they don't appear on > the final public viewable page?
stripslashes()
www.php.net/stripslashes
HTH
M
-----BEGIN PGP SIGNATURE----- Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOzncFqW0/zC+QxWwEQIGiQCg+WcEtXTo3uE5EBpLqVZW0lYw9qMAnA1o rJOoQt2zlKDzJaU85Clk4TOL =lBUy -----END PGP SIGNATURE-----
attached mail follows:
try stripslashes()!
http://www.php.net/manual/function.stripslashes.php
----- Original Message -----
From: Marcus James Christian <marcus
mjchristianunlimited.com>
To: <php-general
lists.php.net>
Sent: Tuesday, June 26, 2001 11:18 PM
Subject: [PHP] Filtering out \ when a ' is user entered?
> Hello,
>
> I'm pretty new to PHP but all I've seen of it so far I pretty much love!
>
> I've built a web log but when the user enters their data and they use '
> or " (and you know they will) php always shows it from the included
> web log as
>
> \' How can I filter out these backslashes so they don't appear on the
> final public viewable page?
>
> Thanks,
> Marcus
>
> --
> Marcus James Christian - UNLIMITED -
> Multimedia Internet Design
> http://mjchristianunlimited.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
----- Original Message -----
From: "Marcus James Christian" <marcus
mjchristianunlimited.com>
To: <php-general
lists.php.net>
Sent: Wednesday, June 27, 2001 6:18 AM
Subject: [PHP] Filtering out \ when a ' is user entered?
> Hello, > > I'm pretty new to PHP but all I've seen of it so far I pretty much love! > > I've built a web log but when the user enters their data and they use ' > or " (and you know they will) php always shows it from the included > web log as > > \' How can I filter out these backslashes so they don't appear on the > final public viewable page? > > Thanks, > Marcus > > -- > Marcus James Christian - UNLIMITED - > Multimedia Internet Design > http://mjchristianunlimited.com
You can use stripslashes($yourvar) for this.
You can this behavior off by setting magic_quote_gpc to off in php.ini. Please not that if you'll try to insert this values to a database without the slashes, your queries will break, and they'll become security breaches.
Think about this:
$query = "select * from users where username='$u_name'";
and the user enters into the $u_name field: ' and '1'='1
Ouch...
However, if those dashes were escaped with slashes, the query will execute and return no values.
Never trust input from users, always check it.
-- Meir Kriheli MKsoft computer systems'There's someone in my head but it's not me" - Pink Floyd
attached mail follows:
On Tue, Jun 26, 2001 at 09:18:49PM -0700, Marcus James Christian wrote: > \' How can I filter out these backslashes so they don't appear on the > final public viewable page?
Perhaps stripslashes() would be helpful? http://www.php.net/manual/en/function.stripslashes.php
-- Jason Stechschulte jpstechunoh.edu -- : How would you disambiguate these situations?
By shooting the person who did the latter. -- Larry Wall in <199710290235.SAA02444
wall.org>
attached mail follows:
On Wednesday 27 June 2001 06:18, Marcus James Christian wrote:
> I've built a web log but when the user enters their data and they use ' > or " (and you know they will) php always shows it from the included > web log as > > \' How can I filter out these backslashes so they don't appear on the > final public viewable page?
-- Christian Reiniger LGDC Webmaster (http://lgdc.sunsite.dk/)"Never doubt that a small group of thoughtful, committed people can change the world... Indeed, it's the only thing that ever has."
- Margaret Mead
attached mail follows:
I might be wrong, but if you did something like this..
<?php
$somevar = your database stored data; $somevar = stripslashes($somevar);
echo $somevar;
?>
would work quite well, I think.
James Cox
-----Original Message-----
From: Marcus James Christian [mailto:marcus
mjchristianunlimited.com]
Sent: 27 June 2001 05:19
To: php-general
lists.php.net
Subject: [PHP] Filtering out \ when a ' is user entered?
Hello,
I'm pretty new to PHP but all I've seen of it so far I pretty much love!
I've built a web log but when the user enters their data and they use ' or " (and you know they will) php always shows it from the included web log as
\' How can I filter out these backslashes so they don't appear on the final public viewable page?
Thanks, Marcus
-- Marcus James Christian - UNLIMITED - Multimedia Internet Design http://mjchristianunlimited.com-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin