|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Fri Jul 19 2002 - 17:58:22 CDT
php-general Digest 19 Jul 2002 22:58:22 -0000 Issue 1474
Topics (messages 108476 through 108595):
Re: Help with sockets
108476 by: Stephen Brewster
Speed Question
108477 by: JJ Harrison
108478 by: Jason Wong
108483 by: JJ Harrison
Re: Searching...
108479 by: David Robley
systematic "glitch" in pages due to cache?
108480 by: Simon De Deyne
Re: Arrays and Regs
108481 by: Martin Clifford
Translatting php to binary...
108482 by: Kondwani Spike Mkandawire
108484 by: Jay Blanchard
108486 by: Kondwani Spike Mkandawire
108492 by: Jay Blanchard
Please help with Array..
108485 by: Wee Keat
108489 by: joakim.andersson.cybercom.se
108490 by: Michal Dvoracek
108495 by: Wee Keat
Re: remove header tags - include file (the solution)
108487 by: Juan Pablo Aqueveque
108491 by: Juan Pablo Aqueveque
question about ODBC and PHP
108488 by: Nasse, Sylvain
108499 by: salamander
How to turn off back slashes in a String...
108493 by: Kondwani Spike Mkandawire
108494 by: Matt Schroebel
108497 by: Michael Hall
108523 by: Kondwani Spike Mkandawire
108527 by: Michael Hall
Happy trails :)
108496 by: Alberto Serra
PDF pain
108498 by: Michael Hall
108501 by: Jason Wong
108502 by: Cal Evans
108504 by: Rasmus Lerdorf
108521 by: Michael Hall
Pine config
108500 by: Michael Hall
Uploading files...
108503 by: Rw
108510 by: Jason Wong
108512 by: Lowell Allen
phpinfo
108505 by: Michael Hall
108509 by: Dan Harrington
108516 by: Michael Hall
108517 by: B i g D o g
108566 by: Danny Shepherd
Something is wrong with my sessions..
108506 by: Chad Day
108507 by: Rasmus Lerdorf
108508 by: Matt Schroebel
108511 by: Chad Day
108515 by: Chad Day
MD5 & CRYPT_STD_DES Question
108513 by: Javier Montserat
cURL - https??
108514 by: Daniel Guerrier
108518 by: David Buerer
108519 by: David Buerer
108520 by: Jaime Bozza
108528 by: Daniel Guerrier
108563 by: Scott Fletcher
Re: vertical word match
108522 by: 'Joe Rice'
looking for a tutorial
108524 by: Kirk Babb
108525 by: Lowell Allen
108537 by: Kirk Babb
108538 by: Hans Lellelid
108540 by: Ray Hunter
What am I doing wrong? [beginner]
108526 by: Martin Johansson
108529 by: David Buerer
108530 by: Martin Johansson
108531 by: Martin Johansson
108534 by: Michael Sweeney
If + Multiple forms help
108532 by: THX
Followup to session question / scope of session
108533 by: Chad Day
108545 by: Chad Day
108548 by: Jay Blanchard
108549 by: Kevin Stone
108550 by: Chad Day
108552 by: Erik Price
108556 by: Erik Price
108559 by: Chad Day
108560 by: Erik Price
108561 by: Chad Day
108562 by: Erik Price
108577 by: Scott Hurring
Re: How to Detect File in a Specifc Directory on Window Env?
108535 by: Michael Sweeney
Is this possible?
108536 by: Mike Tuller
108539 by: Michael Sweeney
108543 by: Mike Tuller
Re: Forms problem?
108541 by: skeller.healthtvchannel.org
Re: Truncate ::: DAM!!!!!
108542 by: Michael Sweeney
Re: Passing variables to page via POST - How?
108544 by: skeller.healthtvchannel.org
Re: vertical word match SOLUTION
108546 by: 'Joe Rice'
AD - downloadable introduction to PHP $25
108547 by: Simon Ritchie
Re: snmp / php / linux /error
108551 by: Scott Hurring
Which discussion forum to use?
108553 by: Dasmeet Singh
Hyperlink display problem
108554 by: markbm
HTML button display problem
108555 by: markbm
108557 by: Jay Blanchard
108558 by: Erik Price
108574 by: Scott Hurring
108583 by: Wouter van Vliet
string conversion according to the "RFC 2068" specification???
108564 by: Scott Fletcher
108567 by: Scott Fletcher
function to variable?
108565 by: Jas
108568 by: Hans Lellelid
108573 by: Scott Hurring
help!!!!
108569 by: rasokan
108570 by: Nick Oostveen
108575 by: Scott Hurring
108579 by: Hans Lellelid
Counters :: Double, Triple :: What The Hell
108571 by: vins
108576 by: Scott Hurring
108578 by: Wouter van Vliet
108582 by: vins
Newbie mysql question
108572 by: John Wulff
108580 by: Saci
108581 by: Hans Lellelid
108584 by: Michael Sweeney
108585 by: Dennis Moore
108586 by: Asmodean
imagecolortransparent()
108587 by: Nick
str_replace() broken in 4.2.1 (Apache 1.3.26/Linux 2.2)
108588 by: Yermo M. Lamers
a
108589 by: JP
include error
108590 by: JP
108593 by: B i g D o g
108595 by: David Freeman
Help with call to mail function from within object
108591 by: Paul Maine
108592 by: John Holmes
Re: Cookies - good or bad???
108594 by: Danny Shepherd
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:
1) you use whats called an "Itterative Server Model". That is to say you
create an list of all the sockets you are using and pass them to
"socket_select" (http://www.php.net/manual/en/function.socket-select.php)
and it will tell you which ones are ready to be read from, which can be
written to and which have exceptions.
2) I am not too sure what you mean here but using the select you can find
out which socket have info in their buffers and then read it so there will
be no blocking on I/O
-- ------------------------------------------------------ Stephen Brewster Email: stevecite.co.uk Tel: 0116 2335545 Mobile: 07776 475849 ICQ: 383095 ------------------------------------------------------
UNIX SEX unzip; strip; touch; finger; mount; fsck; more; yes; umount; sleep
"Jeremy" <jeremy
webconflux.com> wrote in message news:004401c22edc$a848a090$0202a8c0
L5... > How can I do the following with PHP? > > 1) Accept more than 1 connections without forking > 2) socket_read and fgets from 2 connections at the same time > > please help! > thanks in advance > > > >
attached mail follows:
if I do this:
if(validate($_POST['password'], $_POST['username']) != 0) echo validate($_POST['password'], $_POST['username']);
will it execute the function twice or use the same result twice?
would it be (slightly) faster to do this:
$uid = validate($_POST['password'], $_POST['username']) if($uid != 0) echo $uid);
-- JJ Harrison webmastertececo.com www.tececo.com
attached mail follows:
On Thursday 18 July 2002 19:32, JJ Harrison wrote: > if I do this: > > if(validate($_POST['password'], $_POST['username']) != 0) > echo validate($_POST['password'], $_POST['username']); > > will it execute the function twice or use the same result twice?
Function executes twice.
> would it be (slightly) faster to do this: > > $uid = validate($_POST['password'], $_POST['username']) > if($uid != 0) > echo $uid);
Probably.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* If fifty million people say a foolish thing, it's still a foolish thing. -- Bertrand Russell */
attached mail follows:
thx
"Jason Wong" <php-general
gremlins.com.hk> wrote in message
news:200207191937.35698.php-general
gremlins.com.hk...
> On Thursday 18 July 2002 19:32, JJ Harrison wrote:
> > if I do this:
> >
> > if(validate($_POST['password'], $_POST['username']) != 0)
> > echo validate($_POST['password'], $_POST['username']);
> >
> > will it execute the function twice or use the same result twice?
>
> Function executes twice.
>
> > would it be (slightly) faster to do this:
> >
> > $uid = validate($_POST['password'], $_POST['username'])
> > if($uid != 0)
> > echo $uid);
>
> Probably.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> If fifty million people say a foolish thing, it's still a foolish thing.
> -- Bertrand Russell
> */
>
attached mail follows:
In article <200207191553.46721.php-general
gremlins.com.hk>, php-
general
gremlins.com.hk says...
> On Friday 19 July 2002 14:08, David Robley wrote:
>
> > You might consider running the first query just to get a COUNT(), rather
> > than extracting all the resulting rows and using mysql_numrows to
> > determine how many were returned
>
> Am I missing something? If you do a COUNT() in the query then, in general,
> it'll only return 1 row. You then use this row to determine the result of the
> COUNT(). IE using mysql_numrows() on this result is inappropriate.
>
>
Nope. The OP sounded like he was pulling the entire query and doing a
mysql_num_rows on it, then running the query again. Of course, I may have
misunderstood what he was saying...
Cheers
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
hello everybody,
I have a real problem, and a vague description to it (can you guess?: newbie).
I've created a site which retrieves a word from a database and displays it. The user enters another word (a translation) which is checked against the solution and feedback is given. These words are passed around in sessionvariables. Systematically after a while, I get a very slow loading of the page (and therefor the word i got from the database). In the end, i get my data, but it's slow and always with the same interval. I have a feeling this might be related to some garbage retrieval, or cache problem with the browser, but I can't figure it out. Does anybody has some suggestions? I'd really appreciate it!
cheers, Simon
attached mail follows:
Firstly, many thanks to Richard and Dan...
>>A quick test script in PHP would have been faster than asking... :-)<<
It was just one of those questions that I had burning in my mind at the time, and since I don't have access to PHP at work (As if the Government would allow that!), I had to ask :o)
And to Dan: I would love to change the line margins of my email client, but unfortunately Novell Groupwise sucks, and the government will not, without exception, allow customization of any software, whatsoever. So I'm stuck with it.
Thanks again guys!
Martin
attached mail follows:
PHP is a scripting language I am pretty much aware of that... But is there a way to translate php into binary/machine code or would one have to write a translator program?
Kondwani...
attached mail follows:
[snip] PHP is a scripting language I am pretty much aware of that... But is there a way to translate php into binary/machine code or would one have to write a translator program? [/snip]
PHP has an underlying binary translator, but I don't think that the source code is available from Zend. Are you looking for a way to compile PHP scripts? If so, is the reason so that others will not have access to your code? If that is the Case you could always look at the Zend Encoder. If not....ignore me, it's Friday! :^]
Jay
"Today’s mighty oak is just yesterday’s nut"
************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************
attached mail follows:
> PHP has an underlying binary translator, but I don't think that the source > code is available from Zend. Are you looking for a way to compile PHP > scripts? If so, is the reason so that others will not have access to your > code? If that is the Case you could always look at the Zend Encoder. If > not....ignore me, it's Friday! :^] > That's exactly it Jay, I'd like to be able to compile my scripts when necessary... I suppose the Zend Encoder is online... By the way do you know what programming language the PHP interpreter was developed in? Thanks for the info. this far...
Kondwani
attached mail follows:
[snip] That's exactly it Jay, I'd like to be able to compile my scripts when necessary... I suppose the Zend Encoder is online... By the way do you know what programming language the PHP interpreter was developed in? Thanks for the info. this far... [/snip]
The Zend Encoder is available at http://www.zend.com/store/products/zend-encoder.php . The language for the PHP interpreter is C, AFAIK. You may want to check http://www.sourceforge.net to see if the source is available, but I don't think that it is. Seems it was some time ago though.
Jay
"Things haven’t been the same since that house fell on my sister"
************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************
attached mail follows:
Hi all how are yas?
I have one question for which I could not find the answer:
How do I remove an element of an array with a specific key or index?
To be clearer:
Lets say I have an array $shoppingCart[] (quite a lot of them) I want to delete $shoppingCart[345] (which is not the last or the first) How do I do it?
I have checked the PHP manual... it has array_pop, array_shift which are for the last element and the first element. But what about specific elements in between the first and the last?
Please help out... I'm really in a rush to finish my project... :(
Thanks soooo much in advance for your time.
Yours, Wee Keat Chin
---------------------------------------------------
"Man is only truly great when he acts from his passions."
attached mail follows:
> -----Original Message-----
> From: Wee Keat [mailto:weekeat
amorphosium.com]
> Sent: Friday, July 19, 2002 3:13 PM
> To: PHP General
> Subject: [PHP] Please help with Array..
>
>
> Hi all how are yas?
>
> I have one question for which I could not find the answer:
>
> How do I remove an element of an array with a specific key or index?
>
> To be clearer:
>
> Lets say I have an array $shoppingCart[] (quite a
> lot of them)
> I want to delete $shoppingCart[345] (which is not
> the last or the first)
> How do I do it?
>
>
> I have checked the PHP manual... it has array_pop,
> array_shift which are for the last element and the first
> element. But what about specific elements in between the
> first and the last?
>
> Please help out... I'm really in a rush to finish my project... :(
>
> Thanks soooo much in advance for your time.
>
>
> Yours,
> Wee Keat Chin
>
> ---------------------------------------------------
>
> "Man is only truly great when he acts from his passions."
>
unset($shoppingCart[345]);
Regards Joakim Andersson
attached mail follows:
Hello,
try unset($shoppingCart[345]); resp. unset($array[key]);
Regards,
Michal Dvoracek michal.dvoracek
capitol.cz
attached mail follows:
Wow!!
That was really speedy...
Thanks again!! Love this mailing list heaps!!!!
Yours, Wee Keat Chin
---------------------------------------------------
"Man is only truly great when he acts from his passions."
----- Original Message -----
From: "Michael Hall" <olc
openlearningcommunity.org>
To: "Wee Keat" <weekeat
amorphosium.com>
Cc: "PHP General" <php-general
lists.php.net>
Sent: Friday, July 19, 2002 11:43 PM
Subject: Re: [PHP] Please help with Array..
> > Try array_splice(); > > Something like this: > > $newarray = array_splice($shoppingcart,345,1); > > In other words, start at element 345 and remove one element. > > Michael > > > > On Fri, 19 Jul 2002, Wee Keat wrote: > > > Hi all how are yas? > > > > I have one question for which I could not find the answer: > > > > How do I remove an element of an array with a specific key or index? > > > > To be clearer: > > > > Lets say I have an array $shoppingCart[] (quite a lot of them) > > I want to delete $shoppingCart[345] (which is not the last or the first) > > How do I do it? > > > > > > I have checked the PHP manual... it has array_pop, array_shift which are for the last element and the first element. But what about specific elements in between the first and the last? > > > > Please help out... I'm really in a rush to finish my project... :( > > > > Thanks soooo much in advance for your time. > > > > > > Yours, > > Wee Keat Chin > > > > --------------------------------------------------- > > > > "Man is only truly great when he acts from his passions." > >
attached mail follows:
Hi everyone, This post is only for the archive. I want to share the final solution. Of course all the credit is from Asmodean (and thanks also to Mr. Lynch)
good day!
--jp
function includeHTML($f)
{
echo "<!-- begin .html -->\n";
$fp =
fopen($f,"r") or die ("Error - failed to open file : $f");
$content = fread($fp,filesize($f));
preg_match("/<body>(.*?)<\/body>/s",$content ,$matches);
print $matches[1];
echo "<!-- end .html -->\n";
}
At 13:00 17-07-2002, Juan Pablo Aqueveque wrote: >Hi guys, me again. >(thanks kevin, but i'm afraid you didn't understand me). > >After looking for untiringly in the archives I have I decide to ask again. > >This is my problem: >I want include the file html.html inside of my file index.php, but before >include it I want to remove <html>..</head> tags from my html.html file. >My pseudo code would be look like this: > > > index.php > ><?php > >include_once("common.php"); > >header("Welcome to my page"); > include_html_file("html.html"); >footer() >?> > > > > common.php >function include_html_file($f) > { > (your kind contribution:-) ) > } > >thanks!! > >--jp > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
________________________________________________________
Juan Pablo Aqueveque <juque
uct.cl>
Ingeniero de Sistemas
Departamento de Redes y Comunicaciones http://www.drc.uct.cl
Universidad Católica de Temuco.
Tel:(5645) 205 630 Fax:(5645) 205 628
attached mail follows:
Hi everyone, This post is only for the archive. I want to share the final solution. Of course all the credit is from Asmodean (and thanks also to Mr. Lynch)
good day!
--jp
function includeHTML($f)
{
echo "<!-- begin .html -->\n";
$fp =
fopen($f,"r") or die ("Error - failed to open file : $f");
$content = fread($fp,filesize($f));
preg_match("/<body>(.*?)<\/body>/s",$content ,$matches);
print $matches[1];
echo "<!-- end .html -->\n";
}
At 13:00 17-07-2002, Juan Pablo Aqueveque wrote: >Hi guys, me again. >(thanks kevin, but i'm afraid you didn't understand me). > >After looking for untiringly in the archives I have I decide to ask again. > >This is my problem: >I want include the file html.html inside of my file index.php, but before >include it I want to remove <html>..</head> tags from my html.html file. >My pseudo code would be look like this: > > > index.php > ><?php > >include_once("common.php"); > >header("Welcome to my page"); > include_html_file("html.html"); >footer() >?> > > > > common.php >function include_html_file($f) > { > (your kind contribution:-) ) > } > >thanks!! > >--jp > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I am new to PHP, and I have got to download huge quantity of data from an oracle server. The ODBC cnnection works fine, and I found a useful "odbc_fetch_array()" function on this site.
Until now I store the data row after row into a temporrary file, and with it i fill MySQL tables.
The construction of the file takes nearly 50 minutes each , I have 10-12 tables to search in, and joins to make to integrate data in a final table.... ( !!! )
Is there a quicker method to get data in an odbc result resource??
thx !
N.B.: op (de inhoud van) deze e-mail is een DISCLAIMER met belangrijke VOORBEHOUDEN van toepassing: zie http://www.ben.nl/disclaimer
This e-mail and its contents are subject to a DISCLAIMER with important RESERVATIONS: see http://www.ben.nl/disclaimer
attached mail follows:
Sylvain,
This isn't really an ODBC question, but more of an application architecture one, I believe :)
The reason you are spending so much "time" is that you have to bring your data across the wire to your temp table, and then back into MySQL, if I understand you correctly.
I suggest you read the MySQL docs on "Temp Tables" - this is a table that you create briefly in your script, and then use MySQL's limited subquery syntax to perform an insert per these docs: http://www.mysql.com/doc/I/N/INSERT_SELECT.html Be aware that temp tables created by PHP do not persist in MySQL beyond the execution of a single script - e.g. within a single database session.
An even quicker way is to use a database that supports VIEWS, and then simply create a View that represents your required data.
If you want a full-featured database to work with in PHP and ODBC, check out http://www.openlinksw.com/virtuoso It not only supports all of the SQL:92 and most SQL:1999 features, but can execute and serve PHP from inside of the database without using Apache.
Let me know if you have any questions about Virtuoso or ODBC in PHP.
Cheers, Andrew
On Friday, July 19, 2002, at 09:03 AM, Nasse, Sylvain wrote:
> I am new to PHP, and I have got to download huge quantity of data from > an > oracle server. > The ODBC cnnection works fine, and I found a useful > "odbc_fetch_array()" > function on this site. > > Until now I store the data row after row into a temporrary file, and > with it > i fill MySQL tables. > > The construction of the file takes nearly 50 minutes each , I have 10-12 > tables to search in, > and joins to make to integrate data in a final table.... ( !!! ) > > > Is there a quicker method to get data in an odbc result resource?? > > thx ! > > > N.B.: op (de inhoud van) deze e-mail is een DISCLAIMER met belangrijke > VOORBEHOUDEN van toepassing: zie http://www.ben.nl/disclaimer > > This e-mail and its contents are subject to a DISCLAIMER with important > RESERVATIONS: see http://www.ben.nl/disclaimer > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
How do I turn of Back Slashes on a String in the ini file...
I have my Script set as a mailing form however everytime an Apostrophe is filled in a back slash is sent to the next page hence
St. John's on the next page appears as St. John\'s... and if it is sent again it picks up another and eventually if the person had to fill the fields in a couple of time by the time it gets to the mailbox it the word looks very unappealing...
Please help...
Kondwani
attached mail follows:
> From: Kondwani Spike Mkandawire [mailto:kondwani
cs.mun.ca]
> Subject: [PHP] How to turn off back slashes in a String...
> How do I turn of Back Slashes on a String in the
> ini file...
Look for magic_quotes_gpc and turn it off
attached mail follows:
Try setting magic_quotes_gpc (and/or magic_quotes_runtime) = Off
Michael
On Fri, 19 Jul 2002, Kondwani Spike Mkandawire wrote:
> How do I turn of Back Slashes on a String in the > ini file... > > I have my Script set as a mailing form however > everytime an Apostrophe is filled in a back slash > is sent to the next page hence > > St. John's on the next page appears as > St. John\'s... and if it is sent again it picks up > another and eventually if the person had to fill > the fields in a couple of time by the time it gets to > the mailbox it the word looks very unappealing... > > Please help... > > Kondwani > > > >
attached mail follows:
Thanks for the tip... It worked!
"Michael Hall" <olc
ninti.com> wrote in message
news:Pine.LNX.4.33.0207192321560.28579-100000
localhost.localdomain...
>
> Try setting magic_quotes_gpc (and/or magic_quotes_runtime) = Off
>
> Michael
>
>
> On Fri, 19 Jul 2002, Kondwani Spike Mkandawire wrote:
>
> > How do I turn of Back Slashes on a String in the
> > ini file...
> >
> > I have my Script set as a mailing form however
> > everytime an Apostrophe is filled in a back slash
> > is sent to the next page hence
> >
> > St. John's on the next page appears as
> > St. John\'s... and if it is sent again it picks up
> > another and eventually if the person had to fill
> > the fields in a couple of time by the time it gets to
> > the mailbox it the word looks very unappealing...
> >
> > Please help...
> >
> > Kondwani
> >
> >
> >
> >
>
attached mail follows:
BTW, if magic_quotes_gpc is now turned off, you may need to use addslashes() in your code, especially before you put user input into a database or a sql statement, unless you're validating the data some other way.
Michael
On Fri, 19 Jul 2002, Kondwani Spike Mkandawire wrote:
> Thanks for the tip... It worked!
> "Michael Hall" <olc
ninti.com> wrote in message
> news:Pine.LNX.4.33.0207192321560.28579-100000
localhost.localdomain...
> >
> > Try setting magic_quotes_gpc (and/or magic_quotes_runtime) = Off
> >
> > Michael
> >
> >
> > On Fri, 19 Jul 2002, Kondwani Spike Mkandawire wrote:
> >
> > > How do I turn of Back Slashes on a String in the
> > > ini file...
> > >
> > > I have my Script set as a mailing form however
> > > everytime an Apostrophe is filled in a back slash
> > > is sent to the next page hence
> > >
> > > St. John's on the next page appears as
> > > St. John\'s... and if it is sent again it picks up
> > > another and eventually if the person had to fill
> > > the fields in a couple of time by the time it gets to
> > > the mailbox it the word looks very unappealing...
> > >
> > > Please help...
> > >
> > > Kondwani
> > >
> > >
> > >
> > >
> >
>
>
>
>
attached mail follows:
ðÒÉ×ÅÔ!
IN the next 5 weeks I will be trekking on the Alps and the Pyrenees, with NO computers, NO clocks, NO electric light and of course NO email.
So, instead of setting up an autoresponder that will drive you all nuts I will just temporary unsubscribe from the list :)
Have a great time you all, and thanks for the help given along the way :)
See ya in september
ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ×
-_=}{=_-
-_=}{=_-
-_=}{=_-
-_=}{=_-
-_=}{=_-
-_=}{=_-
-_=}{=_-
LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is.......
attached mail follows:
I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK. At least, configure/make/make install all went OK and it is trying to work.
I copied the sample 'Hello World in PDF' script out of Programming PHP (p 234) into a file named pdftest.pdf
When I try to access http://localhost/pdftest.pdf, Konqueror tries to open a PDF file but then spits the dummy saying:
"Could not open file blahblah.pdf which has type application/x-zerosize. KGhostview can only open Postscript and Portable Document Format files"
So it looks like a header problem or something?
This raises a few other questions:
- Should the PHP script be called pdftest.php or pdftest.pdf?
- Does httpd.conf need an AddType directive for pdf files? I've tried a few variations on "AddType application/x-pdf .pdf" etc
- Should .pdf be added to the php AddType directive? eg. "AddType application/x-httpd-php .php .htm .pdf
Basically, I'm confused. Anyone been there done that?
TIA
Michael
attached mail follows:
On Friday 19 July 2002 21:54, Michael Hall wrote: > I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK. > At least, configure/make/make install all went OK and it is trying to > work. > > I copied the sample 'Hello World in PDF' script out of Programming PHP (p > 234) into a file named pdftest.pdf
I think you want the name to be 'pdftest.php'. Try it and see what you get.
> When I try to access http://localhost/pdftest.pdf, Konqueror tries to open > a PDF file but then spits the dummy saying: > > "Could not open file > blahblah.pdf which has type application/x-zerosize. KGhostview can only > open Postscript and Portable Document Format files"
That's because your 'pdf' file is in actual fact a raw php file.
> So it looks like a header problem or something?
No.
> This raises a few other questions: > > - Should the PHP script be called pdftest.php or pdftest.pdf?
The former.
> - Does httpd.conf need an AddType directive for pdf files? I've tried a > few variations on "AddType application/x-pdf .pdf" etc
No.
> - Should .pdf be added to the php AddType directive? > eg. "AddType application/x-httpd-php .php .htm .pdf
No.
> Basically, I'm confused. Anyone been there done that?
Yes.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* I've got an IDEA!! Why don't I STARE at you so HARD, you forget your SOCIAL SECURITY NUMBER!! */
attached mail follows:
try the pdfclock example
http://www.php.net/manual/en/ref.pdf.php see if
that works.
=C=
* * Cal Evans * The Virtual CIO * http://www.calevans.com *
-----Original Message-----
From: Michael Hall [mailto:olc
ninti.com]
Sent: Friday, July 19, 2002 8:55 AM
To: php-general
lists.php.net
Subject: [PHP] PDF pain
I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK. At least, configure/make/make install all went OK and it is trying to work.
I copied the sample 'Hello World in PDF' script out of Programming PHP (p 234) into a file named pdftest.pdf
When I try to access http://localhost/pdftest.pdf, Konqueror tries to open a PDF file but then spits the dummy saying:
"Could not open file blahblah.pdf which has type application/x-zerosize. KGhostview can only open Postscript and Portable Document Format files"
So it looks like a header problem or something?
This raises a few other questions:
- Should the PHP script be called pdftest.php or pdftest.pdf?
- Does httpd.conf need an AddType directive for pdf files? I've tried a few variations on "AddType application/x-pdf .pdf" etc
- Should .pdf be added to the php AddType directive? eg. "AddType application/x-httpd-php .php .htm .pdf
Basically, I'm confused. Anyone been there done that?
TIA
Michael
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Have a look at the example here:
http://pres.lerdorf.com/show/oscon2002/48
On Fri, 19 Jul 2002, Michael Hall wrote:
> > > I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK. > At least, configure/make/make install all went OK and it is trying to > work. > > I copied the sample 'Hello World in PDF' script out of Programming PHP (p > 234) into a file named pdftest.pdf > > When I try to access http://localhost/pdftest.pdf, Konqueror tries to open > a PDF file but then spits the dummy saying: > > "Could not open file > blahblah.pdf which has type application/x-zerosize. KGhostview can only > open Postscript and Portable Document Format files" > > So it looks like a header problem or something? > > This raises a few other questions: > > - Should the PHP script be called pdftest.php or pdftest.pdf? > > - Does httpd.conf need an AddType directive for pdf files? I've tried a > few variations on "AddType application/x-pdf .pdf" etc > > - Should .pdf be added to the php AddType directive? > eg. "AddType application/x-httpd-php .php .htm .pdf > > Basically, I'm confused. Anyone been there done that? > > TIA > > Michael > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Thanks for all the suggestions. I am making progress after discovering a typo in my code (single quotes in a header() string containing a $var ... double quotes fixed it).
Now I get a pdf document but no text :-(
If I save the doc to disk and try to open it with xpdf, it complains that the "xref table" is broken and that it can't find a "trailer dictionary".
???
Michael
On Fri, 19 Jul 2002, Jason Wong wrote:
> On Friday 19 July 2002 21:54, Michael Hall wrote: > > I THINK I have installed pdflib and compiled it into PHP 4.2.1 OK. > > At least, configure/make/make install all went OK and it is trying to > > work. > > > > I copied the sample 'Hello World in PDF' script out of Programming PHP (p > > 234) into a file named pdftest.pdf > > I think you want the name to be 'pdftest.php'. Try it and see what you get. > > > When I try to access http://localhost/pdftest.pdf, Konqueror tries to open > > a PDF file but then spits the dummy saying: > > > > "Could not open file > > blahblah.pdf which has type application/x-zerosize. KGhostview can only > > open Postscript and Portable Document Format files" > > That's because your 'pdf' file is in actual fact a raw php file. > > > So it looks like a header problem or something? > > No. > > > This raises a few other questions: > > > > - Should the PHP script be called pdftest.php or pdftest.pdf? > > The former. > > > - Does httpd.conf need an AddType directive for pdf files? I've tried a > > few variations on "AddType application/x-pdf .pdf" etc > > No. > > > - Should .pdf be added to the php AddType directive? > > eg. "AddType application/x-httpd-php .php .htm .pdf > > No. > > > Basically, I'm confused. Anyone been there done that? > > Yes. > >
attached mail follows:
This is sort of off topic, but can anyone tell me why my Pine email client displays "To: Somebody Or Other" rather than my name "Michael Hall" whenever I send an email to this list?
I have attempted to fix this many times but cannot for the life of me figure out why it is happening.
Michael
attached mail follows:
I can't find a thread on this or decent documentation.
The hosting servers I am on are UNIX based.
I need to upload "test.txt" from my "C:\files" local drive to remote: /user/mydirectory/files
Can someone help me with the proper command to get my files from local drive to remote server
Thanks! :-)
attached mail follows:
On Friday 19 July 2002 22:09, Rw wrote: > I can't find a thread on this or decent documentation.
Probably because this has nothing to do with PHP?
> The hosting servers I am on are UNIX based. > > I need to upload "test.txt" from my "C:\files" local drive to > remote: /user/mydirectory/files > > Can someone help me with the proper command to get my files from local > drive to remote server
Use FTP, or ask your hosting company.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* If the code and the comments disagree, then both are probably wrong. -- Norm Schryer */
attached mail follows:
> From: "Rw" <php
wiegmann.net>
>
> I can't find a thread on this or decent documentation.
>
> The hosting servers I am on are UNIX based.
>
> I need to upload "test.txt" from my "C:\files" local drive to
> remote: /user/mydirectory/files
>
> Can someone help me with the proper command to get my files from local drive
> to remote server
>
Check the online manual:
<http://www.php.net/manual/en/features.file-upload.php>
-- Lowell Allen
attached mail follows:
I have recompiled PHP with pdflib. phpinfo() still displays my old ./configure settings, but further down has a PDF section telling me that PDF is enabled. Any ideas why this may be?
Michael
attached mail follows:
have you reloaded your apache web server software?
(....apacheroot/bin/apachectl restart)
dan
> -----Original Message-----
> From: Michael Hall [mailto:olc
ninti.com]
> Sent: Friday, July 19, 2002 8:15 AM
> To: php-general
lists.php.net
> Subject: [PHP] phpinfo
>
>
>
> I have recompiled PHP with pdflib.
> phpinfo() still displays my old ./configure settings, but further down has
> a PDF section telling me that PDF is enabled.
> Any ideas why this may be?
>
> Michael
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Yes, did that. Oh well, it's the least of my problems right now :-)
Michael
On Fri, 19 Jul 2002, Dan Harrington wrote:
> have you reloaded your apache web server software?
>
> (....apacheroot/bin/apachectl restart)
>
> dan
>
>
> > -----Original Message-----
> > From: Michael Hall [mailto:olc
ninti.com]
> > Sent: Friday, July 19, 2002 8:15 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] phpinfo
> >
> >
> >
> > I have recompiled PHP with pdflib.
> > phpinfo() still displays my old ./configure settings, but further down has
> > a PDF section telling me that PDF is enabled.
> > Any ideas why this may be?
> >
> > Michael
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
When you did a reconfig did you remove the config.cache file before configuring?
Sometime the best thing is to remove everything and start over...
.: B i g D o g :.
----- Original Message -----
From: "Michael Hall" <olc
ninti.com>
To: "Dan Harrington" <dan
tudan.net>
Cc: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 8:48 AM
Subject: RE: [PHP] phpinfo
>
> Yes, did that. Oh well, it's the least of my problems right now :-)
>
> Michael
>
>
> On Fri, 19 Jul 2002, Dan Harrington wrote:
>
> > have you reloaded your apache web server software?
> >
> > (....apacheroot/bin/apachectl restart)
> >
> > dan
> >
> >
> > > -----Original Message-----
> > > From: Michael Hall [mailto:olc
ninti.com]
> > > Sent: Friday, July 19, 2002 8:15 AM
> > > To: php-general
lists.php.net
> > > Subject: [PHP] phpinfo
> > >
> > >
> > >
> > > I have recompiled PHP with pdflib.
> > > phpinfo() still displays my old ./configure settings, but further down
has
> > > a PDF section telling me that PDF is enabled.
> > > Any ideas why this may be?
> > >
> > > Michael
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
You've got to do a 'make clean' before make.
HTH
Danny.
----- Original Message -----
From: "Michael Hall" <olc
ninti.com>
To: "Dan Harrington" <dan
tudan.net>
Cc: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 3:48 PM
Subject: RE: [PHP] phpinfo
>
> Yes, did that. Oh well, it's the least of my problems right now :-)
>
> Michael
>
>
> On Fri, 19 Jul 2002, Dan Harrington wrote:
>
> > have you reloaded your apache web server software?
> >
> > (....apacheroot/bin/apachectl restart)
> >
> > dan
> >
> >
> > > -----Original Message-----
> > > From: Michael Hall [mailto:olc
ninti.com]
> > > Sent: Friday, July 19, 2002 8:15 AM
> > > To: php-general
lists.php.net
> > > Subject: [PHP] phpinfo
> > >
> > >
> > >
> > > I have recompiled PHP with pdflib.
> > > phpinfo() still displays my old ./configure settings, but further down
has
> > > a PDF section telling me that PDF is enabled.
> > > Any ideas why this may be?
> > >
attached mail follows:
I must be missing something very basic here..
I login to my site successfully.. session values are created so I can track/authenticate the user throughout the site:
login.php:
session_start();
(logic)
$VALID_USER = '1'; session_register("OL_VALID_USER");
(redirect to other page)
Then on the other page, the access is checked:
otherpage.php:
session_start();
require("functions.php");
check_access();
functions.php:
function check_access() { global $VALID_USER; if (session_is_registered("VALID_USER")) { return true; } else { Header("Location: login.php"); exit(); } }
Now, like I said, I login succesfully, the other page says I'm logged in succesfully. But it seems to randomly lose track of my session as I navigate the site. Even if -right- after I login, I manually type the URL in the address bar to go to otherpage.php, where I was just authenticated, the check fails and I am told to login again. I don't understand.. if I refresh the page, the check works, but if I type the address in the location bar of my browser to go there, it fails it. What is going on?
Thanks, Chad
attached mail follows:
> login.php: > > session_start(); > > (logic) > > $VALID_USER = '1'; > session_register("OL_VALID_USER");
What's the point of doing a session_register on OL_VALID_USER when you do not set this variable in login.php? Is it coming in via some other mechanism?
-Rasmus
attached mail follows:
> From: Chad Day [mailto:cday
atpco.com]
> Sent: Friday, July 19, 2002 10:08 AM
> Subject: [PHP] Something is wrong with my sessions..
> I must be missing something very basic here..
>
> I login to my site successfully.. session values are created so I can
> track/authenticate the user throughout the site:
>
> login.php:
>
> session_start();
>
> (logic)
>
> $VALID_USER = '1';
> session_register("OL_VALID_USER");
>
> (redirect to other page)
>
>
> Then on the other page, the access is checked:
>
> otherpage.php:
>
> session_start();
>
> require("functions.php");
>
> check_access();
>
> functions.php:
>
> function check_access() {
> global $VALID_USER;
> if (session_is_registered("VALID_USER")) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Don't you mean:
session_is_registered("OL_VALID_USER");
> return true; > } else { > Header("Location: login.php"); > exit(); > } > }
attached mail follows:
Yes, I do, I mistyped when I was putting the message in.
if ($row = mysql_fetch_array($finduser)) { // process login $VALID_USER = '1'; session_register("VALID_USER"); ... ... } else { $FAILED = '1'; }
-----Original Message-----
From: Rasmus Lerdorf [mailto:rasmus
php.net]
Sent: Friday, July 19, 2002 10:09 AM
To: Chad Day
Cc: php-general
lists.php.net
Subject: Re: [PHP] Something is wrong with my sessions..
> login.php: > > session_start(); > > (logic) > > $VALID_USER = '1'; > session_register("OL_VALID_USER");
What's the point of doing a session_register on OL_VALID_USER when you do not set this variable in login.php? Is it coming in via some other mechanism?
-Rasmus
attached mail follows:
I think I narrowed down the problem, but I have another question:
In apache, my server name is online-leagues.com, www.online-leagues.com is aliased to it.
I isolated the code in a different script:
http://www.online-leagues.com/leagues/loginme.php
returns valid
if on the subsequent page I take out the www., it returns invalid.. how do I make my session valid entirely across the site? I can't pass anything to session_start(), and I can't see any other function where I would set this..
I'm not sure if this is even the problem anyway, as when I was testing before, www. was in front of all my URLs.. I would login to my site (http://www.online-leagues.com/my), get authenticated, refresh the page.. I'm all good. I type that same URL in the browser.. poof.
Since I'm not specifitying a filename (letting apache grab index.php since I'm just specifiying a directory), would that cause a problem with the www. stuff? Sorry if that is confusing/if I'm doing a poor job explaining..
Thanks, Chad
-----Original Message-----
From: Chad Day [mailto:cday
atpco.com]
Sent: Friday, July 19, 2002 10:25 AM
To: Rasmus Lerdorf
Cc: php-general
lists.php.net
Subject: RE: [PHP] Something is wrong with my sessions..
Yes, I do, I mistyped when I was putting the message in.
if ($row = mysql_fetch_array($finduser)) { // process login $VALID_USER = '1'; session_register("VALID_USER"); ... ... } else { $FAILED = '1'; }
-----Original Message-----
From: Rasmus Lerdorf [mailto:rasmus
php.net]
Sent: Friday, July 19, 2002 10:09 AM
To: Chad Day
Cc: php-general
lists.php.net
Subject: Re: [PHP] Something is wrong with my sessions..
> login.php: > > session_start(); > > (logic) > > $VALID_USER = '1'; > session_register("OL_VALID_USER");
What's the point of doing a session_register on OL_VALID_USER when you do not set this variable in login.php? Is it coming in via some other mechanism?
-Rasmus
attached mail follows:
I've got a fairly standard user dbase table which contains a password field. On the server all passwords have been encrypted with the CRYPT_STD_DES algorithm before being inserted into the dbase. However, Passwords are presently submitted from the login form in plain text.
I want to make the system more robust by encrypting passwords on the client side using the javascript MD5 class.
Is there any way I can make this compatible with the existing passwords which are encrypted with the DES 2 salt algorithm without writing some sort of change password stuff? Does anyone know of a Javascript implementation of the CRYPT_STD_DES algorithm.
Thanks,
webmonkey
_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com
attached mail follows:
Is cURL still needed to make secure connection and/or connect to a credit card authorizer.
i.e authorize.net
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
attached mail follows:
Yes..and no. It depends on how you connect to Authorize Net. The best way is to use the direct response method which requires a secure connection to their [authorize net's] servers. Curl is the only way that I know how to do this with PHP. It's a bit slow (at least on NT,) but it does get the job done. I've got scheduled to finish my functions which connect to AN's servers and process transactions next week, I'll make them available to you if you'd like.
David Buerer Senior Designer PLA Designs, Inc.
-----Original Message-----
From: Daniel Guerrier [mailto:dan_guerrier
yahoo.com]
Sent: Friday, July 19, 2002 7:43 AM
To: php user group
Subject: [PHP] cURL - https??
Is cURL still needed to make secure connection and/or connect to a credit card authorizer.
i.e authorize.net
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Let me finish my thought....
The other two methods of connecting to authorizenet allow you to let the client browser do the work by secure posting to their servers directly which means you don't have to initiate the connection from your server--no curl. It's much simpler to code and build a site around, but you don't have as much control over the process.
-----Original Message-----
From: David Buerer [mailto:david
pladesigns.com]
Sent: Friday, July 19, 2002 7:33 AM
To: 'php-general
lists.php.net'
Subject: RE: [PHP] cURL - https??
Yes..and no. It depends on how you connect to Authorize Net. The best way is to use the direct response method which requires a secure connection to their [authorize net's] servers. Curl is the only way that I know how to do this with PHP. It's a bit slow (at least on NT,) but it does get the job done. I've got scheduled to finish my functions which connect to AN's servers and process transactions next week, I'll make them available to you if you'd like.
David Buerer Senior Designer PLA Designs, Inc.
-----Original Message-----
From: Daniel Guerrier [mailto:dan_guerrier
yahoo.com]
Sent: Friday, July 19, 2002 7:43 AM
To: php user group
Subject: [PHP] cURL - https??
Is cURL still needed to make secure connection and/or connect to a credit card authorizer.
i.e authorize.net
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
These may (or may not) help both of you.
http://www.unknowndesigns.com/phpauthnet/home.php
Jaime Bozza
-----Original Message-----
From: David Buerer [mailto:david
pladesigns.com]
Sent: Friday, July 19, 2002 9:33 AM
To: 'php-general
lists.php.net'
Subject: RE: [PHP] cURL - https??
Yes..and no. It depends on how you connect to Authorize Net. The best way is to use the direct response method which requires a secure connection to their [authorize net's] servers. Curl is the only way that I know how to do this with PHP. It's a bit slow (at least on NT,) but it does get the job done. I've got scheduled to finish my functions which connect to AN's servers and process transactions next week, I'll make them available to you if you'd like.
David Buerer Senior Designer PLA Designs, Inc.
-----Original Message-----
From: Daniel Guerrier [mailto:dan_guerrier
yahoo.com]
Sent: Friday, July 19, 2002 7:43 AM
To: php user group
Subject: [PHP] cURL - https??
Is cURL still needed to make secure connection and/or connect to a credit card authorizer.
i.e authorize.net
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
That'll be great
Thanks alot
--- Jaime Bozza <jbozza
thinkburst.com> wrote:
> These may (or may not) help both of you.
>
> http://www.unknowndesigns.com/phpauthnet/home.php
>
>
> Jaime Bozza
>
>
> -----Original Message-----
> From: David Buerer [mailto:david
pladesigns.com]
> Sent: Friday, July 19, 2002 9:33 AM
> To: 'php-general
lists.php.net'
> Subject: RE: [PHP] cURL - https??
>
>
> Yes..and no. It depends on how you connect to
> Authorize Net. The best
> way
> is to use the direct response method which requires
> a secure connection
> to
> their [authorize net's] servers. Curl is the only
> way that I know how
> to do
> this with PHP. It's a bit slow (at least on NT,) but
> it does get the job
> done. I've got scheduled to finish my functions
> which connect to AN's
> servers and process transactions next week, I'll
> make them available to
> you
> if you'd like.
>
> David Buerer
> Senior Designer
> PLA Designs, Inc.
>
>
> -----Original Message-----
> From: Daniel Guerrier
> [mailto:dan_guerrier
yahoo.com]
> Sent: Friday, July 19, 2002 7:43 AM
> To: php user group
> Subject: [PHP] cURL - https??
>
> Is cURL still needed to make secure connection
> and/or
> connect to a credit card authorizer.
>
> i.e authorize.net
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
attached mail follows:
It depend on what kind of connection you're using. If your machine is a server and you need to connect to another machine that is a server also. If you're not using the fsockopen() since you're not using frame relay or whatever. If both are true then cURL is for you.
FletchSOD
"Daniel Guerrier" <dan_guerrier
yahoo.com> wrote in message
news:20020719144238.14028.qmail
web13003.mail.yahoo.com...
> Is cURL still needed to make secure connection and/or
> connect to a credit card authorizer.
>
> i.e authorize.net
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
attached mail follows:
i though i had tried this. but, i just did again and it still isn't matching. I've read that browsers send different things for the newline from <textarea> but, i've tried Netscape,IE on windows Netscape, Mozilla on Solaris
I really think what i have should work. $word gets set to
(.?|\s*|\n*|)r(.?|\s*|\n*|)(.?|\s*|\n*|)e(.?|\s*|\n*|)(.?|\s*|\n*|)d(.?|\s*|\n*|)(.?|\s*|\n*|) (.?|\s*|\n*|)(.?|\s*|\n*|)a(.?|\s*|\n*|)(.?|\s*|\n*|)p(.?|\s*|\n*|)(.?|\s*|\n*|)p(.?|\s*|\n*|)(.?|\s*|\n*|)l(.?|\s*|\n*|)(.?|\s*|\n*|)e(.?|\s*|\n*|)
(match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline) r (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline) e (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline) d (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline) (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline) a
and so on... the only thing i can think of is the "space" between the words that i'm not matching.
if anyone can help, i would appreciate it. thanks, joe
Martin Towell(martin.towell
world.net)
Fri, Jul 19, 2002 at 04:06:03PM +1000:
> try changing the "+"'s with "*"'s
> + = 1 or more
> * = 0 or more
>
> -----Original Message-----
> From: Joe Rice [mailto:riceja
water-melon.net]
> Sent: Friday, July 19, 2002 3:30 PM
> To: php-general
lists.php.net
> Subject: [PHP] vertical word match
>
>
>
> hello,
> any regex gurus?
> i'm trying to match words put into a <textarea>
> that are in the form of a\np\np\l\e
> or any combination of new lines in between, before
> or after.
>
> $answer = "hello\na\np\np\nl\ne\n"; /*from textarea in form*/
> $word = "apple";
> $word = preg_replace("/(.)/","(.?|\s+|\n+|)$1(.?|\s+|\n+|)",$word);
> preg_match("/".$word."/im",$answer,$match)
>
> works.
> but if
>
> $word = "red apple";
> $answer = "r\ne\nd\n\na\np\np\nl\e";
>
> it doesn't match.
>
>
> thanks in advance,
> joe
>
> --
> 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
>
-- How do i get rid of those words in my screen that are coming from you?
attached mail follows:
I'm trying to learn more about classes so I can start developing classes of my own. Could somebody post a good link on this that they enjoyed reading? I guess it doesn't have to be in PHP since the idea should be the same....but that would be nice.
TIA,
KB
attached mail follows:
> From: "Kirk Babb" <kbcd
worldnet.att.net>
> Date: Fri, 19 Jul 2002 10:19:35 -0500
> To: php-general
lists.php.net
> Subject: [PHP] looking for a tutorial
>
> I'm trying to learn more about classes so I can start developing classes of
> my own. Could somebody post a good link on this that they enjoyed reading?
> I guess it doesn't have to be in PHP since the idea should be the
> same....but that would be nice.
>
I liked this one:
<http://www.devshed.com/Server_Side/PHP/BackToClass/page1.html>
-- Lowell Allen
attached mail follows:
> I liked this one: > > <http://www.devshed.com/Server_Side/PHP/BackToClass/page1.html> > > -- > Lowell Allen >
The devshed article is a great intro so far (I'm halfway through it). Thanks for the tip!
KB
attached mail follows:
I would also recommend looking at the intro to classes tutorial on Zend (in general there are lots of good PHP tutorials there).
http://www.zend.com/zend/tut/class-intro.php
Cheers, Hans
On Fri, 2002-07-19 at 11:19, Kirk Babb wrote: > I'm trying to learn more about classes so I can start developing classes of > my own. Could somebody post a good link on this that they enjoyed reading? > I guess it doesn't have to be in PHP since the idea should be the > same....but that would be nice. > > TIA, > > KB > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
You can also try http://www.phpbeginner.com for some tutorials on classes as well.
.: B i g D o g :.
----- Original Message -----
From: "Kirk Babb" <kbcd
worldnet.att.net>
To: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 9:19 AM
Subject: [PHP] looking for a tutorial
> I'm trying to learn more about classes so I can start developing classes of > my own. Could somebody post a good link on this that they enjoyed reading? > I guess it doesn't have to be in PHP since the idea should be the > same....but that would be nice. > > TIA, > > KB > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
AHHHHHRGGG this is getting me on my nerves!!!##!!
I am using a mySQL-databasetable called controllpoints_tbl with the following structure:
+----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+ | nr | process_nr | type | abb | name | x | description | +----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+ | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla | | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla | | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla bla | | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla | +----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+
I want to view just the "name" and "x" variable with this code...
for ($i=1;$i<=$antal_typer;$i++) { $typvar = $type[$i]; // this is an array with types $here = 150+17*$i;
echo "Hello";
$result = mysql_query("select name,x FROM controllpoints_tbl where process_nr=$process_nr and type=$typvar order by x"); while ($myrow = mysql_fetch_row($result)) // this is line 138... { // here's a lot of code.. } }
but it never enters the while loop.. and only print Hello one time although $antal_typer = 2; a warning message says: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138
attached mail follows:
Just for grins try this...
$query="SELECT name,x FROM controllpoints_tbl WHERE (process_nr=$process_nr) AND (type=$typvar) ORDER BY x"; $result=mysql_query($query) or echo "Query failed!<br>$query";
Then run it and see what happens. My guess is that your query is failing and that is the real cause of your problem. If the query fails, $result is not valid and the while loop will surely fail.
David Buerer Senior Designer PLA Designs, Inc.
-----Original Message-----
From: Martin Johansson [mailto:d99majo
swipnet.se]
Sent: Friday, July 19, 2002 8:21 AM
To: php-general
lists.php.net
Subject: [PHP] What am I doing wrong? [beginner]
AHHHHHRGGG this is getting me on my nerves!!!##!!
I am using a mySQL-databasetable called controllpoints_tbl with the following structure:
+----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+ | nr | process_nr | type | abb | name | x | description | +----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+ | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla | | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla | | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla bla | | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla | +----+------------+-----------+-----+------+-----+-------------------------- ---------------------------+
I want to view just the "name" and "x" variable with this code...
for ($i=1;$i<=$antal_typer;$i++) { $typvar = $type[$i]; // this is an array with types $here = 150+17*$i;
echo "Hello";
$result = mysql_query("select name,x FROM controllpoints_tbl where process_nr=$process_nr and type=$typvar order by x"); while ($myrow = mysql_fetch_row($result)) // this is line 138... { // here's a lot of code.. } }
but it never enters the while loop.. and only print Hello one time although $antal_typer = 2; a warning message says: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
It didnt work either..!!! and by the way (or echo "Query failed!<br>$query";) doesnt work. A complain about unexpected T_ECHO shows! /mj
"David Buerer" <david
pladesigns.com> skrev i meddelandet
news:91FBD0B430EFD5118B930060672D982C040419
CAIRO...
> Just for grins try this...
>
> $query="SELECT name,x FROM controllpoints_tbl WHERE
(process_nr=$process_nr)
> AND (type=$typvar) ORDER BY x";
> $result=mysql_query($query) or echo "Query failed!<br>$query";
>
> Then run it and see what happens. My guess is that your query is failing
and
> that is the real cause of your problem. If the query fails, $result is not
> valid and the while loop will surely fail.
>
>
>
> David Buerer
> Senior Designer
> PLA Designs, Inc.
>
>
> -----Original Message-----
> From: Martin Johansson [mailto:d99majo
swipnet.se]
> Sent: Friday, July 19, 2002 8:21 AM
> To: php-general
lists.php.net
> Subject: [PHP] What am I doing wrong? [beginner]
>
> AHHHHHRGGG this is getting me on my nerves!!!##!!
>
> I am using a mySQL-databasetable called controllpoints_tbl with the
> following structure:
>
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | nr | process_nr | type | abb | name | x | description
> |
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla
> |
> | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla
> |
> | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla
> bla |
> | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla
> |
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
>
> I want to view just the "name" and "x" variable with this code...
>
> for ($i=1;$i<=$antal_typer;$i++)
> {
> $typvar = $type[$i]; // this is an array with types
> $here = 150+17*$i;
>
> echo "Hello";
>
> $result = mysql_query("select name,x FROM controllpoints_tbl where
> process_nr=$process_nr and type=$typvar order by x");
> while ($myrow = mysql_fetch_row($result)) // this is
line
> 138...
> {
> // here's a lot of code..
> }
> }
>
> but it never enters the while loop.. and only print Hello one time
although
> $antal_typer = 2;
> a warning message says:
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
> resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Well I got it to work now! it was the query..
this works!!! $query = 'SELECT name,x FROM controllpoints_tbl WHERE (process_nr='.$process_nr.') AND (type="'.$typvar.'") ORDER BY x';
this doesnt work!!! $query="SELECT name,x FROM controllpoints_tbl WHERE (process_nr=$process_nr) AND (type=$typvar) ORDER BY x";
/martin
"David Buerer" <david
pladesigns.com> skrev i meddelandet
news:91FBD0B430EFD5118B930060672D982C040419
CAIRO...
> Just for grins try this...
>
> $query="SELECT name,x FROM controllpoints_tbl WHERE
(process_nr=$process_nr)
> AND (type=$typvar) ORDER BY x";
> $result=mysql_query($query) or echo "Query failed!<br>$query";
>
> Then run it and see what happens. My guess is that your query is failing
and
> that is the real cause of your problem. If the query fails, $result is not
> valid and the while loop will surely fail.
>
>
>
> David Buerer
> Senior Designer
> PLA Designs, Inc.
>
>
> -----Original Message-----
> From: Martin Johansson [mailto:d99majo
swipnet.se]
> Sent: Friday, July 19, 2002 8:21 AM
> To: php-general
lists.php.net
> Subject: [PHP] What am I doing wrong? [beginner]
>
> AHHHHHRGGG this is getting me on my nerves!!!##!!
>
> I am using a mySQL-databasetable called controllpoints_tbl with the
> following structure:
>
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | nr | process_nr | type | abb | name | x | description
> |
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
> | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla
> |
> | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla
> |
> | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla
> bla |
> | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla
> |
>
+----+------------+-----------+-----+------+-----+--------------------------
> ---------------------------+
>
> I want to view just the "name" and "x" variable with this code...
>
> for ($i=1;$i<=$antal_typer;$i++)
> {
> $typvar = $type[$i]; // this is an array with types
> $here = 150+17*$i;
>
> echo "Hello";
>
> $result = mysql_query("select name,x FROM controllpoints_tbl where
> process_nr=$process_nr and type=$typvar order by x");
> while ($myrow = mysql_fetch_row($result)) // this is
line
> 138...
> {
> // here's a lot of code..
> }
> }
>
> but it never enters the while loop.. and only print Hello one time
although
> $antal_typer = 2;
> a warning message says:
> Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
> resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Martin, I'm assuming that you are calling a mysql_connect somewhere in your code ahead of what you've posted. The error message you're getting indicates that the query is not returning a result set. That could be because you need quotes around the values in your where statement:
mysql_query("SELECT name, x FROM controllpoints_tbl WHERE ". "process_nr='$process_nr' AND type='$typevar' ORDER BY x");
Assuming a valid connection handle, that should work.
..mike..
On Fri, 2002-07-19 at 08:20, Martin Johansson wrote: > AHHHHHRGGG this is getting me on my nerves!!!##!! > > I am using a mySQL-databasetable called controllpoints_tbl with the > following structure: > > +----+------------+-----------+-----+------+-----+-------------------------- > ---------------------------+ > | nr | process_nr | type | abb | name | x | description > | > +----+------------+-----------+-----+------+-----+-------------------------- > ---------------------------+ > | 1 | 1 | Milestone | MS | MS1 | 200 | bla bla bla > | > | 2 | 1 | Milestone | MS | MS2 | 500 | bla bla bla > | > | 3 | 1 | Tollgate | TG | TG1 | 100 | bla bla > bla | > | 4 | 1 | Milestone | MS | MS4 | 600 | bla bla bla > | > +----+------------+-----------+-----+------+-----+-------------------------- > ---------------------------+ > > I want to view just the "name" and "x" variable with this code... > > for ($i=1;$i<=$antal_typer;$i++) > { > $typvar = $type[$i]; // this is an array with types > $here = 150+17*$i; > > echo "Hello"; > > $result = mysql_query("select name,x FROM controllpoints_tbl where > process_nr=$process_nr and type=$typvar order by x"); > while ($myrow = mysql_fetch_row($result)) // this is line > 138... > { > // here's a lot of code.. > } > } > > but it never enters the while loop.. and only print Hello one time although > $antal_typer = 2; > a warning message says: > Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result > resource in c:\inetpub\wwwroot\devproc\beta\view.php on line 138 > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi,
Im currently having a problem when I have multiple forms on the same page (I assume that this is the problem).
im currently doing something like this: <? if(!$include) { if(!$submit) { ?>
//html
<? } if($submit) {
do some code
} } if(($include) && ($include == "send")) { if(!$submit_send) { ?>
//html goes here
<? } if($submit_send) { code goes here } }
Okay now this is what happens, the first form works fine even if there is an include. The second one ($submit_send) does not, it just reloads the page without actually doing any code.. it seems to stop right before the if($submit_send). I was wondering if it could be because I had multiple forms in the script (but im only accessing one at the time).
Im really stuck at the moment, to me, it should work, but its not. I don't get any errors, it just seems to skip right over the code section for $submit_send .
Thanks for any help.
attached mail follows:
If I start a session at www.mydomain.com and want to register a session variable to keep track of the user for authentication purposes, is there a way I can use that session variable on other sites, such as my.mydomain.com and mydomain.com or anythingelse.mydomain.com? It seems to only be valid for the www. domain name, and I need it to work on all of *.mydomain.com.
I could set a cookie with a value, but I don't want to risk spoofing of cookies, etc.. I'd much rather keep a registered session variable which I can check to see if it exists, and use that to authenticate.
Thanks, Chad
attached mail follows:
Anyone? I'm looking on google for help and found 2 people asking similar questions, but both got no replies. Is it not possible to pass session data across subdomains? If so, what workaround can I use to keep the user authenticated? Do I just pass the session ID in the URL? That kind of sucks. :(
Thanks, Chad
-----Original Message-----
From: Chad Day [mailto:cday
atpco.com]
Sent: Friday, July 19, 2002 11:46 AM
To: php-general
lists.php.net
Subject: [PHP] Followup to session question / scope of session
If I start a session at www.mydomain.com and want to register a session variable to keep track of the user for authentication purposes, is there a way I can use that session variable on other sites, such as my.mydomain.com and mydomain.com or anythingelse.mydomain.com? It seems to only be valid for the www. domain name, and I need it to work on all of *.mydomain.com.
I could set a cookie with a value, but I don't want to risk spoofing of cookies, etc.. I'd much rather keep a registered session variable which I can check to see if it exists, and use that to authenticate.
Thanks, Chad
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
[snip] Anyone? I'm looking on google for help and found 2 people asking similar questions, but both got no replies. Is it not possible to pass session data across subdomains? If so, what workaround can I use to keep the user authenticated? Do I just pass the session ID in the URL? That kind of sucks. :( ....
If I start a session at www.mydomain.com and want to register a session variable to keep track of the user for authentication purposes, is there a way I can use that session variable on other sites, such as my.mydomain.com and mydomain.com or anythingelse.mydomain.com? It seems to only be valid for the www. domain name, and I need it to work on all of *.mydomain.com.
I could set a cookie with a value, but I don't want to risk spoofing of cookies, etc.. I'd much rather keep a registered session variable which I can check to see if it exists, and use that to authenticate. [/snip]
Aren't sessions assigned according to namespace? And anythingelse.mydomain.com is not a subdomain of www.mydomain.com, they exist as parallel domains. anythingelse.www.mydomain.com is a sub domain of www.mydomain.com which is a subdomain of mydomain.com which is a subdomain of com. You could, instead of using a cookie, use hidden form fields to move the info from one domain to another that is parallel to it, but that would hose any security you had unless you used the encrypted hash versions of each in your hidden form fields to make them less readable.
I don't know if I am correct on this, but it seems to me that sessions are assigned to namespaces, and therfore would not work as you wished.
HTH!
Jay
"Sex on television can’t hurt you…unless you fall off"
************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************
attached mail follows:
It's not a matter of scope, per se, but I believe that as long as you remain on the same server the session file will always be available. -Kevin
----- Original Message -----
From: "Chad Day" <cday
atpco.com>
To: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 9:46 AM
Subject: [PHP] Followup to session question / scope of session
> If I start a session at www.mydomain.com and want to register a session > variable to keep track of the user for authentication purposes, is there a > way I can use that session variable on other sites, such as my.mydomain.com > and mydomain.com or anythingelse.mydomain.com? It seems to only be valid > for the www. domain name, and I need it to work on all of *.mydomain.com. > > I could set a cookie with a value, but I don't want to risk spoofing of > cookies, etc.. I'd much rather keep a registered session variable which I > can check to see if it exists, and use that to authenticate. > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
It's still there, yes, but when I go to my.mydomain.com from www.mydomain.com, the session_start() at the top of the script starts a new session rather than picking up on the old www.mydomain.com session. I don't know how to tell it to look at the old session and continue that one.
Chad
-----Original Message-----
From: Kevin Stone [mailto:kevin
helpelf.com]
Sent: Friday, July 19, 2002 2:02 PM
To: Chad Day; php-general
lists.php.net
Subject: Re: [PHP] Followup to session question / scope of session
It's not a matter of scope, per se, but I believe that as long as you remain on the same server the session file will always be available. -Kevin
----- Original Message -----
From: "Chad Day" <cday
atpco.com>
To: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 9:46 AM
Subject: [PHP] Followup to session question / scope of session
> If I start a session at www.mydomain.com and want to register a session > variable to keep track of the user for authentication purposes, is there a > way I can use that session variable on other sites, such as my.mydomain.com > and mydomain.com or anythingelse.mydomain.com? It seems to only be valid > for the www. domain name, and I need it to work on all of *.mydomain.com. > > I could set a cookie with a value, but I don't want to risk spoofing of > cookies, etc.. I'd much rather keep a registered session variable which I > can check to see if it exists, and use that to authenticate. > > Thanks, > Chad > > > -- > 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
attached mail follows:
On Friday, July 19, 2002, at 01:39 PM, Chad Day wrote:
> Anyone? I'm looking on google for help and found 2 people asking > similar > questions, but both got no replies. Is it not possible to pass session > data > across subdomains? If so, what workaround can I use to keep the user > authenticated? Do I just pass the session ID in the URL? That kind of > sucks. :(
[...]
> I could set a cookie with a value, but I don't want to risk spoofing of > cookies, etc.. I'd much rather keep a registered session variable > which I > can check to see if it exists, and use that to authenticate.
No, the whole problem is that you're depending on cookies to persist the session ID for you. Which is normally fine, except that cookies have their own rules about which domains they will send data to. Specifically, a cookie set in
virtualhost1.mydomain.com
will not be available to
virtualhost2.mydomain.com
unless you have ensured that the "domain" attribute of the cookie is set to the common
.mydomain.com
so that any virtualhost/subdomain has access to the cookie. This level of cookie handling is normally abstracted away from the programmer, but it is changeable. You can change cookie values with JavaScript, and with PHP's setcookie() function. Read the man page for more info.
(I do not know if the domain set by session_start() is the broader ".mydomain.com" or the narrower "virtualhostx.mydomain.com", but you could investigate this.)
Erik
attached mail follows:
On Friday, July 19, 2002, at 02:05 PM, Chad Day wrote:
> It's still there, yes, but when I go to my.mydomain.com from > www.mydomain.com, the session_start() at the top of the script starts > a new > session rather than picking up on the old www.mydomain.com session. I > don't > know how to tell it to look at the old session and continue that one.
Try naming your session and using session_name() to force the session_start() call to look first for an original session. Read up on session_start() for more info.
Erik
attached mail follows:
Ok.. let me try to explain a bit further.
My domain is online-leagues.com www.online-leagues.com is aliased to it.
If I refer to a script without the filename (http://www.online-leagues.com/my), Apache apparently interprets that as (http://online-leagues.com/my/look-for-the-index-file). If I use http://www.online-leagues.com/my/index.php, my session obviously will work as intended.
Now, I could just rewrite all the URLs, but in the near future I want to be able to have http://my.online-leagues.com and http://calendar.online-leagues.com working and use data in those sessions.
I'm not sure what cookies have to do with this, aside from passing along the session id. I wrote up some test login scripts:
http://www.online-leagues.com/leagues/testdir/loginme.php :
<? session_start();
$I_AM_A_NEW_VALID_USER = '1'; session_register("I_AM_A_NEW_VALID_USER");
echo "<a href=\"http://online-leagues.com/leagues/testdir/index.php?"; echo $PHPSESSID; echo "\">link</a>"; ?>
Have to do one reload first to get the $PHPSESSID variable to append (I don't know why), but on the next page, the check fails:
<? session_start();
function check_me() { global $I_AM_A_NEW_VALID_USER; if (session_is_registered("I_AM_A_NEW_VALID_USER")) { echo "valid"; } else { echo "invalid"; exit(); } }
echo $SID; echo '<br>'; echo $I_AM_A_NEW_VALID_USER;
check_me();
?>
I apologize if I am missing something basic here / am not understanding.. I just don't know what I have to do to get my session to work across that entire domain.. I thought worst case, passing along the SID would work, but that doesn't seem to be working either.
Thanks, Chad
-----Original Message-----
From: Erik Price [mailto:erikprice
mac.com]
Sent: Friday, July 19, 2002 2:25 PM
To: Chad Day
Cc: php-general
lists.php.net
Subject: Re: [PHP] Followup to session question / scope of session
On Friday, July 19, 2002, at 01:39 PM, Chad Day wrote:
> Anyone? I'm looking on google for help and found 2 people asking > similar > questions, but both got no replies. Is it not possible to pass session > data > across subdomains? If so, what workaround can I use to keep the user > authenticated? Do I just pass the session ID in the URL? That kind of > sucks. :(
[...]
> I could set a cookie with a value, but I don't want to risk spoofing of > cookies, etc.. I'd much rather keep a registered session variable > which I > can check to see if it exists, and use that to authenticate.
No, the whole problem is that you're depending on cookies to persist the session ID for you. Which is normally fine, except that cookies have their own rules about which domains they will send data to. Specifically, a cookie set in
virtualhost1.mydomain.com
will not be available to
virtualhost2.mydomain.com
unless you have ensured that the "domain" attribute of the cookie is set to the common
.mydomain.com
so that any virtualhost/subdomain has access to the cookie. This level of cookie handling is normally abstracted away from the programmer, but it is changeable. You can change cookie values with JavaScript, and with PHP's setcookie() function. Read the man page for more info.
(I do not know if the domain set by session_start() is the broader ".mydomain.com" or the narrower "virtualhostx.mydomain.com", but you could investigate this.)
Erik
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Friday, July 19, 2002, at 02:40 PM, Chad Day wrote:
> If I refer to a script without the filename > (http://www.online-leagues.com/my), Apache apparently interprets that as > (http://online-leagues.com/my/look-for-the-index-file).
This depends on your Apache configuration, and is pretty normal. Usually it will look for index.html first, then index.php, then index.shtml, or whatever order is specified in your httpd.conf file. You may be able to override this with a .htaccess file too.
> Now, I could just rewrite all the URLs, but in the near future I want > to be > able to have http://my.online-leagues.com and > http://calendar.online-leagues.com working and use data in those > sessions. > > I'm not sure what cookies have to do with this, aside from passing > along the > session id.
That's exactly what cookies have to do with this. By relying on the cookie to pass the session id, you can only maintain the session by making this cookie available to the server. Since a cookie is only readable by the domain which sets the cookie, you need to adjust the value of the "domain" attribute of the cookie so that it is readable by other subdomains. The easiest way to do that is to set the cookie's domain attribute to ".domain.com" which means "any subdomain of domain.com". Refer to this spec, it will help you understand:
http://wp.netscape.com/newsref/std/cookie_spec.html
Note I just found a quick article, which I haven't read, which may help you:
http://www.phpbuilder.com/columns/chriskings20001128.php3
> <? > session_start(); > > $I_AM_A_NEW_VALID_USER = '1'; > session_register("I_AM_A_NEW_VALID_USER"); > > echo "<a href=\"http://online-leagues.com/leagues/testdir/index.php?"; > echo $PHPSESSID; > echo "\">link</a>"; > ?>
What is the URL of this link? Look at it closely, it is missing something: <a href="http://online- leagues.com/leagues/testdir/index.php?XXXXXXX">link</a>
You've specificed a GET variable name but no value. Try doing that again, but put the name "SID=" immediately before the $PHPSESSID value.
> I apologize if I am missing something basic here / am not > understanding.. I > just don't know what I have to do to get my session to work across that > entire domain.. I thought worst case, passing along the SID would work, > but > that doesn't seem to be working either. >
No big deal it just looks like you forgot to name the GET variable. Read up on that cookie stuff, it'll help you in the long run if you're serious about doing a lot of session work.
Erik
attached mail follows:
Right.. I understand that other virtual domains can't read the cookie. The problem is I can't control what domain session_start() sets the cookie in.. it appears to set it on the exact domain I am at.
I noticed if I do this:
http://online-leagues.com/leagues/testdir/loginme.php (no www)
the next page (without www) works ok. returns valid.
If I then add a www in front of that link, it ALSO returns valid.
so perhaps session_start(), since I am starting at online-leagues.com (not www.online-leagues.com) sets a cookie that is valid for all of *.online-leagues.com? This appears to be the case, as I just tried sticking mail.online-leagues.com in that 2nd script (the one with the check), and it returns valid also.
So.. I guess the solution is to set the cookie at online-leagues.com, not www.online-leagues.com, and this will make it readable by all of *.online-leagues.com.
Hopefully, this helps someone else out there somewhere. :) Thanks to everyone for helping me figure this out (at least, I hope this is figured out!)
Thanks again, Chad
-----Original Message-----
From: Erik Price [mailto:erikprice
mac.com]
Sent: Friday, July 19, 2002 3:04 PM
To: Chad Day
Cc: php-general
lists.php.net
Subject: Re: [PHP] Followup to session question / scope of session
On Friday, July 19, 2002, at 02:40 PM, Chad Day wrote:
> If I refer to a script without the filename > (http://www.online-leagues.com/my), Apache apparently interprets that as > (http://online-leagues.com/my/look-for-the-index-file).
This depends on your Apache configuration, and is pretty normal. Usually it will look for index.html first, then index.php, then index.shtml, or whatever order is specified in your httpd.conf file. You may be able to override this with a .htaccess file too.
> Now, I could just rewrite all the URLs, but in the near future I want > to be > able to have http://my.online-leagues.com and > http://calendar.online-leagues.com working and use data in those > sessions. > > I'm not sure what cookies have to do with this, aside from passing > along the > session id.
That's exactly what cookies have to do with this. By relying on the cookie to pass the session id, you can only maintain the session by making this cookie available to the server. Since a cookie is only readable by the domain which sets the cookie, you need to adjust the value of the "domain" attribute of the cookie so that it is readable by other subdomains. The easiest way to do that is to set the cookie's domain attribute to ".domain.com" which means "any subdomain of domain.com". Refer to this spec, it will help you understand:
http://wp.netscape.com/newsref/std/cookie_spec.html
Note I just found a quick article, which I haven't read, which may help you:
http://www.phpbuilder.com/columns/chriskings20001128.php3
> <? > session_start(); > > $I_AM_A_NEW_VALID_USER = '1'; > session_register("I_AM_A_NEW_VALID_USER"); > > echo "<a href=\"http://online-leagues.com/leagues/testdir/index.php?"; > echo $PHPSESSID; > echo "\">link</a>"; > ?>
What is the URL of this link? Look at it closely, it is missing something: <a href="http://online- leagues.com/leagues/testdir/index.php?XXXXXXX">link</a>
You've specificed a GET variable name but no value. Try doing that again, but put the name "SID=" immediately before the $PHPSESSID value.
> I apologize if I am missing something basic here / am not > understanding.. I > just don't know what I have to do to get my session to work across that > entire domain.. I thought worst case, passing along the SID would work, > but > that doesn't seem to be working either. >
No big deal it just looks like you forgot to name the GET variable. Read up on that cookie stuff, it'll help you in the long run if you're serious about doing a lot of session work.
Erik
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Friday, July 19, 2002, at 02:59 PM, Chad Day wrote:
> So.. I guess the solution is to set the cookie at online-leagues.com, > not > www.online-leagues.com, and this will make it readable by all of > *.online-leagues.com.
I don't have access to a PHP-enabled server at the moment, so I can't test this. But if you really want to know how this works, try executing the following code somewhere in your script after session_start():
$sessionCookieData = array(); $sessionCookieData = session_get_cookie_params();
foreach ($sessionCookieData as $paramName => $paramValue) { echo "<p>The cookie's " . $paramName . " value is " . $paramValue . "</p>\n"; }
Please report your findings to the list, it will be interesting to see which subdomain session_start() sets in the cookie as its "domain" value. I'm guessing it's whatever the current subdomain is and NOT the generic ".domain.com" value as I originally thought.
Erik
attached mail follows:
If you created a session on "www", how would you know what session to load on the non-www side?
to get sessions working across multiple domains, you must either muck about with the cookie's domain name or actually pass the SID in the query.
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Erik Price" <erikpricemac.com> wrote in message news:DCBC7D24-9B47-11D6-AE60-00039351FE6A
mac.com... > > On Friday, July 19, 2002, at 02:05 PM, Chad Day wrote: > > > It's still there, yes, but when I go to my.mydomain.com from > > www.mydomain.com, the session_start() at the top of the script starts > > a new > > session rather than picking up on the old www.mydomain.com session. I > > don't > > know how to tell it to look at the old session and continue that one. > > Try naming your session and using session_name() to force the > session_start() call to look first for an original session. Read up on > session_start() for more info. > > > > Erik >
attached mail follows:
Since you know the name of the file you're looking for, why not just use file_exists()? http://www.php.net/manual/en/function.file-exists.php
// Build the filename from the form submission $filename = "whatever.pdf"; $path = "path/to/files/relative/to/runtime/dir"; if(file_exists("$path/$filename")) { return(1); } else { return(0); }
That should be faster than trying to read directory contents.
..mike..
On Fri, 2002-07-19 at 01:59, Jack wrote: > Dear all > I had a folder which contains a lot of pdf file, the name format of the pdf > files are : xxxxx.dateformat.pdf (eg : abcdefg.20020718.pdf). > Now i want to use the php script to detect what files it got in a specific > folder. > i want to make a user input form which will let user to input the date and > then i will look for the pdf report from this specific folder base on the > Date given! > > I think one of the quickest way is to ask php to check the filename from > "Right to Left" which is the Date format! > > But i don't know which php function will perform this task (Check filename > from Right to Left). > > If you have any other suggestion, pls help me! > >
attached mail follows:
I want to be able to insert a single item into a database table that has many columns on one page, and then when submitted, be directed to another page that shows all the fields to add information in. In this case, I am creating an inventory app where you would add by selecting the type from a drop down menu. For example, computer, scanner, printer, book, etc. Then be directed to a page for that specific type of item to be added. I want the item selected entered into the database, and then on the next page have the fields that information needs to be entered into displayed. When the first page enters the type of item I want to add to the database, it will create the ID number for that item. This is what I want to get, so that I can have the next page display properly. How do I enter something, and then pull out the ID of the row that the item was entered into?
Thanks, Mike
attached mail follows:
Depends on the database - if you're using mysql, you would use mysql_insert_id() (http://www.php.net/manual/en/function.mysql-insert-id.php) immediately after the insert operation, then pass that value to the next page to do the query on that record. Other databases have other methods, some have none. This is, of course, assuming that I understood your question - this works for auto-incremented id values rather than ones you generate yourself. If you are generating your own id, you'd just pass it along to the next page when you redirect.
..mike..
On Fri, 2002-07-19 at 09:14, Mike Tuller wrote: > I want to be able to insert a single item into a database table that has > many columns on one page, and then when submitted, be directed to another > page that shows all the fields to add information in. In this case, I am > creating an inventory app where you would add by selecting the type from a > drop down menu. For example, computer, scanner, printer, book, etc. Then be > directed to a page for that specific type of item to be added. I want the > item selected entered into the database, and then on the next page have the > fields that information needs to be entered into displayed. When the first > page enters the type of item I want to add to the database, it will create > the ID number for that item. This is what I want to get, so that I can have > the next page display properly. How do I enter something, and then pull out > the ID of the row that the item was entered into? >
attached mail follows:
That was exactly what I needed. I thought it would be more complex.
> From: Michael Sweeney <sweeney
verisity.com>
> Date: 19 Jul 2002 09:31:18 -0700
> To: Mike Tuller <php
ce.anoka.k12.mn.us>
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Is this possible?
>
> Depends on the database - if you're using mysql, you would use
> mysql_insert_id()
> (http://www.php.net/manual/en/function.mysql-insert-id.php) immediately
> after the insert operation, then pass that value to the next page to do
> the query on that record. Other databases have other methods, some have
> none. This is, of course, assuming that I understood your question -
> this works for auto-incremented id values rather than ones you generate
> yourself. If you are generating your own id, you'd just pass it along to
> the next page when you redirect.
>
> ..mike..
>
> On Fri, 2002-07-19 at 09:14, Mike Tuller wrote:
>> I want to be able to insert a single item into a database table that has
>> many columns on one page, and then when submitted, be directed to another
>> page that shows all the fields to add information in. In this case, I am
>> creating an inventory app where you would add by selecting the type from a
>> drop down menu. For example, computer, scanner, printer, book, etc. Then be
>> directed to a page for that specific type of item to be added. I want the
>> item selected entered into the database, and then on the next page have the
>> fields that information needs to be entered into displayed. When the first
>> page enters the type of item I want to add to the database, it will create
>> the ID number for that item. This is what I want to get, so that I can have
>> the next page display properly. How do I enter something, and then pull out
>> the ID of the row that the item was entered into?
>>
>
>
attached mail follows:
> Or get an editor that understands PHP and JavaScript that > will color-code it all for you.
Homesite... w00t!
Just don't try to use Homesite as a WYSIWYG editor.
~Steve-o
attached mail follows:
On Thu, 2002-07-18 at 12:52, vins wrote: > you know what.... forget this whole thing.... I just need to know how do i > clear the file contents.... set it 0 length.... > I cannot delete the file.... no permission.... > >
If you have permission to write to the file, use fopen($filename, "w") - that will zero the file out. If you can't write to the file, you're out of luck.
..mike..
attached mail follows:
> I need to pass several variables, one that is an array and > another that is a fairly long string, so, I can't really do > this via the URL. > > My initial idea was to just create a very simple form that > only has hidden fields with the data I want to pass, along > with an image Submit button
First, do you know how many fields will be in the array?
Second, are you going from an HTML form to PHP or PHP to a script?
The reason I'm asking is I just did something similar to this. I had to pull a half-dozen variables out of an LMS system with CMI calls and then pass them to a PHP page. What I did was load a blank page, pull the variables I needed out of the system, then javascript post them to the PHP page. It gives a bit of a delay for the user, but it works.
(javascript.htm) <html> <head><title></title></head> <body>
<form action="http://my.php.script" method="post" name="myForm"> <input type="hidden" name="variable1"> <input type="hidden" name="variable2"> </form> <!-- Notice there's no submit button -->
<script language="JavaScript"> loadvariables(); document.myForm.variable1.value = loadedVariable1; document.myForm.variable2.value = loadedVariable2; document.myForm.variable1.submit(); <!-- after loading the variables, javascript submits the form to the php --> </script>
</body> </html>
attached mail follows:
I can't take full credit for this. i asked a fellow perl programmer and he muttered the words, "why bother searching for newlines and spaces". so, now searching for any layout of the word will work.
$answer = "hello\na\np\np\nl\ne\n"; /*from textarea in form*/ /* replace all whitespace and newlines with nothing */ $tempanswer = preg_replace("/\s*|\n*/","",$answer); $word = "apple"; /* match on the new condensed answer */ preg_match("/".$word."/i",$tempanswer,$match)
and this works for "red apple" as well.
thanks, joe
'Joe Rice'(riceja
water-melon.net)
Fri, Jul 19, 2002 at 10:09:55AM -0500:
>
> i though i had tried this. but, i just did again and it
> still isn't matching. I've read that browsers send
> different things for the newline from <textarea> but, i've
> tried
> Netscape,IE on windows
> Netscape, Mozilla on Solaris
>
> I really think what i have should work.
> $word gets set to
>
> (.?|\s*|\n*|)r(.?|\s*|\n*|)(.?|\s*|\n*|)e(.?|\s*|\n*|)(.?|\s*|\n*|)d(.?|\s*|\n*|)(.?|\s*|\n*|) (.?|\s*|\n*|)(.?|\s*|\n*|)a(.?|\s*|\n*|)(.?|\s*|\n*|)p(.?|\s*|\n*|)(.?|\s*|\n*|)p(.?|\s*|\n*|)(.?|\s*|\n*|)l(.?|\s*|\n*|)(.?|\s*|\n*|)e(.?|\s*|\n*|)
>
>
> (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline)
> r
> (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline)
> e
> (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline)
> d
> (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline)
>
> (match 0 or 1 of anything | match 0 or more of any white space | match 0 or more of newline)
> a
>
>
> and so on...
> the only thing i can think of is the "space" between the words that
> i'm not matching.
>
> if anyone can help, i would appreciate it.
> thanks,
> joe
>
>
> Martin Towell(martin.towell
world.net)
Fri, Jul 19, 2002 at 04:06:03PM +1000:
> > try changing the "+"'s with "*"'s
> > + = 1 or more
> > * = 0 or more
> >
> > -----Original Message-----
> > From: Joe Rice [mailto:riceja
water-melon.net]
> > Sent: Friday, July 19, 2002 3:30 PM
> > To: php-general
lists.php.net
> > Subject: [PHP] vertical word match
> >
> >
> >
> > hello,
> > any regex gurus?
> > i'm trying to match words put into a <textarea>
> > that are in the form of a\np\np\l\e
> > or any combination of new lines in between, before
> > or after.
> >
> > $answer = "hello\na\np\np\nl\ne\n"; /*from textarea in form*/
> > $word = "apple";
> > $word = preg_replace("/(.)/","(.?|\s+|\n+|)$1(.?|\s+|\n+|)",$word);
> > preg_match("/".$word."/im",$answer,$match)
> >
> > works.
> > but if
> >
> > $word = "red apple";
> > $answer = "r\ne\nd\n\na\np\np\nl\e";
> >
> > it doesn't match.
> >
> >
> > thanks in advance,
> > joe
> >
> > --
> > 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
> >
>
> --
> How do i get rid of those words in my screen that are coming from you?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
-- How do i get rid of those words in my screen that are coming from you?
attached mail follows:
I run an introductory course on PHP and I have just made the course material available for download for $25.
There are a lot of introductory guides to PHP around, but many of them assume that you already are a programmer, know the C programming language, understand how to use a database and/or are adept in HTML. If you don't already know all this stuff then it can be a bit hard to get started.
The course I run does not assume any of these things. It explains the basic concepts of programming (variables, loops, if-tests etc), plus enough about databases and HTML to get started with PHP. The course concentrates on building dynamic web pages from information in a database and the notes include numerous working examples.
If you have access to a web server running PHP and you are happy to learn on your own, you can download the notes and examples from http://merrowinternet.com/downloads?source=ml.
I also offer the course with tutorial support by email, plus online access to working equipment. If you think you need that, then go to this page: http://merrowinternet.com/courses/php.intro.html?source=ml.
My web site also contains some free material, including a beginner's guide to UNIX and Linux and Computer-Based Training software that teaches the basics of Linux. You will find these at http://merrowinternet.com/downloads?source=ml.
Simon Ritchie
Merrow Internet Services
attached mail follows:
try putting the PHP binary on the shebang line and include('snmp_guard.php'); in the code.
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Maas" <maastelia.com> wrote in message news:20020718103644.19470.qmail
pb1.pair.com... > Iam trying to use my php file in a Linux machine. > > #!/usr/local/bin/snmp_guard.php -q > > <? > $bat = snmpget("192.168.10.8", "pub_likt", ".1.3.6.1.4.1.2606.1.2.12.0"); > $sum = snmpget("192.168.10.8", "pub_likt", ".1.3.6.1.4.1.2606.1.2.13.0"); > $drift = snmpget("192.168.10.8", "pub_likt", ".1.3.6.1.4.1.2606.1.2.10.0"); > $verk = snmpget("192.168.10.8", "pub_likt", ".1.3.6.1.4.1.2606.1.2.11.0"); > echo $bat; > ?> > > Then I start it with php snmp_guard.php > > All I get is > > Call to undefeind funcion snmpget() > > WHY?? > >
attached mail follows:
I wish to implement a discussion forum for an educational site. I have heard of several PHP/MySQL ones available like postnuke, PHPBB, NeoPlanet etc. Which one is best and shall be good for educational site. Thx in advance. Dasmeet
--- Watch Indian TV Schedules Onlinehttp://www.einfotimes.com Earn Money to Read Emails (NOT SPAM)
http://hp.fedoxpress.com
attached mail follows:
I am a beginner at using PHP, and am developing a product "template" utilizing a MySQL database. Basically, what I am attempted to do, in the code below is:
Code sample: ================================================ printf(($result["REL_PLAN1"]), mysql_result($result,0,"REL_PLAN1")); ================================================
Questions: 1. In the first part, print out the value of the REL_PLAN1 database field for display purposes. The value in this field will be in the format http://www.yahoo.com.
2. In the second part, make the value in the mysql_result($result,0,"REL_PLAN1") field display on the page as a clickable hyperlink.
Basically, I want the value displayed in part 1 to change depending on what value is actually in the REL_PLAN1 db field (in part 2). Hope this makes sense.
Any help would be greatly appreciated. Thanks.
Mark
attached mail follows:
I am working through an issue where I'm trying to display HTML code, stored in a text field in a MySQL database. The code that I have looks like this:
<tr> <td colspan=3 ><center> <?php printf($result[PAYPAL_BUTTON]); ?> </center> </td> </tr>
This code displays nothing when viewed on the web server, although the contents of the db field are:
<FORM method="POST" > <P><INPUT type="submit" value="Submit" name="subBut"> </FORM>
Question:
1. How do I get this code to display correctly (i.e. create the button / not show the underlying HTML)?
Any help would be greatly appreciated. Thanks for your help.
Mark
attached mail follows:
[snip] I am working through an issue where I'm trying to display HTML code, stored in a text field in a MySQL database. The code that I have looks like this:
<tr> <td colspan=3 ><center> <?php printf($result[PAYPAL_BUTTON]); ?> </center> </td> </tr>
This code displays nothing when viewed on the web server, although the contents of the db field are:
<FORM method="POST" > <P><INPUT type="submit" value="Submit" name="subBut"> </FORM> 1. How do I get this code to display correctly (i.e. create the button / not show the underlying HTML)? [/snip]
Try eval() http://www.php.net/manual/en/function.eval.php
HTH!
Jay
"Remember…pillage first. THEN burn."
************************************* * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/ * * No developer is an island ... * *************************************
attached mail follows:
On Friday, July 19, 2002, at 02:44 PM, markbm wrote:
> <?php printf($result[PAYPAL_BUTTON]); ?> </center> > </td>
[...]
> 1. How do I get this code to display correctly (i.e. create the > button / > not show the underlying HTML)?
Are you sure you want to use the printf() function? Try using print() instead.
Also, unless PAYPAL_BUTTON is a constant, you probably want to quote that associative array element ($result['PAYPAL_BUTTON']).
Erik
attached mail follows:
and also make sure to strip out all slashes that the DB/PHP might weasel into your mysql text.
or you could also skip "print" altogether and do this: <?= $result['PAYPAL_BUTTON'] ?>
ciao, on my vespa.
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Erik Price" <erikpricemac.com> wrote in message news:5D780CCC-9B48-11D6-AE60-00039351FE6A
mac.com... > > On Friday, July 19, 2002, at 02:44 PM, markbm wrote: > > > <?php printf($result[PAYPAL_BUTTON]); ?> </center> > > </td> > > [...] > > > 1. How do I get this code to display correctly (i.e. create the > > button / > > not show the underlying HTML)? > > Are you sure you want to use the printf() function? Try using print() > instead. > > Also, unless PAYPAL_BUTTON is a constant, you probably want to quote > that associative array element ($result['PAYPAL_BUTTON']). > > > Erik >
attached mail follows:
Usually when I get such problems, I start doubting I don't do something wrong with the index. So, how did you make the variabele $result? Did you call mysql_fetch_array()? or any other function go get a result row from a result identifyer? Are you using the same $result var for other data (and thus know for sure that it contains indeed data) ?
I'd advice you to do a
print_r($result);
and see if your paypall_button is in the result row. It may as well be some case sensitivity problem ...
let us know if you're problems are solved ..
Ow, btw .. if this doesn't get you anywhere, did you open the generated html source and checked if the HTML code isn't printed (or echoed, whatever you call it) to the output, or not read s it should be by iexplore, netscape, mozilla or one if their nieces ..
Greetz, Wouter
-----Oorspronkelijk bericht-----
Van: Erik Price [mailto:erikprice
mac.com]
Verzonden: vrijdag 19 juli 2002 20:50
Aan: markbm
CC: php-general
lists.php.net
Onderwerp: Re: [PHP] HTML button display problem
On Friday, July 19, 2002, at 02:44 PM, markbm wrote:
> <?php printf($result[PAYPAL_BUTTON]); ?> </center> > </td>
[...]
> 1. How do I get this code to display correctly (i.e. create the > button / > not show the underlying HTML)?
Are you sure you want to use the printf() function? Try using print() instead. Also, unless PAYPAL_BUTTON is a constant, you probably want to quote that associative array element ($result['PAYPAL_BUTTON']).
Erik
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi! I tested the curl connection using the bash shell on unix and it work just great. Then I move the test script over to PHP and test it. I got the error! The error message I got is ....
--clip--
Error 400--Bad Request From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.4.1 400 Bad Request The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
--clip--
The problem is the string is okay since it work in the bash shell. So, I think I need to convert the string into something like URL Encode or something. Does RFC 2068 tell us I need to convert the string to this RFC specification??
Thanks, FletchSOD
attached mail follows:
Alright! Found the problem! I have to do this to make it work.
--snip-- exec(CURL_CMD." -m 120 -d \"$XP_TARGET_URL\" http://www.whatever.com", $xp_result_array, $res_code); --snip--
Not like this!!! (See the difference in the backward slash and a period on the variable, $XP_TARGET_URL
--snip-- exec(CURL_CMD." -m 120 -d ".$XP_TARGET_URL." http://www.whatever.com", $xp_result_array, $res_code); --snip--
"Scott Fletcher" <scott
abcoa.com> wrote in message
news:20020719192522.33423.qmail
pb1.pair.com...
> Hi! I tested the curl connection using the bash shell on unix and it work
> just great. Then I move the test script over to PHP and test it. I got
the
> error! The error message I got is ....
>
> --clip--
>
> Error 400--Bad Request
> From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
> 10.4.1 400 Bad Request
> The request could not be understood by the server due to malformed
> syntax. The client SHOULD NOT repeat the request without modifications.
>
>
>
> --clip--
>
> The problem is the string is okay since it work in the bash shell. So, I
> think I need to convert the string into something like URL Encode or
> something. Does RFC 2068 tell us I need to convert the string to this RFC
> specification??
>
> Thanks,
> FletchSOD
>
>
attached mail follows:
Not sure how to accomplish what I would like to, I recently downloaded and installed a small Network tool from http://www.shat.net and I only need the results of one of the functions included to be passed as a variable to an input command for mysql. Here is the code, any help is appreciated! Jas <?php /* Check client info and register */ if (getenv(HTTP_X_FORWARDED_FOR)){ $ipaddy = getenv(HTTP_X_FORWARDED_FOR); } else { $ipaddy = getenv(REMOTE_ADDR); $host = gethostbyaddr($REMOTE_ADDR); }
/* Start looking up users IP vs. WHOIS database for logging */ $nipaddy = ""; function message($msg){ echo "<font face=\"verdana,arial\" size=2>$msg</font>"; flush(); } function arin($ipaddy){ $server = "whois.arin.net"; message("<p><b>IP Whois Results:</b><blockquote>"); if (!$ipaddy = gethostbyname($ipaddy)) $msg .= "Can't IP Whois without an IP address."; else{ message("Connecting to $server...<br><br>"); if (! $sock = fsockopen($server, 43, &$num, &$error, 20)){ unset($sock); $msg .= "Timed-out connecting to $server (port 43)"; } else{ fputs($sock, "$ipaddy\n"); while (!feof($sock)) $buffer .= fgets($sock, 10240); fclose($sock); } if (eregi("RIPE.NET", $buffer)) $nextServer = "whois.ripe.net"; else if (eregi("whois.apnic.net", $buffer)) $nextServer = "whois.apnic.net"; else if (eregi("nic.ad.jp", $buffer)){ $nextServer = "whois.nic.ad.jp"; #/e suppresses Japanese character output from JPNIC $extra = "/e"; } else if (eregi("whois.registro.br", $buffer)) $nextServer = "whois.registro.br"; if($nextServer){ $buffer = ""; message("Deferred to specific whois server: $nextServer...<br><br>"); if(! $sock = fsockopen($nextServer, 43, &$num, &$error, 10)){ unset($sock); $msg .= "Timed-out connecting to $nextServer (port 43)"; } else{ fputs($sock, "$ipaddy$extra\n"); while (!feof($sock)) $buffer .= fgets($sock, 10240); fclose($sock); } } $buffer = str_replace(" ", " ", $buffer); $msg .= nl2br($buffer); } $msg .= "</blockquote></p>"; message($msg); } ?> As of yet I have only been echoeing the results to the screen like: <?php echo arin($ipaddy) ?> Which works, but I do not want the results output to the screen for the view, I would like to assign a variable like $whois to the results of this function so I may stick it in the database for later retrieval. Any help on this would be great!
attached mail follows:
Hi Jas,
I may be missing something here, but it looks as though you just need to return() your $msg var and assign it in your main script. So, something like:
function arin($ipaddy) { $server = "whois.arin.net"; . . . return $msg; }
<?php
$whois = arin($ipaddy);
$sql = "INSERT INTO www_access (whois) ('".addslashes($whois)."')"; mysql_query($sql);
?>
HTH, Hans
On Fri, 2002-07-19 at 15:52, Jas wrote: > Not sure how to accomplish what I would like to, I recently downloaded and > installed a small Network tool from http://www.shat.net and I only need the > results of one of the functions included to be passed as a variable to an > input command for mysql. Here is the code, any help is appreciated! > Jas > <?php > /* Check client info and register */ > if (getenv(HTTP_X_FORWARDED_FOR)){ > $ipaddy = getenv(HTTP_X_FORWARDED_FOR); > } else { > $ipaddy = getenv(REMOTE_ADDR); > $host = gethostbyaddr($REMOTE_ADDR); } > > /* Start looking up users IP vs. WHOIS database for logging */ > $nipaddy = ""; > function message($msg){ > echo "<font face=\"verdana,arial\" size=2>$msg</font>"; > flush(); > } > function arin($ipaddy){ > $server = "whois.arin.net"; > message("<p><b>IP Whois Results:</b><blockquote>"); > if (!$ipaddy = gethostbyname($ipaddy)) > $msg .= "Can't IP Whois without an IP address."; > else{ > message("Connecting to $server...<br><br>"); > if (! $sock = fsockopen($server, 43, &$num, &$error, 20)){ > unset($sock); > $msg .= "Timed-out connecting to $server (port 43)"; > } > else{ > fputs($sock, "$ipaddy\n"); > while (!feof($sock)) > $buffer .= fgets($sock, 10240); > fclose($sock); > } > if (eregi("RIPE.NET", $buffer)) > $nextServer = "whois.ripe.net"; > else if (eregi("whois.apnic.net", $buffer)) > $nextServer = "whois.apnic.net"; > else if (eregi("nic.ad.jp", $buffer)){ > $nextServer = "whois.nic.ad.jp"; > #/e suppresses Japanese character output from JPNIC > $extra = "/e"; > } > else if (eregi("whois.registro.br", $buffer)) > $nextServer = "whois.registro.br"; > if($nextServer){ > $buffer = ""; > message("Deferred to specific whois server: $nextServer...<br><br>"); > if(! $sock = fsockopen($nextServer, 43, &$num, &$error, 10)){ > unset($sock); > $msg .= "Timed-out connecting to $nextServer (port 43)"; > } > else{ > fputs($sock, "$ipaddy$extra\n"); > while (!feof($sock)) > $buffer .= fgets($sock, 10240); > fclose($sock); > } > } > $buffer = str_replace(" ", " ", $buffer); > $msg .= nl2br($buffer); > } > $msg .= "</blockquote></p>"; > message($msg); > } > ?> > As of yet I have only been echoeing the results to the screen like: > <?php echo arin($ipaddy) ?> Which works, but I do not want the results > output to the screen for the view, I would like to assign a variable like > $whois to the results of this function so I may stick it in the database for > later retrieval. Any help on this would be great! > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
And you also need to change 'message()' to something like '$msg' to capture that text also.
or, what you could do is turn on output buffering and grab everything that is output ;-)
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Hans Lellelid" <hansforumone.com> wrote in message news:1027108429.5941.25.camel
lavoro.xmpl.org... > Hi Jas, > > I may be missing something here, but it looks as though you just need to > return() your $msg var and assign it in your main script. So, something > like: > > > function arin($ipaddy) > { > $server = "whois.arin.net"; > . > . > . > return $msg; > } > > > <?php > > $whois = arin($ipaddy); > > $sql = "INSERT INTO www_access (whois) ('".addslashes($whois)."')"; > mysql_query($sql); > > ?> > > HTH, > Hans > > > On Fri, 2002-07-19 at 15:52, Jas wrote: > > Not sure how to accomplish what I would like to, I recently downloaded and > > installed a small Network tool from http://www.shat.net and I only need the > > results of one of the functions included to be passed as a variable to an > > input command for mysql. Here is the code, any help is appreciated! > > Jas > > <?php > > /* Check client info and register */ > > if (getenv(HTTP_X_FORWARDED_FOR)){ > > $ipaddy = getenv(HTTP_X_FORWARDED_FOR); > > } else { > > $ipaddy = getenv(REMOTE_ADDR); > > $host = gethostbyaddr($REMOTE_ADDR); } > > > > /* Start looking up users IP vs. WHOIS database for logging */ > > $nipaddy = ""; > > function message($msg){ > > echo "<font face=\"verdana,arial\" size=2>$msg</font>"; > > flush(); > > } > > function arin($ipaddy){ > > $server = "whois.arin.net"; > > message("<p><b>IP Whois Results:</b><blockquote>"); > > if (!$ipaddy = gethostbyname($ipaddy)) > > $msg .= "Can't IP Whois without an IP address."; > > else{ > > message("Connecting to $server...<br><br>"); > > if (! $sock = fsockopen($server, 43, &$num, &$error, 20)){ > > unset($sock); > > $msg .= "Timed-out connecting to $server (port 43)"; > > } > > else{ > > fputs($sock, "$ipaddy\n"); > > while (!feof($sock)) > > $buffer .= fgets($sock, 10240); > > fclose($sock); > > } > > if (eregi("RIPE.NET", $buffer)) > > $nextServer = "whois.ripe.net"; > > else if (eregi("whois.apnic.net", $buffer)) > > $nextServer = "whois.apnic.net"; > > else if (eregi("nic.ad.jp", $buffer)){ > > $nextServer = "whois.nic.ad.jp"; > > #/e suppresses Japanese character output from JPNIC > > $extra = "/e"; > > } > > else if (eregi("whois.registro.br", $buffer)) > > $nextServer = "whois.registro.br"; > > if($nextServer){ > > $buffer = ""; > > message("Deferred to specific whois server: $nextServer...<br><br>"); > > if(! $sock = fsockopen($nextServer, 43, &$num, &$error, 10)){ > > unset($sock); > > $msg .= "Timed-out connecting to $nextServer (port 43)"; > > } > > else{ > > fputs($sock, "$ipaddy$extra\n"); > > while (!feof($sock)) > > $buffer .= fgets($sock, 10240); > > fclose($sock); > > } > > } > > $buffer = str_replace(" ", " ", $buffer); > > $msg .= nl2br($buffer); > > } > > $msg .= "</blockquote></p>"; > > message($msg); > > } > > ?> > > As of yet I have only been echoeing the results to the screen like: > > <?php echo arin($ipaddy) ?> Which works, but I do not want the results > > output to the screen for the view, I would like to assign a variable like > > $whois to the results of this function so I may stick it in the database for > > later retrieval. Any help on this would be great! > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >
attached mail follows:
Hi, I was trying to upload files in php and came across some problems. I am using Apache on Linux. My first file was:
-html- -form action="t1.php" method="post"- -input type="hidden" name="MAX_FILE_SIZE" value="100000"- Send this file: -input name="ttt" type="file"- -input type="submit" value="send"- -/form-
-/html-
If I use enctype in the <form> attribute, no form variables are made available in t1.php. t1.php is as follows:
<? echo $MAX_FILE_SIZE;
echo "<br>"; $filename = $HTTP_POST_FILES['ttt']['tmp_name']; echo $filename; $realname = $HTTP_POST_FILES['ttt']['name']; print "realname is $realname"; ?>
$filename or $realname are not display. I set register_globals to on and my variables_order string is also set to EGPCS. I'm sure I am making a very basic/stupid mistake here, but could somebody help me out, please? Thank you.
ramya
"We have forgotten how to be good guests, how to walk lightly on the earth as other creatures do." Visit www.greenpeaceusa.org
attached mail follows:
You need to add the enctype="multipart/form-data" attribute to your form tag to be able to upload files.
At 04:12 PM 7/19/2002 -0400, rasokan wrote: >Hi, >I was trying to upload files in php and came across some problems. I am using >Apache on Linux. >My first file was: > >-html- >-form action="t1.php" method="post"- >-input type="hidden" name="MAX_FILE_SIZE" value="100000"- > Send this file: -input name="ttt" type="file"- > -input type="submit" value="send"- > -/form- > >-/html- > >If I use enctype in the <form> attribute, no form variables are made >available >in t1.php. t1.php is as follows: > ><? >echo $MAX_FILE_SIZE; > >echo "<br>"; > $filename = $HTTP_POST_FILES['ttt']['tmp_name']; > echo $filename; > $realname = $HTTP_POST_FILES['ttt']['name']; > print "realname is $realname"; >?> > >$filename or $realname are not display. I set register_globals to on and my >variables_order string is also set to EGPCS. I'm sure I am making a very >basic/stupid mistake here, but could somebody help me out, please? >Thank you. > >ramya > >"We have forgotten how to be good guests, how to walk lightly on the earth >as other creatures do." >Visit www.greenpeaceusa.org > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
and also, try var_dump($HTTP_POST_FILES); var_dump($_REQUEST);
to see if anything is incoming
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Nick Oostveen" <nicko-mlhpmarketing.com> wrote in message news:5.1.1.6.0.20020719133555.03329288
pop.hpmarketing.com... > You need to add the enctype="multipart/form-data" attribute to your form > tag to be able to upload files. > > At 04:12 PM 7/19/2002 -0400, rasokan wrote: > >Hi, > >I was trying to upload files in php and came across some problems. I am using > >Apache on Linux. > >My first file was: > > > >-html- > >-form action="t1.php" method="post"- > >-input type="hidden" name="MAX_FILE_SIZE" value="100000"- > > Send this file: -input name="ttt" type="file"- > > -input type="submit" value="send"- > > -/form- > > > >-/html- > > > >If I use enctype in the <form> attribute, no form variables are made > >available > >in t1.php. t1.php is as follows: > > > ><? > >echo $MAX_FILE_SIZE; > > > >echo "<br>"; > > $filename = $HTTP_POST_FILES['ttt']['tmp_name']; > > echo $filename; > > $realname = $HTTP_POST_FILES['ttt']['name']; > > print "realname is $realname"; > >?> > > > >$filename or $realname are not display. I set register_globals to on and my > >variables_order string is also set to EGPCS. I'm sure I am making a very > >basic/stupid mistake here, but could somebody help me out, please? > >Thank you. > > > >ramya > > > >"We have forgotten how to be good guests, how to walk lightly on the earth > >as other creatures do." > >Visit www.greenpeaceusa.org > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Also, depending on your install of PHP, you may have file uploads disabled. If all else fails, check you php.ini and look for these lines:
; Whether to allow HTTP file uploads. file_uploads = Off
Make sure that gets set to "On". E.g. RH 7.3's PHP RPM install seems to have this set to Off by default.
Cheers, Hans
On Fri, 2002-07-19 at 16:58, Scott Hurring wrote:
> and also, try
> var_dump($HTTP_POST_FILES);
> var_dump($_REQUEST);
>
> to see if anything is incoming
>
> --
> Scott Hurring
> Systems Programmer
> EAC Corporation
> scott (*) eac.com
> --
> "Nick Oostveen" <nicko-ml
hpmarketing.com> wrote in message
> news:5.1.1.6.0.20020719133555.03329288
pop.hpmarketing.com...
> > You need to add the enctype="multipart/form-data" attribute to your form
> > tag to be able to upload files.
> >
> > At 04:12 PM 7/19/2002 -0400, rasokan wrote:
> > >Hi,
> > >I was trying to upload files in php and came across some problems. I am using
> > >Apache on Linux.
> > >My first file was:
> > >
> > >-html-
> > >-form action="t1.php" method="post"-
> > >-input type="hidden" name="MAX_FILE_SIZE" value="100000"-
> > > Send this file: -input name="ttt" type="file"-
> > > -input type="submit" value="send"-
> > > -/form-
> > >
> > >-/html-
> > >
> > >If I use enctype in the <form> attribute, no form variables are made
> > >available
> > >in t1.php. t1.php is as follows:
> > >
> > ><?
> > >echo $MAX_FILE_SIZE;
> > >
> > >echo "<br>";
> > > $filename = $HTTP_POST_FILES['ttt']['tmp_name'];
> > > echo $filename;
> > > $realname = $HTTP_POST_FILES['ttt']['name'];
> > > print "realname is $realname";
> > >?>
> > >
> > >$filename or $realname are not display. I set register_globals to on and my
> > >variables_order string is also set to EGPCS. I'm sure I am making a very
> > >basic/stupid mistake here, but could somebody help me out, please?
> > >Thank you.
> > >
> > >ramya
> > >
> > >"We have forgotten how to be good guests, how to walk lightly on the earth
> > >as other creatures do."
> > >Visit www.greenpeaceusa.org
> > >
> > >
> > >--
> > >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
>
>
attached mail follows:
Function CountIt($action, $counter) { $sql = "SELECT ".$counter." FROM counters WHERE id='1'"; $res = mysql_query($sql); $num = mysql_result($res, 0, $counter);
if($action == "more") $num++; if($action == "less") $num--;
$sql = "UPDATE counters SET ".$counter."='".$num."' WHERE id='1'"; $res = mysql_query($sql); }
That is my script.... I call it CountIt('more','hits');
but everytime i call it, the dam thing always adds 2 counts
Can anyone identify an error
please
attached mail follows:
for starters, add some debugging stuff like print "i'm here"
maybe the function is being called from somewhere else by "accident".... or maybe something more magical is happening. but anyway, debugging output might help.
also, for future reference, you can do this kind of thing much easier using one single SQL call:
UPDATE counters SET {$counter}={$counter}+1 WHERE id='1'
-- Scott Hurring Systems Programmer EAC Corporation scott (*) eac.com -- "Vins" <vinswebonline.co.za> wrote in message news:20020719204306.81788.qmail
pb1.pair.com... > Function CountIt($action, $counter) > { > $sql = "SELECT ".$counter." FROM counters WHERE id='1'"; > $res = mysql_query($sql); > $num = mysql_result($res, 0, $counter); > > if($action == "more") $num++; > if($action == "less") $num--; > > $sql = "UPDATE counters SET ".$counter."='".$num."' WHERE id='1'"; > $res = mysql_query($sql); > } > > That is my script.... > I call it CountIt('more','hits'); > > but everytime i call it, the dam thing always adds 2 counts > > Can anyone identify an error > > please > >
attached mail follows:
Why do you first use the select? Since you don't return anything, you may as well want to do:
---
function countIt($action, $counter) {
if ($action == "more") { $sign = "+"; };
if ($action == "less") { $sign = "-"; };
mysql_query("UPDATE counters SET $counter = $counter $sign 1");
};
----
this saves you a database query .. and well, it may also work around your
problem. I think it shud .. Though I can't see where the error's hidden in
your version ...
Greetz,
Wouter
----------
Alle door mij verzonden email is careware. Dit houdt in dat het alleen
herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde
en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.
All email sent by me is careware. This means that it can only be reread and
kept if you are good for all the life here on earth and beyond. If you don't
agree to these terms, you should return this email in no more than 24 hours
stating the reason of disagreement.
-----Oorspronkelijk bericht-----
Van: vins [mailto:vins
webonline.co.za]
Verzonden: vrijdag 19 juli 2002 22:42
Aan: php-general
lists.php.net
Onderwerp: [PHP] Counters :: Double, Triple :: What The Hell
Function CountIt($action, $counter)
{
$sql = "SELECT ".$counter." FROM counters WHERE id='1'";
$res = mysql_query($sql);
$num = mysql_result($res, 0, $counter);
if($action == "more") $num++;
if($action == "less") $num--;
$sql = "UPDATE counters SET ".$counter."='".$num."' WHERE id='1'";
$res = mysql_query($sql);
}
That is my script....
I call it CountIt('more','hits');
but everytime i call it, the dam thing always adds 2 counts
Can anyone identify an error
please
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Shit... Nice trick.. works great... I really didn't know you could do that with mysql but i always say.... "you learn everyday"
Another thing i didn't mention is that this dam counter increases on every single page.... even when i'v only called it on the index.php page.
strange
"Wouter Van Vliet" <wouter
springt.nl> wrote in message
news:CPEAJACGLADEOMKBJJLNKEHBDBAA.wouter
springt.nl...
> Why do you first use the select? Since you don't return anything, you may
as
> well want to do:
> ---
> function countIt($action, $counter) {
> if ($action == "more") { $sign = "+"; };
> if ($action == "less") { $sign = "-"; };
> mysql_query("UPDATE counters SET $counter = $counter $sign 1");
> };
> ----
> this saves you a database query .. and well, it may also work around your
> problem. I think it shud .. Though I can't see where the error's hidden in
> your version ...
>
> Greetz,
> Wouter
>
> ----------
> Alle door mij verzonden email is careware. Dit houdt in dat het alleen
> herlezen en bewaard mag worden als je goed omgaat met al het leven op
aarde
> en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje
> binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid.
>
> All email sent by me is careware. This means that it can only be reread
and
> kept if you are good for all the life here on earth and beyond. If you
don't
> agree to these terms, you should return this email in no more than 24
hours
> stating the reason of disagreement.
>
>
> -----Oorspronkelijk bericht-----
> Van: vins [mailto:vins
webonline.co.za]
> Verzonden: vrijdag 19 juli 2002 22:42
> Aan: php-general
lists.php.net
> Onderwerp: [PHP] Counters :: Double, Triple :: What The Hell
>
>
> Function CountIt($action, $counter)
> {
> $sql = "SELECT ".$counter." FROM counters WHERE id='1'";
> $res = mysql_query($sql);
> $num = mysql_result($res, 0, $counter);
>
> if($action == "more") $num++;
> if($action == "less") $num--;
>
> $sql = "UPDATE counters SET ".$counter."='".$num."' WHERE id='1'";
> $res = mysql_query($sql);
> }
>
> That is my script....
> I call it CountIt('more','hits');
>
> but everytime i call it, the dam thing always adds 2 counts
>
> Can anyone identify an error
>
> please
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
If i KNOW this query will only return one "piece" of data, what, php'ly speaking, must i do to assign it to the var $id?
SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'
attached mail follows:
You have 2 ways post and get.
Post using forms .
Get using the url.
Look at php.net for post and get.
"John Wulff" <johnw
orcasnet.com> escreveu na mensagem
news:20020719204526.84969.qmail
pb1.pair.com...
> If i KNOW this query will only return one "piece" of data, what, php'ly
> speaking, must i do to assign it to the var $id?
>
> SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'
>
>
attached mail follows:
You could do something like:
$query = mysql_query("SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'"); list($id) = mysql_fetch_row($query);
HTH, Hans
On Fri, 2002-07-19 at 16:47, John Wulff wrote: > If i KNOW this query will only return one "piece" of data, what, php'ly > speaking, must i do to assign it to the var $id? > > SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER' > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
$dbh = mysql_connect($host, $user, $pass); $query = "SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'"; $results = mysql_db_query($database, $query, $dbh); $row = mysql_fetch_object($results); $id = $row->id;
However, I have found it to be beneficial to check assumptions like "the query will only return one piece of data". You might also want to include a couple of lines of code to make sure of that:
$num = mysql_num_rows($results); if($num != 1) { // do some error handling }
..mike..
On Fri, 2002-07-19 at 13:47, John Wulff wrote: > If i KNOW this query will only return one "piece" of data, what, php'ly > speaking, must i do to assign it to the var $id? > > SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER' > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Or Try:
$dbconn=mysql_connect("your stuff"); $dblink=mysql_select_db($dbname,$dbconn); $qr="SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER' "; $rez=mysql_query($qr); $id=mysql_result($rez,0,"id");
----- Original Message -----
From: "Hans Lellelid" <hans
forumone.com>
To: "John Wulff" <johnw
orcasnet.com>
Cc: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 5:24 PM
Subject: Re: [PHP] Newbie mysql question
> You could do something like: > > $query = mysql_query("SELECT id FROM ma_users WHERE > user='$PHP_AUTH_USER'"); > > list($id) = mysql_fetch_row($query); > > HTH, > Hans > > On Fri, 2002-07-19 at 16:47, John Wulff wrote: > > If i KNOW this query will only return one "piece" of data, what, php'ly > > speaking, must i do to assign it to the var $id? > > > > SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER' > > > > > > > > -- > > 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 >
attached mail follows:
JW> If i KNOW this query will only return one "piece" of data, what, php'ly JW> speaking, must i do to assign it to the var $id?
JW> SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'
You can do like this
$result = mysql_query("SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER'"); $row = mysql_fetch_array($result); $id = $row['id'];
-- Best regards, Asmodean mailto:asmodeanlka.nu
attached mail follows:
using thi to turn a colour transparent but it's turning out black.
what am i doing wrong?
-Nick
attached mail follows:
In PHP 4.2.1 (stock php.ini) under Linux (RedHat 6.1) using Apache 1.3.26 the following code:
$source = 'TEXT';
$replace = '<tag attribute=\"1\"><tag attribute=\"blah\">'; $template = '<attribute="TEXT">'; $expandedStr = str_replace( $source, $replace, $template );
print( "<h1>Result is: '$expandedStr'</h1>" );
Yields the incorrect result:
<h1>Result is: '<attribute="<tag attribute="1><tag attribute="blah">">'</h1>
Note the missing ".
However, if the <> are removed from $template then the result becomes:
<h1>Result is: 'attribute="<tag attribute=\"1\"><tag attribute=\"blah\">"'</h1>
which in this context is correct.
I've filed a bug report but wanted to ask if anyone else has seen this?
-- Yermo
--------------------------------------------------------------------- DTLink Consulting http://consulting.dtlink.com Linux Software Engineering and Consulting Services ---------------------------------------------------------------------
attached mail follows:
a
attached mail follows:
trying to include a file i get the following error
Warning: Failed opening 'http://prepaenlinea.com/links/10.swf.inc' for inclusion (include_path='.:/usr/local/lib/php') in /home/www/prepaenlinea/main.php on line 36
i've used this same include with another hosting provider and it works just fine. trying to get help from them is not possible, they "do not provide tech support when it comes to custom code".
if anyone could help me, i'd be very grateful
JP
attached mail follows:
Try using the absolute path instead of the http:// path...
.: B i g D o g :.
----- Original Message -----
From: "JP" <jp_towers
hotmail.com>
To: <php-general
lists.php.net>
Sent: Friday, July 19, 2002 4:10 PM
Subject: [PHP] include error
> trying to include a file i get the following error > > Warning: Failed opening 'http://prepaenlinea.com/links/10.swf.inc' for > inclusion (include_path='.:/usr/local/lib/php') in > /home/www/prepaenlinea/main.php on line 36 > > i've used this same include with another hosting provider and it works just > fine. > trying to get help from them is not possible, they "do not provide tech > support when it comes to custom code". > > if anyone could help me, i'd be very grateful > > JP > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> trying to include a file i get the following error > > Warning: Failed opening > 'http://prepaenlinea.com/links/10.swf.inc' for > inclusion (include_path='.:/usr/local/lib/php') in > /home/www/prepaenlinea/main.php on line 36
I'd guess it's in one of two areas. First, you're using a relative path to the include file and the relative path information isn't correct for the location of the include (most often this will be a problem with directory levels). Second, you're on a *nix host and you've mixed up your case - ie. Your include statement is all lower case and a directory or file on the filesystem has mixed case.
Check for these first and see how you go.
CYA, Dave
attached mail follows:
I wish to use the standard mail function from within an objest. Is there any special requirements I need to be aware of?
Thank You
attached mail follows:
> I wish to use the standard mail function from within an objest. Is there > any > special requirements I need to be aware of?
No. It's just like any other function.
---John Holmes...
attached mail follows:
I assume you're being somehow sarcastic here - after a single simple search on Amazon.com I have 4 cookies set and there is javascript in the results page.
Danny.
----- Original Message -----
From: "Analysis & Solutions" <danielc
analysisandsolutions.com>
To: "PHP List" <php-general
lists.php.net>
Sent: Thursday, July 18, 2002 3:35 PM
Subject: Re: [PHP] Cookies - good or bad???
> On Thu, Jul 18, 2002 at 03:38:51PM +0200, PHPCoder wrote: > > > What are the general feeling out there amongst developers about the use > > of cookies? > > Cookies rely on client side. I never rely on the client for anything. > > When it comes to examples of how to do things "The Right Way," I say go > take a look at amazon.com. No cookies. No Java'sCrap. Works flawlessly. > > --Dan > > -- > PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]