|
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: Tue Jul 30 2002 - 10:47:05 CDT
php-general Digest 30 Jul 2002 15:47:05 -0000 Issue 1495
Topics (messages 110280 through 110354):
Re: OT - javascript question..
110280 by: Jason Wong
Re: REGEX for credit card number
110281 by: Manuel Lemos
Re: Sendmail "return-path" from my virtual webhost
110282 by: Manuel Lemos
Re: need help with uploading images
110283 by: Deadsam
110320 by: Tom Rogers
Not a Valid File-Handle Resource
110284 by: Chris Carlson
110287 by: Martin Towell
110340 by: David Robley
110342 by: Dave [Hawk-Systems]
Re: Public Scripts in a commercial product
110285 by: Manuel Lemos
110286 by: Manuel Lemos
110290 by: David Freeman
What is REGEX ?
110288 by: Lord Loh.
110291 by: Martin Towell
Mail issues
110289 by: Yves Vrancken
One more question
110292 by: César Aracena
110296 by: Martin Towell
Resetting ID
110293 by: Thomas Edison Jr.
110300 by: lallous
110302 by: David Freeman
110341 by: John Holmes
Re: Submitting form in new window!
110294 by: Thomas Edison Jr.
Re: Can you help me about the installation of apache/php/MySQl/ssl ?]
110295 by: EdwardSPL.ita.org.mo
110297 by: Peter
110298 by: Jason Wong
MySQL password()
110299 by: Liam MacKenzie
110304 by: Liam MacKenzie
110307 by: Lars Olsson
110310 by: David Freeman
Re: MYSQL natsort() ?
110301 by: lallous
Re: ORDER BY from 2 tables
110303 by: Paul Dionne
Image out of LDAP
110305 by: Manuel Vazquez
110312 by: Stig Venaas
php extension problem
110306 by: p.williams.calvarytas.com.au
fullname
110308 by: Mantas Kriauciunas
110309 by: Wee Keat
110311 by: David Freeman
110328 by: lallous
110346 by: Justin French
110348 by: Markas
Re: Table formatting <-- PARTIALY SOLVED
110313 by: Tim Ward
Re: Good books on sessions
110314 by: Petre
110315 by: Rasmus Lerdorf
110316 by: Petre
110319 by: Rasmus Lerdorf
110325 by: Petre
110326 by: Rasmus Lerdorf
110347 by: Justin French
Credit Card Validation With Expiration Date
110317 by: Laurent Drouet
110318 by: Craig Vincent
PHP Installation Problem
110321 by: Mark Colvin
110322 by: Rasmus Lerdorf
110323 by: Tyler Longren
110324 by: Jason Wong
Re: PHP 4.2.2 & vpopmail
110327 by: Jakub Zawierucha
php 4.2.2 and 4.0.6
110329 by: EdwardSPL.ita.org.mo
apache and php
110330 by: EdwardSPL.ita.org.mo
110332 by: Danny Shepherd
110334 by: EdwardSPL.ita.org.mo
110336 by: Danny Shepherd
Sessions - Informed Opinions
110331 by: Danny Shepherd
110333 by: Rasmus Lerdorf
110335 by: Danny Shepherd
110338 by: Rasmus Lerdorf
110339 by: Danny Shepherd
Re: libphp4.so
110337 by: David Robley
PHP directives in httpd.conf problems
110343 by: Markas
A somewhat unusual session question...
110344 by: Lars Olsson
Re: need help reg. User Accounts
110345 by: Simon Ritchie
Problem of characters with xml_parse
110349 by: Sebastien Mole
110350 by: Sebastien Mole
110351 by: Analysis & Solutions
searching an array for words starting with 'p'
110352 by: andy
Coding PHP with register_globals off
110353 by: Neil Freeman
Sorting Output
110354 by: Brian V Bonini
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:
On Tuesday 30 July 2002 05:54, Jome wrote:
> >Is there any way, when the upload window is closed, to force a reload of
>
> the other page, so the dynamic pop-up reflects
>
> >the recent upload?
>
> This link may help some:
> http://www.hwg.org/resources/faqs/jsFAQ.html#popup-talk
>
> Please don't poste OT-questions though, there is better mailing lists if
> you want to find javascript-gurus.
Here's a javascript list:
http://www.webdevelopersjournal.com/JavaScriptWeenie.html
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* core error - bus dumped */
attached mail follows:
Hello,
On 07/28/2002 05:02 PM, Mike Mannakee wrote: > Does anyone have a regular expression that works to validate credit card > numbers?
No, there is not regular expression for that. You may want to use this class instead for validation credit card numbers in forms:
http://www.phpclasses.org/formsgeneration
--Regards, Manuel Lemos
attached mail follows:
Hello,
On 07/29/2002 01:54 PM, Al wrote: > Emails sent from my php scripts, using sendmail, all have a goofy > "return-path" variable in the header. > > Is there a way I can correct this, or does it require a change to the > sendmail config file that I can't get to?
Yes, you can use mail() 5th argument or call sendmail directly with the popen using -f switch.
Take a look at these classes to learn how to do it in case you have doubts:
http://www.phpclasses.org/mimemessage
--Regards, Manuel Lemos
attached mail follows:
This looks good but I just have one question about it if you don't mind, what if someone was uploading a gif or a PNG file? can it be made to only detect jpgs? Thanks in advance Deadsam
> Try it this way, it will check if it is a jpeg and it has a horizontal > and vertical size so you can be pretty sure it is an image file. > (you do not need the gd package for getimagesize()) > > > /** Check for the type of the image : only allow jpeg's */ > $im = getimagesize($_FILES['uploadFile'); > if(!($im[2] == 2 && $im[0] > 0 && $im[1] > 0)){ > echo "You can only upload jpg images."; > exit(); > } > > > > > -- > regards, > Tom >
attached mail follows:
Hi,
Tuesday, July 30, 2002, 1:53:50 PM, you wrote: D> This looks good but I just have one question about it if you don't mind, D> what if someone was uploading a gif or a PNG file? can it be made to only D> detect jpgs? D> Thanks in advance D> Deadsam
>> Try it this way, it will check if it is a jpeg and it has a horizontal >> and vertical size so you can be pretty sure it is an image file. >> (you do not need the gd package for getimagesize()) >> >> >> /** Check for the type of the image : only allow jpeg's */ >> $im = getimagesize($_FILES['uploadFile'); >> if(!($im[2] == 2 && $im[0] > 0 && $im[1] > 0)){ >> echo "You can only upload jpg images."; >> exit(); >> }
The $im[2] being set to 2 means it is a jpeg other image types have a different number, have a look at the getimagesize()function for details
-- regards, Tom
attached mail follows:
I am trying to create a php program and am getting an error in this area of my script:
$dataFile =
fopen("/home/blurredv/data/".$username."Contact.txt","w");
fputs($dataFile, $line);
fclose ($dataFile);
These are the errors:
Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 34 Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 35
Note: My script work perfectly with different path names under Windows NT. Do I have to do something special for Unix.
Thanks in advance,
Chris Carlson totaldeveloper.com
attached mail follows:
1. Take out the
before fopen(), this may shed some light on your problem
2. What does "/home/blurredv/data/".$username."Contact.txt" expand out to
actually be?
3. Does the script have write access to the directory/file?
-----Original Message-----
From: Chris Carlson [mailto:chris
deletedscenes.org]
Sent: Tuesday, July 30, 2002 1:09 PM
To: php-general
lists.php.net
Subject: [PHP] Not a Valid File-Handle Resource
I am trying to create a php program and am getting an error in this area of my script:
$dataFile =
fopen("/home/blurredv/data/".$username."Contact.txt","w");
fputs($dataFile, $line);
fclose ($dataFile);
These are the errors:
Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 34 Warning: Supplied argument is not a valid File-Handle resource in /home/blurredv/public_html/redcarbon/update.php on line 35
Note: My script work perfectly with different path names under Windows NT. Do I have to do something special for Unix.
Thanks in advance,
Chris Carlson totaldeveloper.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Chris Carlson wrote:
> I am trying to create a php program and am getting an error in this area
> of my script:
>
> $dataFile =
>
fopen("/home/blurredv/data/".$username."Contact.txt","w");
> fputs($dataFile, $line);
> fclose ($dataFile);
>
> These are the errors:
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/blurredv/public_html/redcarbon/update.php on line 34
> Warning: Supplied argument is not a valid File-Handle resource in
> /home/blurredv/public_html/redcarbon/update.php on line 35
>
> Note: My script work perfectly with different path names under Windows
> NT. Do I have to do something special for Unix.
>
> Thanks in advance,
At a guess, the value you are using as a filename is incorrect, but you are suppressing any error message from fopen - better that you test that result and be prepared to handle an error situation.
For a further guess, the value $username doesn't have a trailing slash.
-- David RobleyNUMBER CRUNCHING: Jumping on a Computer.
attached mail follows:
>> $dataFile =
>>
fopen("/home/blurredv/data/".$username."Contact.txt","w");
>> fputs($dataFile, $line);
>> fclose ($dataFile);
>>
>> These are the errors:
>>
>> Warning: Supplied argument is not a valid File-Handle resource in
>> /home/blurredv/public_html/redcarbon/update.php on line 34
>> Warning: Supplied argument is not a valid File-Handle resource in
>> /home/blurredv/public_html/redcarbon/update.php on line 35
>>
>> Note: My script work perfectly with different path names under Windows
>> NT. Do I have to do something special for Unix.
>>
>> Thanks in advance,
>
>At a guess, the value you are using as a filename is incorrect, but you are
>suppressing any error message from fopen - better that you test that result
>and be prepared to handle an error situation.
>
>For a further guess, the value $username doesn't have a trailing slash.
or moving to Unix introduced case sensitivity which windows has a habit of ignoring (or correcting for you).
Cheers,
Dave
attached mail follows:
Hello,
On 07/29/2002 05:29 PM, Chris Boget wrote: > If someone is going to be using scripts that they grabbed > from a public forum (PHP Builder, PHPClasses, etc) in a > commercial product (that is going to be compiled with the > Zend encoder and released), what is the protocol, if any? > Do you have to get permission from the author or anything?
If a explicit license is not specified, yes. If the license does not permit what you want to do, like for instance GPL, you may try asking the author as well.
Anyway, by popular demand, some time ago I added the possibility for authors specify the license they want they code to be made available in the PHP Classes site. You may want to notice in a specific License field in the classes' pages.
Not all authors bothered to specify their code license. Therefore, some time later I am going to mark the classes without a specific license as NOT BEING MAINTAINED precisely because many people like yourself really need to know.
> I've read a bit of the GNU Public liscence but I didn't come > away knowing any more than went I started reading it. So > I figure I'd ask here where I'm sure many of you have this > type of experience.
Yes, I am afraid that regarding GPL I have to agree with Microsoft when they say it is a cancer. The problem is that if you want to distribute something that incorporates GPL licensed components, your software also needs to be distributed as GPL and so it gets contaminated. This means that you can't sell your closed source software if you incorporate GPL components.
Most people are really not aware of this but because some important software like Linux and even MySQL use GPL and so many developers use it without even being aware of the actual license implications (if they have read the license at all).
I guess Stallman knew that most people would not read or understand the licenses or else many of them would not be adopting GPL as in fact GPL based Free as in Stallman free is more restrictive than most people intended their Open Source software to be.
Usually I do not recommend GPL at all unless you are aware of what it means and that is what you really want it. Usually I recommend BSD license or similar like Apache or even PHP license.
--Regards, Manuel Lemos
attached mail follows:
Hello,
On 07/29/2002 07:16 PM, Richard Lynch wrote: >>If someone is going to be using scripts that they grabbed > >>from a public forum (PHP Builder, PHPClasses, etc) in a > >>commercial product (that is going to be compiled with the >>Zend encoder and released), what is the protocol, if any? >>Do you have to get permission from the author or anything? >>I've read a bit of the GNU Public liscence but I didn't come >>away knowing any more than went I started reading it. So >>I figure I'd ask here where I'm sure many of you have this >>type of experience. > > > If the source code in question has *NO* licensing/copyright notice, the > author of the source holds the copyright, and you can't use it legally.
Copyright and licenses are different things. Authors always hold copyrights until their work becomes of the public domain. Before that, the copyright is of the author regardless of the license.
> If the source code in question was published under GNU, you're bound by the > GNU license, which I *THINK* let's you use it in a commercial release... > You'd have to read up on the "examples" of what GNU does/doesn't allow. I > think the FSF site might have some clear examples.
No, you can't incorporate GPL code without your software being infected, meaning you have to distribute the source of the programs that you develop that incorporate GPL code. This basically rules out closed source programs like the original poster wants to sell.
> If in doubt, contact the author. Worst that can happen is they want some > money, or you have to come up with a different solution. Odds are really > really good that there is an alternative solution "out there" to almost > *ANY* of the publicly available code in those forums, or that you could dig > into them for the core of what they do and write your own from scratch.
Yes, that is the recommended way of dealing with the licensing doubts.
--Regards, Manuel Lemos
attached mail follows:
> Yes, I am afraid that regarding GPL I have to agree with > Microsoft when they say it is a cancer. The problem is that if you want to > distribute something that incorporates GPL licensed components, your > software also needs to be distributed as GPL and so it gets contaminated. > This means that you can't sell your closed source software if you > incorporate GPL components.
I'm quite happy to be corrected on this but I have always understood GPL licensing to mean that any GPL code you include should be available in source version. The methods by which you use that GPL code doesn't necessarily have to be included. The only relevant example I can think of is if you include a class in php that is GPL then you have to distribute the source even if you compile it with zend for your own application.
It is my understanding, in this situation, that you aren't necessarily required to release the code you have written as GPL though. Basically, I thought that once something is GPL it is pretty much public forever but that doesn't stop you from including it in your own proprietory work as long as you include the source for the GPL stuff.
CYA, Dave
attached mail follows:
Hello! I am new to REGEX. I tried to read several posts on REGEX. However none were descriptive.
What is Regex ? Is it a part of the php? or an additional module? What can it be used for ?
Please let me know Thank you.
Lord Loh.
attached mail follows:
REGEX is short for "Regular Expressions" It gives you a "smarter" way to manupulate strings.
The PHP manual has some good docs on reg.ex. - see section LXXXIV and LXXXVI
HTH Martin
-----Original Message-----
From: Lord Loh. [mailto:lord_loh
rediffmail.com]
Sent: Tuesday, July 30, 2002 5:07 PM
To: php-general
lists.php.net
Subject: [PHP] What is REGEX ?
Hello! I am new to REGEX. I tried to read several posts on REGEX. However none were descriptive.
What is Regex ? Is it a part of the php? or an additional module? What can it be used for ?
Please let me know Thank you.
Lord Loh.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Greetings,
I have read up on using mail with PHP because I would like to implement it on my website. I was wondering though, if I should implement safety measures and if so, what kind of measures, under the following conditions:
1. If I want to give visitors the opportunity to sign up for a newsletter. All they have to do is fill in their email adress and hit the submit button. I could then configure the form in such a way that they would be subscribed to the Majordomo mailinglist;
2. If I want to give visitors the opportunity to send an email using a form on the website, so that they can submit questions or request information.
Should I really look into securing the mail, or is this is not necessary?
Thanks in advance,
Yves Vrancken
attached mail follows:
Martin.
Hoping you are still there, I would like to ask you one more question
about the last mail you answered me about Table Formatting (maybe you
missed my last question ;). After I used what you told me for nesting
FOR loops, I end up getting one blank image (NOT DISPLAYED) whenever I
have an odd quantity of objects in my DB… Do I have to store objects in
the DB by 2 from now on?
I’m working it for http://www.saavedraart.com
<http://www.saavedraart.com/> under the gallery section (only module I
have so far). It would be nice if you check it out and tell me your
opinion. Same goes for everybody else ;)
Thanks a lot,
<mailto:webmaster
icaam.com.ar> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
attached mail follows:
You'll have to check that the results you get back from the database actually contains something before you echo anything out. Another way would be something like this $numcols = 2; $counter = 0; while (($results = mysql_results(...)) !== false) // haven't used mysql, so you'll have to fix this line up :) { if ($counter % $numcols == 0) echo "<tr>"; // echo <td>image stuff here</td> if ($counter % $numcols == $numcols-1) echo "</tr>"; } if ($counter % $numcols != $numcols-1) echo "</tr>"; (if I remember your original post correctly....) Martin
-----Original Message-----
From: César Aracena [mailto:icaam
icaam.com.ar]
Sent: Tuesday, July 30, 2002 3:27 PM
To: martin.towell
world.net; PHP General List
Subject: One more question
Martin.
Hoping you are still there, I would like to ask you one more question about the last mail you answered me about Table Formatting (maybe you missed my last question ;). After I used what you told me for nesting FOR loops, I end up getting one blank image (NOT DISPLAYED) whenever I have an odd quantity of objects in my DB... Do I have to store objects in the DB by 2 from now on?
I'm working it for http://www.saavedraart.com <http://www.saavedraart.com/> under the gallery section (only module I have so far). It would be nice if you check it out and tell me your opinion. Same goes for everybody else ;)
Thanks a lot,
<mailto:webmaster
icaam.com.ar> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
attached mail follows:
Glory!
I have a table, with 4 columns. One of the column is ID, a Primary Key, which has Auto_Increment set on it.
Now i have a lot of rows deleted and a lot of duplicate rows that will be deleted, and all sorts of stuff happening in the table.. the result is, that the IDs have become inconsistent.
What you get is something like 5,6,9,10,25,32,33 .. and so on. With many IDs missing etc.
What i want to do is delete the entire IDs and generate them again so that they are in one single order like 1,2,3,4,5... .like this.
And so that any new entry in the table gets the ID accordingly. How can i do this?
Thanks, T. Edison Jr.
__________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com
attached mail follows:
Save all the entries somewhere programmatically, then do DELETE * FROM tablename; re insert all the entries (of course do not enter the ID field, cause it will be auto assigned).
gl,
"Thomas Edison Jr." <thomasedisonjr
yahoo.com> wrote in message
news:20020730060723.4748.qmail
web14107.mail.yahoo.com...
> Glory!
>
> I have a table, with 4 columns. One of the column is
> ID, a Primary Key, which has Auto_Increment set on it.
>
>
> Now i have a lot of rows deleted and a lot of
> duplicate rows that will be deleted, and all sorts of
> stuff happening in the table.. the result is, that the
> IDs have become inconsistent.
>
> What you get is something like
> 5,6,9,10,25,32,33 .. and so on. With many IDs missing
> etc.
>
> What i want to do is delete the entire IDs and
> generate them again so that they are in one single
> order like 1,2,3,4,5... .like this.
>
> And so that any new entry in the table gets the ID
> accordingly. How can i do this?
>
> Thanks,
> T. Edison Jr.
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com
attached mail follows:
> What i want to do is delete the entire IDs and > generate them again so that they are in one single > order like 1,2,3,4,5... .like this.
I suspect that if your table, as you use it, needs this ordering then you've got something wrong. It really shouldn't matter much what the internal IDs are.
When you extract the data you'll be ordering it by some means that may or may not include the ID ie. You might sort by date or some other field in the table, in which case, the ID's are irrelevant - particularly if you're doing a select that excludes some of the data anyway.
If you seriously need all your id's to be sequential and have no gaps then I suspect that about the only way you'll achieve it is probably to drop the contents and enter the information all over again. Of course, then you'll need to do the same again if you delete any information from the table and so on and so on...
There may well be other ways, I've not really looked as I tend to think a reliance of this sort is counter-productive so I've never needed to look.
CYA, Dave
attached mail follows:
> I have a table, with 4 columns. One of the column is > ID, a Primary Key, which has Auto_Increment set on it. > > > Now i have a lot of rows deleted and a lot of > duplicate rows that will be deleted, and all sorts of > stuff happening in the table.. the result is, that the > IDs have become inconsistent. > > What you get is something like > 5,6,9,10,25,32,33 .. and so on. With many IDs missing > etc. > > What i want to do is delete the entire IDs and > generate them again so that they are in one single > order like 1,2,3,4,5... .like this. > > And so that any new entry in the table gets the ID > accordingly. How can i do this?
Who cares if your IDs aren't sequential?? All these IDs are for is to provide a unique identifier for each row. That's it. If the holes are causing a problem in your scripts, then you are using this column incorrectly. My guess is that you'd want to read up on the COUNT() or LIMIT functions in MySQL...
---John Holmes...
attached mail follows:
Glory,
2 Problems with this :
1. I have a PHP/MySQL statement within my PHP Code, which is in the Body part of the page. This generates the Form Fields & Thier Values.. there are a lot of hidden fields who's values are defined by Database Variables..
If i place the FormSubmit()Function in the head, how will those variables pass?
2. I'm already using Target=_Blank ... problem with that is that you cannot control size of window. And that is exactly what i need to do.. define parameters for the window...
Thanks, T. Edison Jr.
--- vins <vins
webonline.co.za> wrote:
> This is JavaScript you need.
>
> one example.
>
> <FORM NAME="Information">
> <INPUT TYPE="text" NAME="TextField" VALUE="Nothing
> Here">
> <INPUT TYPE="submit" NAME="go" VALUE=" Go! "
> onSubmit="FormSubmit()'">
> </FORM>
>
> <SCRIPT LANGUAGE="JavaScript"
> TYPE="JavaScript/Text">
> function FormSubmit()
> {
> var textfield = Information.TextField.value;
> var url = "./processForm.php?textfield=" +
> textfield;
>
> window.open(url);
> }
> </SCRIPT>
>
> OR!!!!
>
> just add this to your form tag.
> TARGET="_blank"
>
>
> "Thomas Edison Jr." <thomasedisonjr
yahoo.com> wrote
> in message
>
news:20020710052418.26086.qmail
web14108.mail.yahoo.com...
> > Glory,
> >
> > > Attach a javascript event to the submit button
> >
> > Something like :
> >
> > <input type="submit" name="go" onSubmit=wow();>
> >
> > Wherein wow() defines a the window.open function?
> >
> > > and also attach the form values to the url.
> > How do i do this? Because the 3 or 4 form fields i
> > have, which are Hidden Fields, contain values
> coming
> > in from $myrow[stuff], that is, coming in from a
> > Database Table. How do i define these values up in
> the
> > Javascript function in the <head> of the file?
> >
> > Thanks,
> > T. Edison Jr.
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Sign up for SBC Yahoo! Dial - First Month Free
> > http://sbc.yahoo.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com
attached mail follows:
Hello,
Can you help me about this problem ?
Thanks,
Edward.
attached mail follows:
Hello,
My system is Red Hat 6.2 system... Now, I'm going to setup WebMail with IMP 3.x ( http://www.horde.org/imp ), so I must install apache, php, MySQL and SSL by sources code packages !
These is my installation steps ( install MySQL by rpm packages ) :
1, cd gettext-0.10.40 ./configure make make check make install
2, cd ../openssl-0.9.6d ./config make make test make install
3, cd ../mod_ssl-2.8.5-1.3.22 ./configure --with-apache=../apache_1.3.22
4, cd ../apache_1.3.22 SSL_BASE=../openssl-0.9.6d \ ./configure --enable-module=most --enable-shared=max \ --enable-module=ssl --enable-shared=ssl \ --disable-module=auth_dbm make make certificate TYPE=custom make install
5, cd ../php-4.2.2 ./configure \ --with-apxs=/usr/local/apache/bin/apxs \ --with-config-file-path=/usr/local/apache/conf \ --enable-versioning --with-imap --with-imap-ssl \ --with-ldap --with-mysql --enable-ftp \ --with-gettext --disable-debug --enable-memory-limit=yes \ --enable-track-vars make make install
cp /usr/local/src/php-4.2.1/php.ini-dist /usr/local/apache/conf/php.ini
Edit /usr/lcoal/apache/conf/httpd.conf :
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
After run /usr/local/apache/bin/apcahectl startssl, the php and https ( SSL ) can't for work :
result of php :
When I access a file via a browser, I get the "Your are downloading the file test.php" dialog box up in my browser.
result of ssl ( https ) :
can not find the page !
So, can you help me ?
Thanks,
Edward.
attached mail follows:
> -----Original Message-----
> From: EdwardSPL
ita.org.mo [mailto:EdwardSPL
ita.org.mo]
> Sent: Tuesday, 30 July 2002 4:17 PM
> To: php-general
lists.php.net
> Subject: [PHP] [Fwd: Can you help me about the installation of
> apache/php/MySQl/ssl ?]
>
>
> Hello,
>
> Can you help me about this problem ?
>
> Thanks,
>
> Edward.
>
think u'll find that php.ini should be in /usr/local/lib dir not apache conf dir
make sure you have the following in httpd.conf
AddModule mod_php4.c LoadModule libexec/libphp4.so
and see if that helps ya
attached mail follows:
On Tuesday 30 July 2002 14:17, EdwardSPL
ita.org.mo wrote:
> Can you help me about this problem ?
Try google.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Before borrowing money from a friend, decide which you need more. -- Addison H. Hallock */
attached mail follows:
Hi all, I do this:
dbconnect(); $query="SELECT * FROM users where username='$PHP_AUTH_USER'"; $result=mysql_query($query); $list=mysql_fetch_array($result); if ($PHP_AUTH_PW !== $list[passwd] || "" == $PHP_AUTH_PW || "all" != $list[domain]){ Header("WWW-authenticate: basic realm=\"EMM\""); Header( "HTTP/1.0 401 Unauthorized"); unauthorized(); exit; } }
Noe this bit: if ($PHP_AUTH_PW !== $list[passwd]
My problem is that the password stored in MySQL was done with password(), so it comes out similar to this as plain text:
072g307j9236a82h3u
How do I Un password() it?
I have RTFM but to no avail.
If you tell me to RTFM again, at least tell me what to search for ;-)
Cheers, Liam
attached mail follows:
Mmm.. think you misinterpreted my question...
http://www.mysql.com/doc/M/i/Miscellaneous_functions.html
PASSWORD(str) how do you unPASSWORD(str) in PHP?
----- Original Message -----
From: "Negrea Mihai" <mike
umft.ro>
To: "Liam MacKenzie" <phplist
operationenigma.com>
Cc: <php-general
lists.php.net>
Sent: Tuesday, July 30, 2002 4:31 PM
Subject: Re: [PHP] MySQL password()
> Try doing on the first time this: > $query="SELECT * FROM users where username='$PHP_AUTH_USER' and passwd > =password($PHP_AUTH_PW)"; > then with mysql_num_rows you find out if the query returned any row.. or with > is_resource() > if it returned then the authentication was successfull.. if not.. not :) > > > On Tuesday 30 July 2002 09:28 am, Liam MacKenzie wrote: > > Hi all, > > I do this: > > > > > > dbconnect(); > > $query="SELECT * FROM users where username='$PHP_AUTH_USER'"; > > $result=mysql_query($query); > > $list=mysql_fetch_array($result); > > if ($PHP_AUTH_PW !== $list[passwd] || "" == $PHP_AUTH_PW || "all" != > > $list[domain]){ > > Header("WWW-authenticate: basic realm=\"EMM\""); > > Header( "HTTP/1.0 401 Unauthorized"); > > unauthorized(); > > exit; > > } > > } > > > > > > > > > > Noe this bit: > > if ($PHP_AUTH_PW !== $list[passwd] > > > > My problem is that the password stored in MySQL was done with password(), > > so it comes out similar to this as plain text: > > > > 072g307j9236a82h3u > > > > > > How do I Un password() it? > > > > I have RTFM but to no avail. > > > > If you tell me to RTFM again, at least tell me what to search for ;-) > > > > Cheers, > > Liam > > -- > Negrea Mihai > web: http://www.negrea.net > > >
attached mail follows:
To my knowledge it isn't possible to "decrypt" the PASSWORD function in MySQL (you need to use MySQL ENCRYPT/DECRYPT for that). However, it's possible to use PASSWORD on the user-provided string too. You could try the following code:
$query="SELECT * FROM users where username='$PHP_AUTH_USER' AND passwd=PASSWORD('$PHP_AUTH_PW');
$result = mysql_query($query) or die("Couldn't execute query!");
if (mysql_num_rows($result) > 0) { // user exists } else { // user don't exist }
Kindly
/lasso (lasso
lassoweb.nu)
Liam Mackenzie wrote: > Hi all, > I do this: > > > dbconnect(); > $query="SELECT * FROM users where username='$PHP_AUTH_USER'"; > $result=mysql_query($query); > $list=mysql_fetch_array($result); > if ($PHP_AUTH_PW !== $list[passwd] || "" == $PHP_AUTH_PW || "all" != > $list[domain]){ > Header("WWW-authenticate: basic realm=\"EMM\""); > Header( "HTTP/1.0 401 Unauthorized"); > unauthorized(); > exit; > } > } > > > > > Noe this bit: > if ($PHP_AUTH_PW !== $list[passwd] > > My problem is that the password stored in MySQL was done with password(), so > it comes out similar to this as plain text: > > 072g307j9236a82h3u > > > How do I Un password() it? > > I have RTFM but to no avail. > > If you tell me to RTFM again, at least tell me what to search for ;-) > > Cheers, > Liam > > >
attached mail follows:
> Mmm.. think you misinterpreted my question... > > > http://www.mysql.com/doc/M/i/Miscellaneous_functions.html > > PASSWORD(str) > how do you unPASSWORD(str) in PHP?
Basically, you don't.
Instead, what you do is use the password that was provided as user input. You create a suitable database query where one of the select criteria is PASSWORD(user_input_password) - then if you get a match they must have entered the right password.
CYA, Dave
attached mail follows:
Well, you can do something like:
SELECT * FROM tablename ORDER BY fieldname [ASC|DESC]
=> [ASC|DESC] optional, put either of theses without the brackets.
//Elias.
"Joel Colombo" <joel
graphicon.nu> wrote in message
news:20020729193451.34304.qmail
pb1.pair.com...
> This is a mysql question, cause i can do it with a natsort in php.
> question is can u do it directly in the MYSQL SELECT ?
> I am wondering if the SELECT statement can have a natural order by.
>
> Table has 5 rows.
> field name "number"
> values :
> 10
> 2
> 15
> 30
> 150
>
> a regular order by "number": generates results 10,15,150,2,30
>
> i need a natural sort....
> 2,10,15,30,150
>
> is there a way to sort FLOAT valuse like this using an order by with a
combo
> of other functions or something ?
>
> Thanks
> Joel
>
>
>
>
>
>
>
>
attached mail follows:
I am not sure what exactly you mean. If you are talking about a regular query then: SELECT tblTable1.hits, tblTable2.hits FROM tblTable1, tblTable2 ORDER BY tblTable1.hits;
If you are talking about combining the two tables so that all your 'hits' are in one column then there are a few ways to skin that cute little kitten (in order of difficulty): 1) Check to see if your databae supports UNION clauses. 2) If not, make a table with the data from the first table then append the data from the second table. Then query for your combined results and delete the table from the database. You may run into problems if more than one person tries to do this at a time, so be careful. 3) Or. create an array using data from the first set then loop through the second set adding the data from the second set. Then sort.
Good luck and keep us posted.
Paul
Georgie Casey wrote:
> i assume this is a simple question... > > how can I SELECT * FROM 2 different tables in the same query, ORDER BYing > the 'hits' column, which both tables have. > > eg, 2 tables i have are similiar and i want to merge them and then select > everything ordering by hits
attached mail follows:
Good morning,
I'm running a OpenLDAP database which includes JPEG photos for some entries. The purpose is to view these images on a web page. Unfortunately I do not have much experience with PHP so any help would be very appreciated.
Thanks in advance, Manuel Vazquez
attached mail follows:
Hi
On Tue, Jul 30, 2002 at 09:00:09AM +0200, Manuel Vazquez wrote: > Good morning, > > I'm running a OpenLDAP database which includes JPEG photos for some entries. > The purpose is to view these images on a web page. Unfortunately I do not > have much experience with PHP so any help would be very appreciated.
The archives should be useful. See
http://marc.theaimsgroup.com/?l=php-dev&m=102495056502016&w=2
for the general idea. For the actual script, have a look at
http://marc.theaimsgroup.com/?l=php-general&m=93635963618041&w=2
Stig
attached mail follows:
We've successfully installed and run PHP 4.0.6. However when we add an extension for win9x printing we get the message "PHP Warning: Unable to load dynamic library 'c:\php\extensions/php_printer.dll' a device attached to the system is not functioning".
The php.ini file has extension_dir=c:\php\extensions and includes the statement extension=php_printer.dll
Any ideas would be most welcome!
Cheers
Peter Williams Analyst Programmer Calvary Health Care Tasmania
attached mail follows:
Hey php-general,
is there some other easyer way to do in one line than this?:
$fullname = $session["f_name"]; $fullname .= " "; $fullname .= $session["l_name"];
P.S the thing is to add line in the middle of the first and last names :)
Thanks
-- Best regards, MantasContacts: Mantuks
attbi.com
attached mail follows:
Is this easier for you?
$fullname = $session["f_name"]." ".$session["l_name"];
----- Original Message -----
From: "Mantas Kriauciunas" <Mantuks
attbi.com>
To: <php-general
lists.php.net>
Sent: 30 July, 2002 7:11 PM
Subject: [PHP] fullname
> Hey php-general,
>
> is there some other easyer way to do in one line than this?:
>
> > $fullname .= " ";
> $fullname .=
>
> P.S the thing is to add line in the middle of the first and last names
> :)
>
> Thanks
> --
> Best regards,
> Mantas
>
> Contacts:
> Mantuks
attbi.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> is there some other easyer way to do in one line than this?: > > $fullname = $session["f_name"]; > $fullname .= " "; > $fullname .= $session["l_name"];
$fullname = $session["f_name"] . " " . $session["l_name"];
CYA, Dave
attached mail follows:
Even more,
$fullname = "{$session['f_name']} {$session['l_name']}";
even....
$fullname = sprintf("%s %s", $session["f_name"], $session['l_name']);
etc....
"Mantas Kriauciunas" <Mantuks
attbi.com> wrote in message
news:16055893108.20020730021116
attbi.com...
> Hey php-general,
>
> is there some other easyer way to do in one line than this?:
>
> $fullname = $session["f_name"];
> $fullname .= " ";
> $fullname .= {$session['l_name']};
>
> P.S the thing is to add line in the middle of the first and last names
> :)
>
> Thanks
> --
> Best regards,
> Mantas
>
> Contacts:
> Mantuks
attbi.com
>
attached mail follows:
on 30/07/02 5:12 PM, Wee Keat (weekeat
amorphosium.com) wrote:
> Is this easier for you? > > $fullname = $session["f_name"]." ".$session["l_name"];
or
$fullname = "{$session['f_name']} {$session['l_name']}";
Justin French
attached mail follows:
Sveix. I guess if the space or any other character is needed between MORE than TWO strings, this is a good construction:
$fullname = join(" ", array($session["f_name"], $session["l_name"],$session["middle_name"], ...));
P.S. I sometimes use this construct for generating sql statements
"Mantas Kriauciunas" <Mantuks
attbi.com> wrote in message
news:16055893108.20020730021116
attbi.com...
> Hey php-general,
>
> is there some other easyer way to do in one line than this?:
>
> $fullname = $session["f_name"];
> $fullname .= " ";
> $fullname .= $session["l_name"];
>
> P.S the thing is to add line in the middle of the first and last names
> :)
>
> Thanks
> --
> Best regards,
> Mantas
>
> Contacts:
> Mantuks
attbi.com
>
attached mail follows:
why would you expect a for loop to know whether there was an array returned from the mysql_fetch_array($result). you haven't told it to check this. This is why I suggested using the fetch_array() to control the loop and a counter to determine when to start and end rows - did you not get that?
Tim Ward www.chessish.com
> -----Original Message-----
> From: César Aracena [mailto:icaam
icaam.com.ar]
> Sent: 29 July 2002 16:39
> To: 'Martin Towell'; php-general
lists.php.net
> Subject: RE: [PHP] Re: Table formatting <-- PARTIALY SOLVED
>
>
> Thnx a lot Martin and all, this worked. Anyway, apart of this being a
> logical solution (I almost kill myself for not thinking it
> before), why
> is that the FOR looping (before using that division operator)
> worked in
> such a strange way? Isn't it supposed to stop looping if
> nothing else is
> fetched from the DB?
>
> Pardon my interest in learning, but this is how I am.
>
> Thanks a lot, C.
>
> > -----Original Message-----
> > From: Martin Towell [mailto:martin.towell
world.net]
> > Sent: Monday, July 29, 2002 2:05 AM
> > To: 'César Aracena'; php-general
lists.php.net
> > Subject: RE: [PHP] Re: Table formatting
> >
> > try changing these two lines
> >
> > $num_rows = mysql_num_rows($result);
> > $num_cols = 2;
> >
> > to this
> >
> > $num_cols = 2;
> > $num_rows = mysql_num_rows($result) / $num_cols;
> >
> > this isn't the full solution, but will help you on your way...
> >
> > HTH
> > Martin
> >
> > -----Original Message-----
> > From: César Aracena [mailto:icaam
icaam.com.ar]
> > Sent: Monday, July 29, 2002 2:03 PM
> > To: php-general
lists.php.net
> > Subject: RE: [PHP] Re: Table formatting
> >
> >
> > I know no one in this list like to think we newbie's want
> the job done
> > for us, so I'm trying to figure out the below question myself, but
> trust
> > me when I say it's making me nuts... this is my best shot so far:
> >
> > $query = "SELECT * FROM saav_arts ORDER BY artid";
> > $result = mysql_query($query) or die(mysql_error());
> > $num_rows = mysql_num_rows($result);
> > $num_cols = 2;
> >
> > for ($x = 0; $x < $num_rows; $x++)
> > {
> > echo "<tr>";
> >
> > for ($i = 0; $i < $num_cols; $i++)
> > {
> >
> > $row = mysql_fetch_array($result);
> > echo "<td align=\"center\">";
> > echo "<a href=\"details.php?artid=".$row[artid]."\"><img
> > src=\"".$CFG->artdir."/".$row[artsmall]."\"
> > ALT=\"".$row[artname]."\" BORDER=\"0\"></a>";
> > echo "</td>";
> > }
> >
> > echo "</tr>";
> > }
> >
> > The thing is that it shows up two columns as I want, but not the 4
> > images that I have in DB... it shows 2 rows of 2 images each and
> antoher
> > 2 rows of 2 *NOT DIPLAYED* images which I don't have... like it was
> > looping again with nothing to fetch from the DB... What is this?
> >
> > Jason: as I wrote this, your tip came over and as you can see I did
> > figure it out (almost melted my brain though)... now, do
> you know what
> > is going on?
> >
> > Thanx, C.
> >
> > > -----Original Message-----
> > > From: César Aracena [mailto:icaam
icaam.com.ar]
> > > Sent: Monday, July 29, 2002 12:27 AM
> > > To: 'Chris Earle'; php-general
lists.php.net
> > > Subject: RE: [PHP] Re: Table formatting
> > >
> > > I like this method a lot. Now, considering I do like FOR
> looping as
> a
> > > fact, how can I make a loop inside another loop. I mean, if I tell
> the
> > > first loop that $i=0 and then do the comparison and then add 1 to
> $i,
> > in
> > > the inner or second loop should I state that $i=$i or what? Also
> make
> > it
> > > $i=0???
> > >
> > > Thanks, C.
> > >
> > > > -----Original Message-----
> > > > From: Chris Earle [mailto:chris
earleweb.com]
> > > > Sent: Saturday, July 27, 2002 1:54 AM
> > > > To: php-general
lists.php.net
> > > > Subject: [PHP] Re: Table formatting
> > > >
> > > > You can do what he said or just put a separate loop inside the
> > > original
> > > > loop.
> > > >
> > > > Depending on how you get the info, you can use either way (his
> would
> > > > create
> > > > less overhead if you are just using the same <TD> info
> every row,
> > > > otherwise
> > > > they're really the same because his way you'll have to create an
> > array
> > > to
> > > > access later for multiple rows, or just do my way and have the
> loop
> > > access
> > > > the NEXT *3* (or whatever) items ...).
> > > >
> > > > i.e.,
> > > > for (LOOP FOR <TR>)
> > > > {
> > > > for (LOOP FOR <TD>) {}
> > > > }
> > > >
> > > > "César aracena" <icaam
icaam.com.ar> wrote in message
> > > > news:001a01c234f0$a5e8ad80$28ed0dd1
gateway...
> > > > Hi all.
> > > >
> > > > Last nite I've came across a problem I wasn't able to figure out
> by
> > my
> > > > self. It's not difficult to make a loop that will make
> new *TABLE
> > > ROWS*
> > > > (<tr>) to show several DB objects in a nice way. what I need to
> do,
> > is
> > > > to display 2 or maybe even 3 of this objects stored in a DB per
> > table
> > > > row, separated in different *TABLE COLUMS* (<td>). how can I
> achieve
> > > > this? What I usually do is:
> > > >
> > > > ------------------------------
> > > > // DB QUERY
> > > > $query = "SELECT * FROM table_name";
> > > > $result = mysql_query($query) or die(mysql_error());
> > > > $num_rows = mysql_num_rows($result);
> > > >
> > > > // NOW THE LOOP
> > > > for ($i=0; $i<$num_rows; $i++)
> > > > {
> > > > $row = mysql_fetch_array($result);
> > > > echo "<tr>";
> > > > echo "<td>";
> > > > echo $row[whatever];
> > > > echo "</td>";
> > > > echo "</tr>";
> > > > }
> > > > ------------------------------
> > > >
> > > > but how can I get 2 or 3 columns displaying different
> db objects?
> A
> > > loop
> > > > inside a loop?
> > > >
> > > > Thanks in advance,
> > > >
> > > > <mailto:webmaster
icaam.com.ar> Cesar Aracena
> > > > CE / MCSE+I
> > > > Neuquen, Argentina
> > > > +54.299.6356688
> > > > +54.299.4466621
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> > --
> > PHP 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:
Well, I have asked a couple of questions on this list, but they havn't really helped alot. Maybe you can help?
My situation background is as follow: I have always written my apps in the following way: register_globals=on, so I allowed PHP to "generate" my variables for me on the action page, and if I cannot use a form to "send" variables to the next pages, I added them manually to the url. So, then I discovered sessions and thought my probelms were solved, only to discover that it uses cookies by default, and has to have the --trans-sid option compiled to have PHP handle the app if you don't want cookies ( like me, don't want cookies at all, or for that matter, anything that relies on the client's side). So, I couldn't just jump in and use sessions as I would not be sure that my app would work on any PHP4 system regardless of the options it was compiled with. ( Oh, I am writing my apps to work with register_globals=off now, so that shouldn't be a problem). So I started to look for a way to code with sessions that will not require cookies nor require any special compile features; the answer came in adding <?=SID?> to all relative URL's in my app. Alas, that is where I'm at, and it's still not working as I would have expected. My problem is with the way my proposed app works/should work.
I am trying to write an app that allows the user to log in, then add/remove projects to his list, then, when a project is selected, he should have access to all the relevan documents in that project, again allowing him to add/remove documents from the project here, and in the last step, when a document is selected, allows hime to add/remove/edit chapters to the document.
My first attempt at using sessions with this failed miserably ( keeping in mind my approach of adding SID at end of urls). I have a "back" link on all the pages that takes the user to the previous step(s) and thus on the last page ( the chpaters edit/remove/add page), there is a link to go back one level, two and three levels. Yet, using these causes unexpected results. I think the problem comes in with overriding the value of the session variable. For instance, on the first page you have a login form, on the action page I session_register("username","password"), and that works fine even when using the back buttons as the values are never changed. But, on the 2nd page I have the drop down select containing all the project names ( gets built with a while that reads all the project names from the project_table) and send over the project_id. On that actio page, I session_register("project_id"); and it also works fine for all pages "down stream", however, when I come back to that page to select a new project, it keeps the old variable... At first I did nothing special in the sence of assigning a value to the session variables, as I let the register_globals=on do it's trick, but later I explicitly said $project_id = $HTTP_POST_VARS["project_id"];
But that also did not overwrite the value of the session var. In the end I was forced to again add all my variables to the end of the url, keeping the session solely for the username and password.
I don't know if you would like me to post my code ( it is quite a bit already ) but I would really appreciate it if someone could look at it, and then point out where I'm missing the picture, as then I would have two pictures that I can compare and see where my reasoning failed.
Thanks for your time.
Rasmus Lerdorf wrote:
>What issues? Just ask. > >-Rasmus > >On Mon, 29 Jul 2002, Petre wrote: > >>What are good books/websites about sessions. >>I'm looking for more advanced stuff, I have the Luke Welling/Laura >>Tompson book, and have read the manual, but I still have issues that are >>unresolved. >> >>Thanks >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >
attached mail follows:
Well, how exactly do you implement the back button? If it is a normal client-side back, then of course the previous value will be shown. If it is actually a forward-link to the previous page, then your logic on that target page is bogus.
By the way, trans-sid is compiled in by default in PHP so should always be available. And it will fallback to sid mangling only if cookies are disabled. You would probably be better off just letting php manage this for you.
-Rasmus
On Tue, 30 Jul 2002, Petre wrote:
> Well, I have asked a couple of questions on this list, but they havn't > really helped alot. Maybe you can help? > > My situation background is as follow: > I have always written my apps in the following way: register_globals=on, > so I allowed PHP to "generate" my variables for me on the action page, > and if I cannot use a form to "send" variables to the next pages, I > added them manually to the url. > So, then I discovered sessions and thought my probelms were solved, only > to discover that it uses cookies by default, and has to have the > --trans-sid option compiled to have PHP handle the app if you don't want > cookies ( like me, don't want cookies at all, or for that matter, > anything that relies on the client's side). So, I couldn't just jump in > and use sessions as I would not be sure that my app would work on any > PHP4 system regardless of the options it was compiled with. ( Oh, I am > writing my apps to work with register_globals=off now, so that shouldn't > be a problem). > So I started to look for a way to code with sessions that will not > require cookies nor require any special compile features; the answer > came in adding <?=SID?> to all relative URL's in my app. > Alas, that is where I'm at, and it's still not working as I would have > expected. > My problem is with the way my proposed app works/should work. > > I am trying to write an app that allows the user to log in, then > add/remove projects to his list, then, when a project is selected, he > should have access to all the relevan documents in that project, again > allowing him to add/remove documents from the project here, and in the > last step, when a document is selected, allows hime to add/remove/edit > chapters to the document. > > My first attempt at using sessions with this failed miserably ( keeping > in mind my approach of adding SID at end of urls). I have a "back" link > on all the pages that takes the user to the previous step(s) and thus > on the last page ( the chpaters edit/remove/add page), there is a link > to go back one level, two and three levels. Yet, using these causes > unexpected results. > I think the problem comes in with overriding the value of the session > variable. > For instance, on the first page you have a login form, on the action > page I session_register("username","password"), and that works fine even > when using the back buttons as the values are never changed. But, on the > 2nd page I have the drop down select containing all the project names ( > gets built with a while that reads all the project names from the > project_table) and send over the project_id. > On that actio page, I session_register("project_id"); and it also works > fine for all pages "down stream", however, when I come back to that page > to select a new project, it keeps the old variable... > At first I did nothing special in the sence of assigning a value to the > session variables, as I let the register_globals=on do it's trick, but > later I explicitly said > $project_id = $HTTP_POST_VARS["project_id"]; > > But that also did not overwrite the value of the session var. In the end > I was forced to again add all my variables to the end of the url, > keeping the session solely for the username and password. > > I don't know if you would like me to post my code ( it is quite a bit > already ) but I would really appreciate it if someone could look at it, > and then point out where I'm missing the picture, as then I would have > two pictures that I can compare and see where my reasoning failed. > > Thanks for your time. > > > Rasmus Lerdorf wrote: > > >What issues? Just ask. > > > >-Rasmus > > > >On Mon, 29 Jul 2002, Petre wrote: > > > >>What are good books/websites about sessions. > >>I'm looking for more advanced stuff, I have the Luke Welling/Laura > >>Tompson book, and have read the manual, but I still have issues that are > >>unresolved. > >> > >>Thanks > >> > >> > >> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > > > >
attached mail follows:
Yes, it is a forward link to the page, but as mentioned, that page contains a form with the selection options, and on that form's action page is where I don't see the values change, so the question should probably be something like "how do I change the value in the session_var with the newly selected value? And oh, I almost forgot: Due to that fact that this type of app doesn't really have a logical end page, I cannot issue a session_destroy() anywhere logically ( except using a logout button), but that's not going to ensure that people use it... I would ideally like to have this "app" run on an intranet, where people will most probably have this app open indefinately, and thus I also battle with my logic of keeping a session alive.
Thanks .
Rasmus Lerdorf wrote:
>Well, how exactly do you implement the back button? If it is a normal >client-side back, then of course the previous value will be shown. If it >is actually a forward-link to the previous page, then your logic on that >target page is bogus. > >By the way, trans-sid is compiled in by default in PHP so should always be >available. And it will fallback to sid mangling only if cookies are >disabled. You would probably be better off just letting php manage this >for you. > >-Rasmus > >On Tue, 30 Jul 2002, Petre wrote: > >>Well, I have asked a couple of questions on this list, but they havn't >>really helped alot. Maybe you can help? >> >>My situation background is as follow: >>I have always written my apps in the following way: register_globals=on, >>so I allowed PHP to "generate" my variables for me on the action page, >>and if I cannot use a form to "send" variables to the next pages, I >>added them manually to the url. >>So, then I discovered sessions and thought my probelms were solved, only >>to discover that it uses cookies by default, and has to have the >>--trans-sid option compiled to have PHP handle the app if you don't want >>cookies ( like me, don't want cookies at all, or for that matter, >>anything that relies on the client's side). So, I couldn't just jump in >>and use sessions as I would not be sure that my app would work on any >>PHP4 system regardless of the options it was compiled with. ( Oh, I am >>writing my apps to work with register_globals=off now, so that shouldn't >>be a problem). >>So I started to look for a way to code with sessions that will not >>require cookies nor require any special compile features; the answer >>came in adding <?=SID?> to all relative URL's in my app. >>Alas, that is where I'm at, and it's still not working as I would have >>expected. >>My problem is with the way my proposed app works/should work. >> >>I am trying to write an app that allows the user to log in, then >>add/remove projects to his list, then, when a project is selected, he >>should have access to all the relevan documents in that project, again >>allowing him to add/remove documents from the project here, and in the >>last step, when a document is selected, allows hime to add/remove/edit >>chapters to the document. >> >>My first attempt at using sessions with this failed miserably ( keeping >>in mind my approach of adding SID at end of urls). I have a "back" link >>on all the pages that takes the user to the previous step(s) and thus >>on the last page ( the chpaters edit/remove/add page), there is a link >>to go back one level, two and three levels. Yet, using these causes >>unexpected results. >>I think the problem comes in with overriding the value of the session >>variable. >>For instance, on the first page you have a login form, on the action >>page I session_register("username","password"), and that works fine even >>when using the back buttons as the values are never changed. But, on the >>2nd page I have the drop down select containing all the project names ( >>gets built with a while that reads all the project names from the >>project_table) and send over the project_id. >>On that actio page, I session_register("project_id"); and it also works >>fine for all pages "down stream", however, when I come back to that page >>to select a new project, it keeps the old variable... >>At first I did nothing special in the sence of assigning a value to the >>session variables, as I let the register_globals=on do it's trick, but >>later I explicitly said >>$project_id = $HTTP_POST_VARS["project_id"]; >> >>But that also did not overwrite the value of the session var. In the end >>I was forced to again add all my variables to the end of the url, >>keeping the session solely for the username and password. >> >>I don't know if you would like me to post my code ( it is quite a bit >>already ) but I would really appreciate it if someone could look at it, >>and then point out where I'm missing the picture, as then I would have >>two pictures that I can compare and see where my reasoning failed. >> >>Thanks for your time. >> >> >>Rasmus Lerdorf wrote: >> >>>What issues? Just ask. >>> >>>-Rasmus >>> >>>On Mon, 29 Jul 2002, Petre wrote: >>> >>>>What are good books/websites about sessions. >>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>Tompson book, and have read the manual, but I still have issues that are >>>>unresolved. >>>> >>>>Thanks >>>> >>>> >>>> >>>>-- >>>>PHP General Mailing List (http://www.php.net/) >>>>To unsubscribe, visit: http://www.php.net/unsub.php >>>> >> >
attached mail follows:
The trick is to not name your form vars the same as your session vars. Keep them separate so you have full control of what ends up where. Also, note that if you are not relying on trans_sid or cookies then don't use SID. Call session_id() explicitly to get the session id. So, a quick little mockup to illustrate this.
login.php: <? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('username'); $username = 'petre'; ?> <a href="page1.php?<?=$sid?>">Next Page</a>
page1.php: <? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); ?> <form action="page2.php?<?=$sid?>" method="POST"> <input type="text" name="form_foo" value="<?=$_SESSION['foo']?>"> </form>
page2.php: <? ini_set('session.use_cookies',false); ini_set('session.use_trans_sid',false); session_start(); $sid = session_name().'='.session_id(); session_register('foo'); $foo = $_POST['form_foo']; echo "You entered $foo<br />\n"; ?> <a href="page1.php?<?=$sid?>">Back</a>
I am ini_setting on each page to force PHP to not do trans-sid/cookies. Would be easier to simply turn these off in the php.ini file.
When you hit the back link, $_SESSION['foo'] will exist on page1.php and the form will get filled in with the previous value. You can then change it, hit enter again and the session value will take on the new submitted value because I have decoupled the form data from the session data and I set the session var in page2.php.
There are other ways to do this, but this is probably the easiest method to understand. Play with this simple example until you understand how it works.
But again, I'd suggest letting PHP do session id handling for you by letting it default to cookies and fall back to url mangling in the few cases where cookies are turned off.
-Rasmus
On Tue, 30 Jul 2002, Petre wrote:
> Yes, it is a forward link to the page, but as mentioned, that page > contains a form with the selection options, and on that form's action > page is where I don't see the values change, so the question should > probably be something like "how do I change the value in the session_var > with the newly selected value? > And oh, I almost forgot: > Due to that fact that this type of app doesn't really have a logical end > page, I cannot issue a session_destroy() anywhere logically ( except > using a logout button), but that's not going to ensure that people use it... > I would ideally like to have this "app" run on an intranet, where people > will most probably have this app open indefinately, and thus I also > battle with my logic of keeping a session alive. > > Thanks > . > > Rasmus Lerdorf wrote: > > >Well, how exactly do you implement the back button? If it is a normal > >client-side back, then of course the previous value will be shown. If it > >is actually a forward-link to the previous page, then your logic on that > >target page is bogus. > > > >By the way, trans-sid is compiled in by default in PHP so should always be > >available. And it will fallback to sid mangling only if cookies are > >disabled. You would probably be better off just letting php manage this > >for you. > > > >-Rasmus > > > >On Tue, 30 Jul 2002, Petre wrote: > > > >>Well, I have asked a couple of questions on this list, but they havn't > >>really helped alot. Maybe you can help? > >> > >>My situation background is as follow: > >>I have always written my apps in the following way: register_globals=on, > >>so I allowed PHP to "generate" my variables for me on the action page, > >>and if I cannot use a form to "send" variables to the next pages, I > >>added them manually to the url. > >>So, then I discovered sessions and thought my probelms were solved, only > >>to discover that it uses cookies by default, and has to have the > >>--trans-sid option compiled to have PHP handle the app if you don't want > >>cookies ( like me, don't want cookies at all, or for that matter, > >>anything that relies on the client's side). So, I couldn't just jump in > >>and use sessions as I would not be sure that my app would work on any > >>PHP4 system regardless of the options it was compiled with. ( Oh, I am > >>writing my apps to work with register_globals=off now, so that shouldn't > >>be a problem). > >>So I started to look for a way to code with sessions that will not > >>require cookies nor require any special compile features; the answer > >>came in adding <?=SID?> to all relative URL's in my app. > >>Alas, that is where I'm at, and it's still not working as I would have > >>expected. > >>My problem is with the way my proposed app works/should work. > >> > >>I am trying to write an app that allows the user to log in, then > >>add/remove projects to his list, then, when a project is selected, he > >>should have access to all the relevan documents in that project, again > >>allowing him to add/remove documents from the project here, and in the > >>last step, when a document is selected, allows hime to add/remove/edit > >>chapters to the document. > >> > >>My first attempt at using sessions with this failed miserably ( keeping > >>in mind my approach of adding SID at end of urls). I have a "back" link > >>on all the pages that takes the user to the previous step(s) and thus > >>on the last page ( the chpaters edit/remove/add page), there is a link > >>to go back one level, two and three levels. Yet, using these causes > >>unexpected results. > >>I think the problem comes in with overriding the value of the session > >>variable. > >>For instance, on the first page you have a login form, on the action > >>page I session_register("username","password"), and that works fine even > >>when using the back buttons as the values are never changed. But, on the > >>2nd page I have the drop down select containing all the project names ( > >>gets built with a while that reads all the project names from the > >>project_table) and send over the project_id. > >>On that actio page, I session_register("project_id"); and it also works > >>fine for all pages "down stream", however, when I come back to that page > >>to select a new project, it keeps the old variable... > >>At first I did nothing special in the sence of assigning a value to the > >>session variables, as I let the register_globals=on do it's trick, but > >>later I explicitly said > >>$project_id = $HTTP_POST_VARS["project_id"]; > >> > >>But that also did not overwrite the value of the session var. In the end > >>I was forced to again add all my variables to the end of the url, > >>keeping the session solely for the username and password. > >> > >>I don't know if you would like me to post my code ( it is quite a bit > >>already ) but I would really appreciate it if someone could look at it, > >>and then point out where I'm missing the picture, as then I would have > >>two pictures that I can compare and see where my reasoning failed. > >> > >>Thanks for your time. > >> > >> > >>Rasmus Lerdorf wrote: > >> > >>>What issues? Just ask. > >>> > >>>-Rasmus > >>> > >>>On Mon, 29 Jul 2002, Petre wrote: > >>> > >>>>What are good books/websites about sessions. > >>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura > >>>>Tompson book, and have read the manual, but I still have issues that are > >>>>unresolved. > >>>> > >>>>Thanks > >>>> > >>>> > >>>> > >>>>-- > >>>>PHP General Mailing List (http://www.php.net/) > >>>>To unsubscribe, visit: http://www.php.net/unsub.php > >>>> > >> > > > >
attached mail follows:
Thanks, will work through this immediately. Just to be clear. If I DO stick with your suggestion of letting PHP do the url mangling, and taking your code below, I can simply remove the
ini_set('session.use_trans_sid',false); and <?=$sid?> from your code to make it work exactly as is?
Thanks
Rasmus Lerdorf wrote:
>The trick is to not name your form vars the same as your session vars. >Keep them separate so you have full control of what ends up where. Also, >note that if you are not relying on trans_sid or cookies then don't use >SID. Call session_id() explicitly to get the session id. So, a quick >little mockup to illustrate this. > >login.php: ><? >ini_set('session.use_cookies',false); >ini_set('session.use_trans_sid',false); >session_start(); >$sid = session_name().'='.session_id(); >session_register('username'); >$username = 'petre'; >?> ><a href="page1.php?<?=$sid?>">Next Page</a> > >page1.php: ><? >ini_set('session.use_cookies',false); >ini_set('session.use_trans_sid',false); >session_start(); >$sid = session_name().'='.session_id(); >?> ><form action="page2.php?<?=$sid?>" method="POST"> ><input type="text" name="form_foo" value="<?=$_SESSION['foo']?>"> ></form> > >page2.php: ><? >ini_set('session.use_cookies',false); >ini_set('session.use_trans_sid',false); >session_start(); >$sid = session_name().'='.session_id(); >session_register('foo'); >$foo = $_POST['form_foo']; >echo "You entered $foo<br />\n"; >?> ><a href="page1.php?<?=$sid?>">Back</a> > > >I am ini_setting on each page to force PHP to not do trans-sid/cookies. >Would be easier to simply turn these off in the php.ini file. > >When you hit the back link, $_SESSION['foo'] will exist on page1.php and >the form will get filled in with the previous value. You can then change >it, hit enter again and the session value will take on the new submitted >value because I have decoupled the form data from the session data and I >set the session var in page2.php. > >There are other ways to do this, but this is probably the easiest method >to understand. Play with this simple example until you understand how it >works. > >But again, I'd suggest letting PHP do session id handling for you by >letting it default to cookies and fall back to url mangling in the few >cases where cookies are turned off. > >-Rasmus > >On Tue, 30 Jul 2002, Petre wrote: > >>Yes, it is a forward link to the page, but as mentioned, that page >>contains a form with the selection options, and on that form's action >>page is where I don't see the values change, so the question should >>probably be something like "how do I change the value in the session_var >>with the newly selected value? >>And oh, I almost forgot: >>Due to that fact that this type of app doesn't really have a logical end >>page, I cannot issue a session_destroy() anywhere logically ( except >>using a logout button), but that's not going to ensure that people use it... >>I would ideally like to have this "app" run on an intranet, where people >>will most probably have this app open indefinately, and thus I also >>battle with my logic of keeping a session alive. >> >>Thanks >>. >> >>Rasmus Lerdorf wrote: >> >>>Well, how exactly do you implement the back button? If it is a normal >>>client-side back, then of course the previous value will be shown. If it >>>is actually a forward-link to the previous page, then your logic on that >>>target page is bogus. >>> >>>By the way, trans-sid is compiled in by default in PHP so should always be >>>available. And it will fallback to sid mangling only if cookies are >>>disabled. You would probably be better off just letting php manage this >>>for you. >>> >>>-Rasmus >>> >>>On Tue, 30 Jul 2002, Petre wrote: >>> >>>>Well, I have asked a couple of questions on this list, but they havn't >>>>really helped alot. Maybe you can help? >>>> >>>>My situation background is as follow: >>>>I have always written my apps in the following way: register_globals=on, >>>>so I allowed PHP to "generate" my variables for me on the action page, >>>>and if I cannot use a form to "send" variables to the next pages, I >>>>added them manually to the url. >>>>So, then I discovered sessions and thought my probelms were solved, only >>>>to discover that it uses cookies by default, and has to have the >>>>--trans-sid option compiled to have PHP handle the app if you don't want >>>>cookies ( like me, don't want cookies at all, or for that matter, >>>>anything that relies on the client's side). So, I couldn't just jump in >>>>and use sessions as I would not be sure that my app would work on any >>>>PHP4 system regardless of the options it was compiled with. ( Oh, I am >>>>writing my apps to work with register_globals=off now, so that shouldn't >>>>be a problem). >>>>So I started to look for a way to code with sessions that will not >>>>require cookies nor require any special compile features; the answer >>>>came in adding <?=SID?> to all relative URL's in my app. >>>>Alas, that is where I'm at, and it's still not working as I would have >>>>expected. >>>>My problem is with the way my proposed app works/should work. >>>> >>>>I am trying to write an app that allows the user to log in, then >>>>add/remove projects to his list, then, when a project is selected, he >>>>should have access to all the relevan documents in that project, again >>>>allowing him to add/remove documents from the project here, and in the >>>>last step, when a document is selected, allows hime to add/remove/edit >>>>chapters to the document. >>>> >>>>My first attempt at using sessions with this failed miserably ( keeping >>>>in mind my approach of adding SID at end of urls). I have a "back" link >>>>on all the pages that takes the user to the previous step(s) and thus >>>>on the last page ( the chpaters edit/remove/add page), there is a link >>>>to go back one level, two and three levels. Yet, using these causes >>>>unexpected results. >>>>I think the problem comes in with overriding the value of the session >>>>variable. >>>>For instance, on the first page you have a login form, on the action >>>>page I session_register("username","password"), and that works fine even >>>>when using the back buttons as the values are never changed. But, on the >>>>2nd page I have the drop down select containing all the project names ( >>>>gets built with a while that reads all the project names from the >>>>project_table) and send over the project_id. >>>>On that actio page, I session_register("project_id"); and it also works >>>>fine for all pages "down stream", however, when I come back to that page >>>>to select a new project, it keeps the old variable... >>>>At first I did nothing special in the sence of assigning a value to the >>>>session variables, as I let the register_globals=on do it's trick, but >>>>later I explicitly said >>>>$project_id = $HTTP_POST_VARS["project_id"]; >>>> >>>>But that also did not overwrite the value of the session var. In the end >>>>I was forced to again add all my variables to the end of the url, >>>>keeping the session solely for the username and password. >>>> >>>>I don't know if you would like me to post my code ( it is quite a bit >>>>already ) but I would really appreciate it if someone could look at it, >>>>and then point out where I'm missing the picture, as then I would have >>>>two pictures that I can compare and see where my reasoning failed. >>>> >>>>Thanks for your time. >>>> >>>> >>>>Rasmus Lerdorf wrote: >>>> >>>>>What issues? Just ask. >>>>> >>>>>-Rasmus >>>>> >>>>>On Mon, 29 Jul 2002, Petre wrote: >>>>> >>>>>>What are good books/websites about sessions. >>>>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>>>Tompson book, and have read the manual, but I still have issues that are >>>>>>unresolved. >>>>>> >>>>>>Thanks >>>>>> >>>>>> >>>>>> >>>>>>-- >>>>>>PHP General Mailing List (http://www.php.net/) >>>>>>To unsubscribe, visit: http://www.php.net/unsub.php >>>>>> >> >
attached mail follows:
Yup, get rid of both ini_set() calls and take out the $sid=... and <?=$sid?> stuff and it should simply work.
On Tue, 30 Jul 2002, Petre wrote:
> Thanks, will work through this immediately. > Just to be clear. > If I DO stick with your suggestion of letting PHP do the url mangling, > and taking your code below, I can simply remove the > > ini_set('session.use_trans_sid',false); and <?=$sid?> from your code to make it work exactly as is? > > Thanks > > > > Rasmus Lerdorf wrote: > > >The trick is to not name your form vars the same as your session vars. > >Keep them separate so you have full control of what ends up where. Also, > >note that if you are not relying on trans_sid or cookies then don't use > >SID. Call session_id() explicitly to get the session id. So, a quick > >little mockup to illustrate this. > > > >login.php: > ><? > >ini_set('session.use_cookies',false); > >ini_set('session.use_trans_sid',false); > >session_start(); > >$sid = session_name().'='.session_id(); > >session_register('username'); > >$username = 'petre'; > >?> > ><a href="page1.php?<?=$sid?>">Next Page</a> > > > >page1.php: > ><? > >ini_set('session.use_cookies',false); > >ini_set('session.use_trans_sid',false); > >session_start(); > >$sid = session_name().'='.session_id(); > >?> > ><form action="page2.php?<?=$sid?>" method="POST"> > ><input type="text" name="form_foo" value="<?=$_SESSION['foo']?>"> > ></form> > > > >page2.php: > ><? > >ini_set('session.use_cookies',false); > >ini_set('session.use_trans_sid',false); > >session_start(); > >$sid = session_name().'='.session_id(); > >session_register('foo'); > >$foo = $_POST['form_foo']; > >echo "You entered $foo<br />\n"; > >?> > ><a href="page1.php?<?=$sid?>">Back</a> > > > > > >I am ini_setting on each page to force PHP to not do trans-sid/cookies. > >Would be easier to simply turn these off in the php.ini file. > > > >When you hit the back link, $_SESSION['foo'] will exist on page1.php and > >the form will get filled in with the previous value. You can then change > >it, hit enter again and the session value will take on the new submitted > >value because I have decoupled the form data from the session data and I > >set the session var in page2.php. > > > >There are other ways to do this, but this is probably the easiest method > >to understand. Play with this simple example until you understand how it > >works. > > > >But again, I'd suggest letting PHP do session id handling for you by > >letting it default to cookies and fall back to url mangling in the few > >cases where cookies are turned off. > > > >-Rasmus > > > >On Tue, 30 Jul 2002, Petre wrote: > > > >>Yes, it is a forward link to the page, but as mentioned, that page > >>contains a form with the selection options, and on that form's action > >>page is where I don't see the values change, so the question should > >>probably be something like "how do I change the value in the session_var > >>with the newly selected value? > >>And oh, I almost forgot: > >>Due to that fact that this type of app doesn't really have a logical end > >>page, I cannot issue a session_destroy() anywhere logically ( except > >>using a logout button), but that's not going to ensure that people use it... > >>I would ideally like to have this "app" run on an intranet, where people > >>will most probably have this app open indefinately, and thus I also > >>battle with my logic of keeping a session alive. > >> > >>Thanks > >>. > >> > >>Rasmus Lerdorf wrote: > >> > >>>Well, how exactly do you implement the back button? If it is a normal > >>>client-side back, then of course the previous value will be shown. If it > >>>is actually a forward-link to the previous page, then your logic on that > >>>target page is bogus. > >>> > >>>By the way, trans-sid is compiled in by default in PHP so should always be > >>>available. And it will fallback to sid mangling only if cookies are > >>>disabled. You would probably be better off just letting php manage this > >>>for you. > >>> > >>>-Rasmus > >>> > >>>On Tue, 30 Jul 2002, Petre wrote: > >>> > >>>>Well, I have asked a couple of questions on this list, but they havn't > >>>>really helped alot. Maybe you can help? > >>>> > >>>>My situation background is as follow: > >>>>I have always written my apps in the following way: register_globals=on, > >>>>so I allowed PHP to "generate" my variables for me on the action page, > >>>>and if I cannot use a form to "send" variables to the next pages, I > >>>>added them manually to the url. > >>>>So, then I discovered sessions and thought my probelms were solved, only > >>>>to discover that it uses cookies by default, and has to have the > >>>>--trans-sid option compiled to have PHP handle the app if you don't want > >>>>cookies ( like me, don't want cookies at all, or for that matter, > >>>>anything that relies on the client's side). So, I couldn't just jump in > >>>>and use sessions as I would not be sure that my app would work on any > >>>>PHP4 system regardless of the options it was compiled with. ( Oh, I am > >>>>writing my apps to work with register_globals=off now, so that shouldn't > >>>>be a problem). > >>>>So I started to look for a way to code with sessions that will not > >>>>require cookies nor require any special compile features; the answer > >>>>came in adding <?=SID?> to all relative URL's in my app. > >>>>Alas, that is where I'm at, and it's still not working as I would have > >>>>expected. > >>>>My problem is with the way my proposed app works/should work. > >>>> > >>>>I am trying to write an app that allows the user to log in, then > >>>>add/remove projects to his list, then, when a project is selected, he > >>>>should have access to all the relevan documents in that project, again > >>>>allowing him to add/remove documents from the project here, and in the > >>>>last step, when a document is selected, allows hime to add/remove/edit > >>>>chapters to the document. > >>>> > >>>>My first attempt at using sessions with this failed miserably ( keeping > >>>>in mind my approach of adding SID at end of urls). I have a "back" link > >>>>on all the pages that takes the user to the previous step(s) and thus > >>>>on the last page ( the chpaters edit/remove/add page), there is a link > >>>>to go back one level, two and three levels. Yet, using these causes > >>>>unexpected results. > >>>>I think the problem comes in with overriding the value of the session > >>>>variable. > >>>>For instance, on the first page you have a login form, on the action > >>>>page I session_register("username","password"), and that works fine even > >>>>when using the back buttons as the values are never changed. But, on the > >>>>2nd page I have the drop down select containing all the project names ( > >>>>gets built with a while that reads all the project names from the > >>>>project_table) and send over the project_id. > >>>>On that actio page, I session_register("project_id"); and it also works > >>>>fine for all pages "down stream", however, when I come back to that page > >>>>to select a new project, it keeps the old variable... > >>>>At first I did nothing special in the sence of assigning a value to the > >>>>session variables, as I let the register_globals=on do it's trick, but > >>>>later I explicitly said > >>>>$project_id = $HTTP_POST_VARS["project_id"]; > >>>> > >>>>But that also did not overwrite the value of the session var. In the end > >>>>I was forced to again add all my variables to the end of the url, > >>>>keeping the session solely for the username and password. > >>>> > >>>>I don't know if you would like me to post my code ( it is quite a bit > >>>>already ) but I would really appreciate it if someone could look at it, > >>>>and then point out where I'm missing the picture, as then I would have > >>>>two pictures that I can compare and see where my reasoning failed. > >>>> > >>>>Thanks for your time. > >>>> > >>>> > >>>>Rasmus Lerdorf wrote: > >>>> > >>>>>What issues? Just ask. > >>>>> > >>>>>-Rasmus > >>>>> > >>>>>On Mon, 29 Jul 2002, Petre wrote: > >>>>> > >>>>>>What are good books/websites about sessions. > >>>>>>I'm looking for more advanced stuff, I have the Luke Welling/Laura > >>>>>>Tompson book, and have read the manual, but I still have issues that are > >>>>>>unresolved. > >>>>>> > >>>>>>Thanks > >>>>>> > >>>>>> > >>>>>> > >>>>>>-- > >>>>>>PHP General Mailing List (http://www.php.net/) > >>>>>>To unsubscribe, visit: http://www.php.net/unsub.php > >>>>>> > >> > > > >
attached mail follows:
*shakes head a bit*
I'm not REALLY sure what the problem is here, but let's take a step back.
A session ID is a unique, random number assigned to a user as they kick around your site.
To maintain state (a session) across multiple pages, you pass the session id around. This can be done with the URL or cookies. Yes, trans_sid is in there as well, but all it does is re-write URLs.
No surprises so far.
You then assign variables to the session. If you're using PHP >= 4.1, I'd use $_SESSION['varname'] = "value"; rather than session_register(), because it's a lot more logical, and clearer to think through.
Furthermore, the manual tells us NOT to mix use of session_register('var') and $_SESSION['var'] = 'value'... so, pick a method, and stick to it... since the $_SESSION array is the new way, I'd be going with it.
So, the first two session vars YOU assign after the user logs in is the username and password (I wouldn't register the password).
$_SESSION['username'] = "justin"; $_SESSION['password'] = "secret";
Then a few pages later, they pick an option from a pull-down list, and you assign another variable to the session:
$_SESSION['project_id'] = "45";
The user clicks through a few more pages, and later wants to work on a different project, so you link them through (forward) to the options page.
They select a new project from the pull down, so you need to overwrite the old project_id session var with a new one:
$_SESSION['project_id'] = "74";
Now, when they kick around through pages, they will be doing it under project_id 74.
If you wanted to delete the project_id all together (no project), you could use unset().
Now, go back, and have a look at your code, check out the logic, and I'm sure you'll see the mistake(s).
As far as the "maintaining session forever" thing, I'd highly recommend it... it's highly insecure (walk away from your computer, someone else has access to everything)... besides, sessions are a temporary thing by nature, with garbage cleanouts, etc etc.
If you really wanted to maintain state 'forever', you would have to set a cookie with the username and password to that person's computer, hence your website would 'remember them' all the time.
Of course there are plenty of reasons why your shouldn't do this. I guess the client should be informed of the options here:
1. log in every so-often as needed (if there is lots of activity, the session probably won't die all day anyway), and have heaps more security
2. log in once only, and have the whole system wide-open forever
I'd pick 1 over 2 anytime.
I'd also provide a logout button with either system, so that people CHOOSE TO DESTROY THEIR SESSION. Personally, I log-out when I leave my desk, just in case.
Imagine if you left a session open which disclosed everyone's pay rates in an office... not good for your career at all :)
Hope this all helps,
Justin French
on 30/07/02 6:04 PM, Petre (internet
vsa.co.za) wrote:
> Yes, it is a forward link to the page, but as mentioned, that page > contains a form with the selection options, and on that form's action > page is where I don't see the values change, so the question should > probably be something like "how do I change the value in the session_var > with the newly selected value? > And oh, I almost forgot: > Due to that fact that this type of app doesn't really have a logical end > page, I cannot issue a session_destroy() anywhere logically ( except > using a logout button), but that's not going to ensure that people use it... > I would ideally like to have this "app" run on an intranet, where people > will most probably have this app open indefinately, and thus I also > battle with my logic of keeping a session alive. > > Thanks > . > > Rasmus Lerdorf wrote: > >> Well, how exactly do you implement the back button? If it is a normal >> client-side back, then of course the previous value will be shown. If it >> is actually a forward-link to the previous page, then your logic on that >> target page is bogus. >> >> By the way, trans-sid is compiled in by default in PHP so should always be >> available. And it will fallback to sid mangling only if cookies are >> disabled. You would probably be better off just letting php manage this >> for you. >> >> -Rasmus >> >> On Tue, 30 Jul 2002, Petre wrote: >> >>> Well, I have asked a couple of questions on this list, but they havn't >>> really helped alot. Maybe you can help? >>> >>> My situation background is as follow: >>> I have always written my apps in the following way: register_globals=on, >>> so I allowed PHP to "generate" my variables for me on the action page, >>> and if I cannot use a form to "send" variables to the next pages, I >>> added them manually to the url. >>> So, then I discovered sessions and thought my probelms were solved, only >>> to discover that it uses cookies by default, and has to have the >>> --trans-sid option compiled to have PHP handle the app if you don't want >>> cookies ( like me, don't want cookies at all, or for that matter, >>> anything that relies on the client's side). So, I couldn't just jump in >>> and use sessions as I would not be sure that my app would work on any >>> PHP4 system regardless of the options it was compiled with. ( Oh, I am >>> writing my apps to work with register_globals=off now, so that shouldn't >>> be a problem). >>> So I started to look for a way to code with sessions that will not >>> require cookies nor require any special compile features; the answer >>> came in adding <?=SID?> to all relative URL's in my app. >>> Alas, that is where I'm at, and it's still not working as I would have >>> expected. >>> My problem is with the way my proposed app works/should work. >>> >>> I am trying to write an app that allows the user to log in, then >>> add/remove projects to his list, then, when a project is selected, he >>> should have access to all the relevan documents in that project, again >>> allowing him to add/remove documents from the project here, and in the >>> last step, when a document is selected, allows hime to add/remove/edit >>> chapters to the document. >>> >>> My first attempt at using sessions with this failed miserably ( keeping >>> in mind my approach of adding SID at end of urls). I have a "back" link >>> on all the pages that takes the user to the previous step(s) and thus >>> on the last page ( the chpaters edit/remove/add page), there is a link >>> to go back one level, two and three levels. Yet, using these causes >>> unexpected results. >>> I think the problem comes in with overriding the value of the session >>> variable. >>> For instance, on the first page you have a login form, on the action >>> page I session_register("username","password"), and that works fine even >>> when using the back buttons as the values are never changed. But, on the >>> 2nd page I have the drop down select containing all the project names ( >>> gets built with a while that reads all the project names from the >>> project_table) and send over the project_id. >>> On that actio page, I session_register("project_id"); and it also works >>> fine for all pages "down stream", however, when I come back to that page >>> to select a new project, it keeps the old variable... >>> At first I did nothing special in the sence of assigning a value to the >>> session variables, as I let the register_globals=on do it's trick, but >>> later I explicitly said >>> $project_id = $HTTP_POST_VARS["project_id"]; >>> >>> But that also did not overwrite the value of the session var. In the end >>> I was forced to again add all my variables to the end of the url, >>> keeping the session solely for the username and password. >>> >>> I don't know if you would like me to post my code ( it is quite a bit >>> already ) but I would really appreciate it if someone could look at it, >>> and then point out where I'm missing the picture, as then I would have >>> two pictures that I can compare and see where my reasoning failed. >>> >>> Thanks for your time. >>> >>> >>> Rasmus Lerdorf wrote: >>> >>>> What issues? Just ask. >>>> >>>> -Rasmus >>>> >>>> On Mon, 29 Jul 2002, Petre wrote: >>>> >>>>> What are good books/websites about sessions. >>>>> I'm looking for more advanced stuff, I have the Luke Welling/Laura >>>>> Tompson book, and have read the manual, but I still have issues that are >>>>> unresolved. >>>>> >>>>> Thanks >>>>> >>>>> >>>>> >>>>> -- >>>>> PHP General Mailing List (http://www.php.net/) >>>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>>> >>> >> > >
attached mail follows:
Hi the ML
I'm looking for an algorithm or a free PHP Script which enable me to verify expiration date with a credit card number.
Does anybody knows this ?
Regards
Laurent Drouet
attached mail follows:
> I'm looking for an algorithm or a free PHP Script which enable me > to verify > expiration date with a credit card number. > > Does anybody knows this ?
It doesn't exist....credit card number alogrithms do not use the expiry date in their formulas (at least I'm not aware of any that are). Also there is no way to actually check if a credit card is valid without using a company that keeps an online database of active credit cards. The most you can do is verify that the number provided could potentially be a credit card...and even then the expiry date has no algorithm attached to it...as long as it is past the present date there's no way to consider it invalid without cross-referencing against a database of active cards.
Sincerely,
Craig Vincent
attached mail follows:
I have a development web server php 4.0.6 apache and mysql and everything works OK. I installed the same software onto a new server that will be the production server but I hit problems when my scripts try and hit the db on the new server. Comparing the phpinfo details for both, the new server does not have a mysql section it. I copied the original php.ini onto the new server and restarted apache after the installation. Where have I missed this in the installation process and how should I resolve it? As an aside question, is there any glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6?
**************************************************** This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. ****************************************************
attached mail follows:
Well, how did you do the install? You really need to provide more details. Heck, any details. You don't mention your OS, whether you compiled from source, if so which configure flags, from packages, which packages, etc.. We are not mind readers.
-Rasmus
On Tue, 30 Jul 2002, Mark Colvin wrote:
> I have a development web server php 4.0.6 apache and mysql and everything > works OK. I installed the same software onto a new server that will be the > production server but I hit problems when my scripts try and hit the db on > the new server. Comparing the phpinfo details for both, the new server does > not have a mysql section it. I copied the original php.ini onto the new > server and restarted apache after the installation. Where have I missed this > in the installation process and how should I resolve it? > As an aside question, is there any glaring issues I may encounter if I > upgrade php to 4.2.2 from 4.0.6? > > > **************************************************** > This e-mail is intended for the recipient only and > may contain confidential information. If you are > not the intended recipient then you should reply > to the sender and take no further ation based > upon the content of the message. > Internet e-mails are not necessarily secure and > CCM Limited does not accept any responsibility > for changes made to this message. > Although checks have been made to ensure this > message and any attchments are free from viruses > the recipient should ensure that this is the case. > **************************************************** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
I'm not sure exactly what you're saying, but it sounds to me like you didn't configure --with-mysql for the new server. You MUST do that. ./configure --with-apxs=/blah/blah --with-mysql
If you don't have --with-mysql compiled into the php binary, mysql functions won't work.
Tyler
On Tue, 30 Jul 2002 09:34:04 +0100
"Mark Colvin" <mark.colvin
ccmltd.co.uk> wrote:
> I have a development web server php 4.0.6 apache and mysql and > everything works OK. I installed the same software onto a new server > that will be the production server but I hit problems when my scripts > try and hit the db on the new server. Comparing the phpinfo details > for both, the new server does not have a mysql section it. I copied > the original php.ini onto the new server and restarted apache after > the installation. Where have I missed this in the installation process > and how should I resolve it? As an aside question, is there any > glaring issues I may encounter if I upgrade php to 4.2.2 from 4.0.6? > > > **************************************************** > This e-mail is intended for the recipient only and > may contain confidential information. If you are > not the intended recipient then you should reply > to the sender and take no further ation based > upon the content of the message. > Internet e-mails are not necessarily secure and > CCM Limited does not accept any responsibility > for changes made to this message. > Although checks have been made to ensure this > message and any attchments are free from viruses > the recipient should ensure that this is the case. > **************************************************** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tuesday 30 July 2002 16:34, Mark Colvin wrote: > I have a development web server php 4.0.6 apache and mysql and everything > works OK. I installed the same software onto a new server that will be the > production server but I hit problems when my scripts try and hit the db on > the new server. Comparing the phpinfo details for both, the new server does > not have a mysql section it.
That's because the php on the new server was not compiled with mysql support.
> I copied the original php.ini onto the new > server and restarted apache after the installation.
That wouldn't help.
> Where have I missed > this in the installation process and how should I resolve it?
reconfigure php to include mysql support.
> As an aside question, is there any glaring issues I may encounter if I > upgrade php to 4.2.2 from 4.0.6?
Quite a few, read the release notes/chagelog/history, read the php.ini.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Americans are people who insist on living in the present, tense. */
attached mail follows:
Uz.ytkownik Jakub Zawierucha napisa?: > I have little problem with vpopmail functions from PHP 4.2.2. When I use > vpopmail_auth_user ( "blah", "foo.bar.pl", "secret string" ); I get no > correct return value ( echo vpopmail_auth_user ( "blah", "foo.bar.pl", > "secret string" ); - give me no result ). This values are 100% good. I > have Apache with suEXEC (VirtualHost -> User vpopmail, Group vchkpw). > > > Here's details: > > My Apache: > ./configure \ > --enable-suexec \ > --suexec-caller=www-data \ > --suexec-docroot=/usr/local/apache \ > --server-uid=www-data \ > --server-gid=www-data \ > --enable-module=log_referer \ > --enable-module=usertrack \ > --disable-module=imap \ > --activate-module=src/modules/php4/libphp4.a \ > --prefix=/usr/local/apache > > cd src > # ADD line "AddModule modules/php4/libphp4.a" in Configure > ./Configure > make > cd .. > make install > > My PHP: > > ./configure \ > --enable-tokenizer \ > --enable-track-vars \ > --enable-ftp \ > --enable-safe-mode \ > --with-vpopmail="/home/vpopmail" \ > --with-apache=${SRC_APACHE_DIR} \ > --prefix=/usr/local > > make;make install > > infophp(); produce: > > vpopmail version 5.2.1 > vpopmail uid/gid php uid/gid/euid/egid 89/89 33/33/33/33 > vpopmail dir /home/vpopmail > vpopmail vadddomain /home/vpopmail/bin/vadddomain > vpopmail vdeldomain /home/vpopmail/bin/vdeldomain > vpopmail vaddaliasdomain /home/vpopmail/bin/vaddaliasdomain > vpopmail valias support Enabled > > > UIDs and GIDs : > > # cat /etc/group | grep 'vchkpw' > vchkpw:x:89: > # cat /etc/passwd | grep 'vpopmail' > vpopmail:x:89:89::/home/vpopmail:/bin/bash > # cat /etc/passwd | grep 'www-data' > www-data:x:33:33:www-data:/var/www:/non > > Is this problem of my configuration or broken code of php extensions ?
I solve that problem. Apache was not runed as vpopmail.vchkpw. Suexec is useless until you turn php as cgi. The better way (than suexec) is run separate apache server as vpopmail.vchkpw user on other port. Now vpopmail functions are ok.
-----= Jakub Zawierucha teku(at)teku.ptc.pl.nospam - remove .nospam =---
ps. Sorry for my english ;P
attached mail follows:
Hello,
Does php 4.2.2 is better than 4.0.6 ? Thank for your telling !
Edward.
attached mail follows:
Hello,
Which version of apache and which version of php are good for work together ?
Thank for your help...
Edward.
attached mail follows:
For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2
The developer systems, I'd go for (indeed have gone for) Apache 2.0.39 + PHP4.2.2
HTH
Danny.
----- Original Message -----
From: <EdwardSPL
ita.org.mo>
To: <php-general
lists.php.net>
Sent: Tuesday, July 30, 2002 11:01 AM
Subject: [PHP] apache and php
> Hello, > > Which version of apache and which version of php are good for work > together ? > > Thank for your help... > > Edward. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Danny Shepherd wrote:
> For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2
They are good for work under Linux RedHat ( 6.x / 7.x ) system ?
attached mail follows:
----- Original Message -----
From: <EdwardSPL
ita.org.mo>
To: "Danny Shepherd" <danny
kyboshed.com>
Cc: <php-general
lists.php.net>
Sent: Tuesday, July 30, 2002 11:30 AM
Subject: Re: [PHP] apache and php
> Danny Shepherd wrote: > > > For release systems, the recommended setup is Apache 1.3.26 + PHP4.2.2 > > They are good for work under Linux RedHat ( 6.x / 7.x ) system ? > Yeah, should be Ok.
Danny.
attached mail follows:
Hello All,
So, I've been using my own implementation of session handling which is mainly storing the userinfo in a cookie (an array, serialised and signed) but I'm starting to come around to the idea of storing this info on the server and just passing a session key about - but I have a couple of reservations, which I'm hoping someone can confirm or resolve :
Assuming that sessions are stored on the filesystem by default: 1 How secure is this? Could someone with system level access simple wander into the session store directory and start browsing though the session data? 2 Are expired sessions removed from the filesystem automatically? How often is this garbage collection performed? 3 How can I get a count of currently active (I.e non expired) sessions? 4 Are there any performance issues to worry about doing it this way? 5 Is it quicker to do it this way or store sessions in a db using session_set_save_handler?
Like the subject says, I'm after informed opinions on this subject rather than rumours and hearsay.
As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything.
Thanks a lot people,
Danny.
attached mail follows:
> So, I've been using my own implementation of session handling which is > mainly storing the userinfo in a cookie (an array, serialised and signed) > but I'm starting to come around to the idea of storing this info on the > server and just passing a session key about - but I have a couple of > reservations, which I'm hoping someone can confirm or resolve : > > Assuming that sessions are stored on the filesystem by default: > 1 How secure is this? Could someone with system level access simple > wander into the session store directory and start browsing though the > session data?
Well, at least as secure as passing this stuff out across the Internet to random clients where anybody can steal these cookies and present them back to you in a spoof attack.
> 2 Are expired sessions removed from the filesystem automatically? How > often is this garbage collection performed?
Sure. You configure it. See php.ini
> 3 How can I get a count of currently active (I.e non expired) sessions?
Count the number of session files.
> 4 Are there any performance issues to worry about doing it this way?
Not really
> 5 Is it quicker to do it this way or store sessions in a db using > session_set_save_handler?
Should be slightly quicker if your database is nice and fast and your schema is sane.
> As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + > PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything.
Why in the world are you running Apache2? You are not running it threaded anyway (since you are on FreeBSD) so you are not gaining any of the threaded scalability that is Apache2's only real selling point right now. You are running code that acts just like Apache 1.3.x except it is much less stable (at least with PHP).
-Rasmus
attached mail follows:
<< Comments inline >>
----- Original Message -----
From: "Rasmus Lerdorf" <rasmus
php.net>
To: "Danny Shepherd" <danny
kyboshed.com>
Cc: "PHP-General" <php-general
lists.php.net>
Sent: Tuesday, July 30, 2002 11:24 AM
Subject: Re: [PHP] Sessions - Informed Opinions
> > Assuming that sessions are stored on the filesystem by default: > > 1 How secure is this? Could someone with system level access simple > > wander into the session store directory and start browsing though the > > session data? > > Well, at least as secure as passing this stuff out across the Internet to > random clients where anybody can steal these cookies and present them back > to you in a spoof attack. > Fair enough
> > 2 Are expired sessions removed from the filesystem automatically? How > > often is this garbage collection performed? > > Sure. You configure it. See php.ini > > > 3 How can I get a count of currently active (I.e non expired) sessions? > > Count the number of session files. Can I be sure that the count will only include active sessions though?
> > > 4 Are there any performance issues to worry about doing it this way? > > Not really > > > 5 Is it quicker to do it this way or store sessions in a db using > > session_set_save_handler? > > Should be slightly quicker if your database is nice and fast and your > schema is sane. Great
> > > As for my setup - it's a BSD box - Apache2.0.39 + PHP4.2.2 (apache module) + > > PHP4.3.0dev-Zend2alpha2 (cgi) - both compiled with pretty much everything. > > Why in the world are you running Apache2? You are not running it threaded > anyway (since you are on FreeBSD) so you are not gaining any of the > threaded scalability that is Apache2's only real selling point right now. > You are running code that acts just like Apache 1.3.x except it is much > less stable (at least with PHP).
Can't say I've really noticed any stability issues - even with PHP (there was that multiple cookie bug but even so). It's a dev box (the release boxes all use Apache1.3.x) and TBH, I was playin' about some of Apache2's other features, such as the dynamic vhosting, which might be useful to me later.
Thanks for the reply though,
Danny.
attached mail follows:
> > > 3 How can I get a count of currently active (I.e non expired) > sessions? > > > > Count the number of session files. > Can I be sure that the count will only include active sessions though?
By definition, if the session file is there, it is an active session. There is no such thing as counting active users on the Web. You define a time window and count how many users accessed your site within that window. Once a session has been idle for a time > than the configured session gc time, it will get deleted. I tend to do this out of band though. PHP has a mechanism for calling the session gc code, but I prefer to turn this off and run my own cron job that does this regularly. And yes, this is easier to manage if you have a database where you can do a simple count() query to get the number of active sessions.
-Rasmus
attached mail follows:
----- Original Message -----
From: "Rasmus Lerdorf" <rasmus
php.net>
To: "Danny Shepherd" <danny
kyboshed.com>
Cc: "PHP-General" <php-general
lists.php.net>
Sent: Tuesday, July 30, 2002 11:52 AM
Subject: Re: [PHP] Sessions - Informed Opinions
> > > > 3 How can I get a count of currently active (I.e non expired) > > sessions? > > > > > > Count the number of session files. > > Can I be sure that the count will only include active sessions though? > > By definition, if the session file is there, it is an active session. > There is no such thing as counting active users on the Web. You define a > time window and count how many users accessed your site within that > window. Once a session has been idle for a time > than the configured > session gc time, it will get deleted. I tend to do this out of band > though. PHP has a mechanism for calling the session gc code, but I prefer > to turn this off and run my own cron job that does this regularly. And > yes, this is easier to manage if you have a database where you can do a > simple count() query to get the number of active sessions.
Right, db sessions seem to be the way for me, thanks Rasmus. (Oh, thanks for PHP too :)
Danny.
attached mail follows:
Peter wrote:
>> >howdy, >> > >> >i've got it all configured correctly .. well it doesn't spit any >> errors out >> >on make >> >but when i got to view a web page it opens a down load box ..so >> i added this >> > >> >LoadModule php4_module libexec/libphp4.so >> > >> >to httpd.conf as per the manual and restarted apache but it didn't start >> >saying it couldn't find libphp.so which leads me to my question >> .. that file >> >is created automatically correct? >> > >> >i havent been able to find that file on my machine any where.. so i >> >can't point it to another location ... any one got any ideas what i >> should do as i >> >have not seen any info any where that will direct me in this >> >situation... >> >> Do the "make install" again and pay attention to what scrolls by and see >> where it puts the libphp4.so file. >> >> Then, make sure that's where Apache expects it. >> >> the LoadModule directive acts in conjunction with the one above all the >> LoadModules that tells Apache where to start looking for Modules in the >> first place. >> >> Some folks set that in httpd.conf to include the "libexec" part, so then >> your libexec in the LoadModule line is ending up "doubling" the libexec >> in the path and that ain't gonna work. >> >> If there are any *working* LoadModule lines, you can try digging around >> to find them on your hard drive, and make sure libphp4.so is sitting next >> to them, and then do the LoadModule the same way as the working ones. >> >> http://apache.org will explain all the stuff I just said in >> formal language. >> :-) > > Ok i followed what you have suggested and Apache didn't spit out anything > on libphp4.so so I am lead to beleave it wasn't created.. > > my apache config like was > > > #./configure --enable-module=most --enable-shared=max > #--activate-module=src/ > modules/php4/libphp4.a > > cheers > Peter > > Peter - if you are still battling with this, perhaps you might try an alternate approach, where you first compile apache with dso support, then compile php as a loadable module.
For guidance, here are the configure files I use for each:
Apache ./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
You'll possibly have apache in a different place so may need to change the value for prefix.
PHP #! /bin/sh # # Created by configure
"./configure" \
"--enable-debug=no" \
"--enable-gd-imgstrttf" \
"--enable-gd-nativett" \
"--enable-sysvsem=yes" \
"--enable-sysvshm=yes" \
"--enable-track-vars=yes" \
"--with-apxs=/usr/local/apache/bin/apxs" \
"--with-config-file-path" \
"--with-config-file-path=/usr/local/apache/conf" \
"--with-freetype-dir=/usr/X11R6" \
"--with-gd=/usr/local/src/gd-2.0.1" \
"--with-jpeg-dir=/usr" \
"--with-mysql=/usr/local/mysql" \
"--with-png-dir=/usr" \
"--with-xml" \
"--with-xpm-dir=/usr/X11R6" \
"--with-zlib" \
"--with-zlib-dir=/usr" \
"$
"
#"--with-mnogosearch" \
The two things you need specifically here are --with-apxs which allows the loadable module to be built, and the two with-config-file entries. The latter of these points to the directory where you have installed apache configuration files, and allows the php install process to find the apache config file and add the necessary entries to get php up and running.
So the order of play is Apache configure make make install optionally start to ensure its all working
PHP configure make make install
Apache restart to re-read the config file
That should get you up and running. I just did the php part earlier today to upgrade my laptop to 4.2.2 and it only took a few minutes.
Cheers
-- David RobleyNUMBER CRUNCHING: Jumping on a Computer.
attached mail follows:
Hello, people. So the problem. I have apache running with php-module. Recently I've upgraded the 4.0.6 version up to 4.2.2. All my php configuration directives in httpd.conf (php_flag, php_admin_flag, php_value, php_admin_value) are not working now. When I change libphp4.so back to 4.0.6 the directives work, if I use 4.2.2 module - they don't. The configuration of apache and php.ini are not being changed. The php.ini in both cases is almost the same. The configure options of both php-versions seems to be the same. Where is the problem? Did I miss anything while configuring and installing 4.2.2 php module? I can not find any info in php docs.
attached mail follows:
Hi all!
The manual claims here (http://se2.php.net/manual/en/ref.session.php) that:
</snip> ...If session.save_path's path depth is more than 2, garbage collection will not be performed. </snip>
Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to:
/home/httpd/vhosts/mydomainname/httpdocs/sessions/
and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of "deserted" session files that don't seem to go away. Any ideas on how to solve this?
/Lasso (lasso
lassoweb.nu)
attached mail follows:
> I am using PHP-4.1.1 on Linux, > I wanted to know the difference between "nobody" user and normal user of > operating system.
None. Nobody is an ordinary user. However, ordinary UNIX users can be set up in all sorts of ways.
> > This question just came to mind when, neither nobody's directory nor any > entry was not found in /home or elsewhere.
That's deliberate. The nobody user is set up with very few resources or privileges and is then used to run things like the web server. If a hacker can exploit a weakness in the server to gain control and issue commands as the user running it, the potential damage is limited to what that user can do, which is not much.
Simon Ritchie
Download my introduction to PHP for $25: http://merrowinternet.com/downloads?source=ml
attached mail follows:
Hello,
I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding "ISO-8859-1" and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x0000 to x00FF) so as to send and receive images, is it possible? I noticed that special characters such as "&" "<" ">" """ "'" have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by 	 but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by &#x (x is the decimal ASCII code of the character). Have you got an idea about it? I tried to find out an answer in the expat scripts used by the function, without any results.
Thank you for your answering.
Best regards.
Sébastien Molé.
reply to: smole
atomis.com
attached mail follows:
Hello,
I have a question concerning characters : I use the function xml_parse on a standalone XML file with the encoding "ISO-8859-1" and I want to parse it. It contains all types of characters (including control characters, so ASCII characters from x0000 to x00FF) so as to send and receive images, is it possible? I noticed that special characters such as "&" "<" ">" """ "'" have to be replaced in regard of the W3C definition of XML, and that character such as chr(9) tabulation, chr(10) line feed, and chr(13) carriage return are supported by the function xml_parse (replaced repectively by 	 but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error even if I replace them by &#x (x is the decimal ASCII code of the character). Have you got an idea about it? I tried to find out an answer in the expat scripts used by the function, without any results.
Thank you for your answering.
Best regards.
Sébastien Molé.
reply to: smole
atomis.com
attached mail follows:
On Tue, Jul 30, 2002 at 05:12:25PM +0200, Sebastien Mole wrote:
> but when I try to parse characters such as chr(#x0001) or chr(#x001F) (or others) the parser returns me an error
Line wrapping... "What a concept."
In my PHP XML parsing tutorial, http://www.analysisandsolutions.com/code/phpxml.htm, I use the following preg to clean out those nasty characters:
# Remove all non-visible characters except SP, TAB, LF and CR. $Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
--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
attached mail follows:
Hi there,
I am wondering how to search an array for words starting with a certain character.
E.G:
$word = array('alpha', 'beta', 'php');
I would like to check if there is a word in the array starting with p
Is there alrready a function for this?
Thanx, Andy
attached mail follows:
Seeing as a question concerning register_globals seems to be posted every day - I thought this link might be useful to some:
http://www.zend.com/zend/art/art-sweat4.php
Neil
-- ---------------------- www.curvedvision.com ----------------------
attached mail follows:
I have a db with the following fields:
id | month | company | title | name | role | show_company | show_title | show_month
sql query is: "select * FROM db ORDER BY month DESC";
Output gets formatted like:
month - company - title name role name role - title name role - company - title name role name role name role
The occurrence of the number of fields within each heading is not static.
The oldest data sits at the "beginning" of the db so the order by month desc sorts the output from newest to oldest. Fine so far.
Now, as new data gets added to the db sometimes some of it refers to past months. So although the order by month clause will move the new data to the correct month it will not move it into the correct heading (company) and sub_heading (title). I've tried using group by and using multiple fields in the order by but can not get the results I'm looking for, any suggestions?
-Brian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]