|
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: Thu Aug 22 2002 - 09:29:29 CDT
php-general Digest 22 Aug 2002 14:29:29 -0000 Issue 1540
Topics (messages 113560 through 113615):
Re: Session problems: "Warning: write failed: Disk quota exceeded"
113560 by: Bob Irwin
Re: How Do You Protect Individual Files
113561 by: Justin French
113576 by: Roger Lewis
113579 by: Justin French
Re: SeparatingWords
113562 by: Bogdan Stancescu
Re: Web Site
113563 by: Roger Lewis
113567 by: Bogdan Stancescu
113569 by: Justin French
113577 by: Jason Wong
113578 by: Jason Wong
113580 by: Justin French
113589 by: Sami Mahamed
113597 by: Jarrad Kabral
Re: Image library
113564 by: Justin French
113573 by: Bogdan Stancescu
Re: Further Security Clarifications [was: Simple Security Clarifcation]
113565 by: Andre Dubuc
Re: Mime types?
113566 by: Justin French
webhosting - OT
113568 by: Ryan A
113570 by: Justin French
anyone...?
113571 by: ::: Flavio Bastos Amiel::::::
113596 by: ::: Flavio Bastos Amiel::::::
connecting to db
113572 by: Jim Long
113587 by: Sami Mahamed
Re: inserting info into db
113574 by: ::: Flavio Bastos Amiel::::::
Re: directory help
113575 by: Jason Wong
Dumb question
113581 by: Liam MacKenzie
113582 by: Bob Irwin
113588 by: David Robley
Help w/IMAP
113583 by: David Christensen
113585 by: David Christensen
Re: UPS Ship Rates avail? XML?
113584 by: Peter J. Schoenster
Re: Dumb question]
113586 by: David Christensen
Re: Passing variables between servers
113590 by: Garth Dahlstrom
113595 by: Anil Kumar K.
Determining if a variable is blank.
113591 by: Jason
113592 by: Rasmus Lerdorf
variable variables i think...
113593 by: Justin French
Re: variable variables i think... (solved)
113594 by: Justin French
Active page
113598 by: Budi Kelana
113599 by: Yamin Prabudy
113600 by: jochen schultz
113608 by: Kondwani Spike Mkandawire
OOP / dynamic SQL class
113601 by: jochen schultz
in_array()
113602 by: Riccardo Sepe
113604 by: jochen schultz
phpnuke installation.
113603 by: Thomas Goeminne
113606 by: Jason Wong
open_basedir restriction?
113605 by: Thomas Goeminne
113607 by: Jason Wong
Eregi_replace
113609 by: Roman Duriancik
113613 by: Bas Jobsen
PHP search function for MySQL db
113610 by: Kristoffer Strom
in_array
113611 by: Riccardo Sepe
Question about sessions: how to force expiry
113612 by: DonPro
Replacing an uploaded file
113614 by: Jay Blanchard
search in serialized string
113615 by: Rodrigo Peres
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:
G'day,
Most likely they haven't pointed it to the right place (or maybe
permissions? Doubt it would give this error for that).
Session information is usually stored in /tmp on the hosting server (and on
unix servers /tmp is actually a disk partition with a set size).
There are a lot of applications on a hosting server that might use /tmp to
store temporary files, so I suppose it is possible that something has filled
/tmp up and PHP simply can't write to it because there is no where to write
to!
Call your host is my advice.
Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom
----- Original Message -----
From: "Beau Hartshorne" <beau
members.evolt.org>
To: "php-general" <php-general
lists.php.net>
Sent: Thursday, August 22, 2002 12:24 PM
Subject: [PHP] Session problems: "Warning: write failed: Disk quota
exceeded"
> Hi,
>
> Recently, my php app has started to throw these warnings:
>
> Warning: write failed: Disk quota exceeded (122) in Unknown on line 0
>
> Warning: Failed to write session data (files). Please verify that the
> current setting of session.save_path is correct (/tmp) in Unknown on
> line 0
>
> I narrowed it down to this code:
>
> <?php
> session_start();
> session_register('anything');
> ?>
>
> (A test file containing only that will throw those two warnings.)
>
> The php version is 4.2.2. This script is running in a shared hosting
> environment. My guess is that the ISP has misconfigured php, and has not
> set the appropriate permissions to the /tmp directory.
>
> Does this make sense? Or is there something that I've missed?
>
> Thank you,
>
> Beau
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
>
> Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
attached mail follows:
on 22/08/02 2:15 AM, Roger Lewis (re.lewis
attbi.com) wrote:
> Well, I originally searched for "protect file downloads". I also searched
> "protect individual files", "protect files", "authenticate files", and on
> and on. There are thousands of messages, but very few with relevant titles
> or content.
I was giving you exact subject lines from threads, not suggested search
terms. And I also advised that they were VERY recent threads.
> One point to consider: I have no control over the files
> themselves. They are being uploaded to the document directories by end
> users, so I do not know the file names.
That's fine. There's plenty of code for file uploading, including the PHP
manual which has a full example. when you move_uploaded_file(), you need to
move it to the target directory of "restricted download files".
> What I am trying to do is prevent
> someone who knows the path to the file from being able to gain access to it
> without authorization.
I understand what you're trying to achieve, and it IS asked on here weekly.
Sign, again, here's the components you need:
1. an authorisation/session/user system of some form, based on PHP... in
other words, I login via a PHP script, and then I walk around your site as a
validated user.
2. a file storage method which enables you to store files in your disc
hierarchy, but does not allow the files to be DIRECTLY served via HTTP.
the two methods for this are:
a) store your files ABOVE your web document root
b) store your files within (below) your document root, and prevent them from
being served by the use of a htaccess file.
for this, place a file named .htaccess in the directory you want to protect
(eg mydocroot/mp3/) with something like this in it:
<Files ~ "\.inc$">
Order Allow,Deny
Deny from all
</Files>
the above code prevents all *.inc files from being served via HTTP.
Changing "\.inc$" to "\.mp3$" would refuse serving of all MP3 files.
I'm NOT an apache geek at all, but my guess is that
<Files ~ "*">
Order Allow,Deny
Deny from all
</Files>
Will refuse all files within the dir you place the .htaccess file.
3. you need a script which checks for a validated user, offers a range of
files that can be downloaded, then when you click on one, check your a valid
users, sets the correct mime-type, and parses the file through the php
script to your browser.
All of this is available in the Zend article I posted:
> http://www.zend.com/zend/trick/tricks-august-2001.php
So, now you should have everything you need.
Justin French
attached mail follows:
Justin,
Thanks again. I've been doing some more research on .htaccess. The problem
I see is that it is high maintenance, i.e. I've already got a MySQL table of
users with username and password. To use .htaccess, you have to have a
htpasswd file containing duplicate usernames and passwords, and this would
have to be in sync with the MySQL table.
I have found that there is an Apache module, mod_auth_mysql, that allows
.htaccess to access a MySQL database for the information it needs. This
module is available at
http://www.diegonet.com/support/mod_auth_mysql.shtml. Problem is you have
to install the mod and recompile Apache, I think. And I don't know how to
do that yet. However, if everything works in accordance with my
interpretation, you should be able to put an .htascess file into the
directory you wish to protect and Mod_auth_mysql will communicate with the
database to authenticate the users.
Roger
attached mail follows:
on 22/08/02 1:10 PM, Roger Lewis (re.lewis
attbi.com) wrote:
> Justin,
>
> Thanks again. I've been doing some more research on .htaccess. The problem
> I see is that it is high maintenance, i.e. I've already got a MySQL table of
> users with username and password. To use .htaccess, you have to have a
> htpasswd file containing duplicate usernames and passwords, and this would
> have to be in sync with the MySQL table.
NO. All the .htaccess file would do in this case is prevent the files from
being served over http AT ALL. Instead, the files are served THROUGH a PHP
script which checks for authenticated user first.
> I have found that there is an Apache module, mod_auth_mysql, that allows
> .htaccess to access a MySQL database for the information it needs. This
> module is available at
> http://www.diegonet.com/support/mod_auth_mysql.shtml. Problem is you have
> to install the mod and recompile Apache, I think. And I don't know how to
> do that yet. However, if everything works in accordance with my
> interpretation, you should be able to put an .htascess file into the
> directory you wish to protect and Mod_auth_mysql will communicate with the
> database to authenticate the users.
You don't need anything more that a standard Apache, PHP and MySQL install.
Read my last email again, and again, and again. It (hopefully) clearly sets
out what you need, and how each part interacts. I don't know how to be much
clearer, without doing it for you (which I can do, at a cost :))
Justin French
attached mail follows:
Just to make a fool of myself, I'd explode the string, parse each item
and implode. I'm sure it can be done through some regexp wizardry as
well - probably matching something along the lines of "(^\ [A-Z])" but
I'm way too retarded regexp-wise. BTW, any good online tutorials? I read
through PHP's reference docs (which are probably excellent if you
already know what it's all about), but only reached a limited
understanding of how to approach problems...
Bogdan
Dl Neil wrote:
> Philip,
> What about "SoftwareVersion Thingy"?
> Won't that end up as "Software Version Thingy" - with two spaces before the
> "T"?
> Can the RegEx be 'turned off' if the u/case letter is already preceded by a
> space?
> (sorry, may not be Hessu's requirement = my curiosity)
> Regards,
> =dn
>
>
>
>>This works.
>>
>>$word = "SoftwareVersionThingy";
>>$word = ereg_replace("([A-Z])", " \\1", $word);
>>$word = ltrim($word);
>>
>>-philip
>>
>>On Thu, 22 Aug 2002, Hessu wrote:
>>
>>
>>>Hi,
>>>
>>>I have strings like FileName, SoftwareVersion etc.
>>>How can I add space between words? Somehow with preg_replace perhaps?
>>>First letter of each word is capitalized.
>>>
>>>-Hessu-
>>>
>>>--
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
attached mail follows:
On Wednesday, August 21, 2002 6:41 PM
Peter Goggin wrote
< 2. I need to set up credit card payments. Has anyone any experience with
< PayPal? Are there any other providers I should consider.
Nothing but good to say about PayPal
Roger
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Just for the record, I'm sure you can Google out quite a few nasty comments on PayPal - I remember reading some along the lines of "dear all, I know it was much easier for you to send money via PayPal, I know that giving up on using it will considerably decrease my income, but after my [...] experience I want to have nothing to do with them anymore". Never used PayPal myself, and problems are inherent for such a large system, so don't take this as an anti-PayPal message - just try searching for some user comments before starting to use it.
Bogdan
Roger Lewis wrote: > On Wednesday, August 21, 2002 6:41 PM > Peter Goggin wrote > > < 2. I need to set up credit card payments. Has anyone any experience with > < PayPal? Are there any other providers I should consider. > Nothing but good to say about PayPal > Roger > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
on 22/08/02 11:41 AM, Peter Goggin (pgoggin
smartchat.net.au) wrote:
> > I am setting up a web site which will be hosted on my own equipmet at home, > located in Melbourne, Australia > I would like some general advice on two questions. > > 1. What sort of permanent interconnect should I look at (Cable is not > available in my area). Is DSL suitable? Are there any good providers in the > area?
DSL is a cheap option, although you have limited bandwidth and file transfers. It would be a good first step.
> 2. I need to set up credit card payments. Has anyone any experience with > PayPal? Are there any other providers I should consider.
It sounds like you're NOT a sys admin type, so DON'T think about storing credit card #'s on your own server yet -- you'd need a lot of security and system admin experience before going there!
PayPal Authorize.net
Depends on what you want to sell (intellectual property or physical items)
Not really the place to ask this... look for e-commerce type sites and articles... liek the ones on ecommercebase.com
Justin French
attached mail follows:
On Thursday 22 August 2002 10:42, Bogdan Stancescu wrote: > Just for the record, I'm sure you can Google out quite a few nasty > comments on PayPal - I remember reading some along the lines of "dear > all, I know it was much easier for you to send money via PayPal, I know > that giving up on using it will considerably decrease my income, but > after my [...] experience I want to have nothing to do with them > anymore". Never used PayPal myself, and problems are inherent for such a > large system, so don't take this as an anti-PayPal message - just try > searching for some user comments before starting to use it.
IIRC there seems to have been a period a while back when PayPal were 'over-reacting' to fraud and innocent users got caught up in the cross-fire.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Luke, I'm yer father, eh. Come over to the dark side, you hoser. -- Dave Thomas, "Strange Brew" */
attached mail follows:
On Thursday 22 August 2002 10:44, Justin French wrote:
> on 22/08/02 11:41 AM, Peter Goggin (pgoggin
smartchat.net.au) wrote:
> > I am setting up a web site which will be hosted on my own equipmet at
> > home, located in Melbourne, Australia
> > I would like some general advice on two questions.
> >
> > 1. What sort of permanent interconnect should I look at (Cable is not
> > available in my area). Is DSL suitable? Are there any good providers in
> > the area?
>
> DSL is a cheap option, although you have limited bandwidth and file
> transfers. It would be a good first step.
Do they give you a permanent IP address? If not, you're going to have to subscribe to some dynamic IP service so people can actually get to your site. But quite frankly running a commercial website (I assume so because you'll be accepting CC payments) using dynamic IP feels a bit dodgy to me. Surely a commercial operation can afford the USD 10-20/month for a decent web host?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* A new koan: If you have some ice cream, I will give it to you. If you have no ice cream, I will take it away from you. It is an ice cream koan. */
attached mail follows:
on 22/08/02 1:18 PM, Jason Wong (php-general
gremlins.com.hk) wrote:
>> DSL is a cheap option, although you have limited bandwidth and file >> transfers. It would be a good first step. > > Do they give you a permanent IP address? If not, you're going to have to > subscribe to some dynamic IP service so people can actually get to your site. > But quite frankly running a commercial website (I assume so because you'll be > accepting CC payments) using dynamic IP feels a bit dodgy to me. Surely a > commercial operation can afford the USD 10-20/month for a decent web host?
Exactly!!!
Justin French
attached mail follows:
I think DSL is better than cable if you can't get a T3 line.
If you want a site hosted at your home, i strongly suggest Apache(www.apache.org). Great sever tool :) Or PHP-Triad(www.phpgeek.com not sure if thats the site or not, sorry).
Sorry i have no PayPal account so i can't answer that one ;)
-Sami
"Peter Goggin" <pgoggin
smartchat.net.au> wrote in message
news:00a101c2497c$f8e51410$0300000a
petergnt1...
>
> I am setting up a web site which will be hosted on my own equipmet at
home,
> located in Melbourne, Australia
> I would like some general advice on two questions.
>
> 1. What sort of permanent interconnect should I look at (Cable is not
> available in my area). Is DSL suitable? Are there any good providers in
the
> area?
>
> 2. I need to set up credit card payments. Has anyone any experience with
> PayPal? Are there any other providers I should consider.
>
>
> I don't know if this is the correct list for the questions, but if not
> perhaps someone could point me to where I can get some advice.
>
>
> Regards
>
> Peter Goggin
>
attached mail follows:
If your in Aus (like me) then I recommend eWay, I've used them for several sites and never had a problem. www.eway.com.au
They even have some sample PHP code you can use to integrate with there system...
Regards Jarrad Kabral
-----Original Message-----
From: Sami Mahamed [mailto:oromian
hotmail.com]
Sent: Thursday, 22 August 2002 2:16 PM
To: php-general
lists.php.net
Subject: [PHP] Re: Web Site
I think DSL is better than cable if you can't get a T3 line.
If you want a site hosted at your home, i strongly suggest Apache(www.apache.org). Great sever tool :) Or PHP-Triad(www.phpgeek.com not sure if thats the site or not, sorry).
Sorry i have no PayPal account so i can't answer that one ;)
-Sami
"Peter Goggin" <pgoggin
smartchat.net.au> wrote in message
news:00a101c2497c$f8e51410$0300000a
petergnt1...
>
> I am setting up a web site which will be hosted on my own equipmet at
home,
> located in Melbourne, Australia
> I would like some general advice on two questions.
>
> 1. What sort of permanent interconnect should I look at (Cable is not
> available in my area). Is DSL suitable? Are there any good providers in
the
> area?
>
> 2. I need to set up credit card payments. Has anyone any experience with
> PayPal? Are there any other providers I should consider.
>
>
> I don't know if this is the correct list for the questions, but if not
> perhaps someone could point me to where I can get some advice.
>
>
> Regards
>
> Peter Goggin
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
So hash them into groups of 1000 images????
1-1000 1001 - 2000 2001 - 3000
etc etc, and just name the files 1.gif, 2.jpeg, etc etc
Justin French
on 22/08/02 12:41 AM, Scott Houseman (ScottH
JamWarehouse.com) wrote:
> Hi there.
>
> So what you are suggesting is using an AUTO_INCREMENT field, possibly the
> image's Primary Key as an identifier
> for that image file., which is fine by me, but surely one should store files
> across directories, as 10000 images
> in a single directory might slow down access to those images in the
> filesystem, or not so?
>
> Thanks for your input.
>
> Regards
>
> -Scott
>
>> -----Original Message-----
>> From: DL Neil [mailto:PHPml
DandE.HomeChoice.co.uk]
>> Sent: 21 August 2002 04:31
>> To: php-general
lists.php.net; Bogdan Stancescu
>> Subject: Re: [PHP] Image library
>>
>>
>> Scott (confirming Bogdan),
>>
>> Libraries of all types have had this concern for years - even though books
>> are uniquely identified by ISBN, that is still not good enough for library
>> purposes (eg multiple copies of a single title). So they, exactly
>> as Bogdan
>> suggests, use an "Accession" number sequence - which can be
>> implemented very
>> neatly in MySQL (from PHP) as an AUTO_INCREMENT field.
>>
>> Regards,
>> =dn
>>
>>> I've seen this kind of random approach several times and I keep
>>> wondering why not counting the files instead. Yes, it may take a little
>>> longer when uploading but I personally think the safety of the approach
>>> is worth the insignificant speed sacrifice.
>>>
>>> Bogdan
>>>
>>> Scott Houseman wrote:
>>>> Hi all.
>>>>
>>>> This confirms what I suspected.
>>>>
>>>> The hash algrithm:
>>>>
>>>> I have a directory structure: dirs 0 - f, and within each of
>> these, the
>> same
>>>> dir structure 0 - f.
>>>> When an image gets uploaded into the library, do an md5sum of
>> the file,
>> take
>>>> the first 2 chars of that hash
>>>> and there's your path. e.g
>>>> $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
>>>>
>>>> I'm not sure what the mathematical randomness of this is, but I'm sure
>> it's
>>>> pretty random, and the chances
>>>> of collision should be virtually null, the only time you should
>> overwrite a
>>>> file is if you upload the exact same file(?)
>>>> Is there a better way of doing this?
>>>>
>>>> Cheers
>>>>
>>>> -Scott
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Justin French [mailto:justin
indent.com.au]
>>>>> Sent: 21 August 2002 03:25
>>>>> To: ScottH
jamwarehouse.com; PHP General
>>>>> Subject: Re: [PHP] Image library
>>>>>
>>>>>
>>>>> on 21/08/02 9:45 PM, Scott Houseman (ScottH
JamWarehouse.com) wrote:
>>>>>
>>>>>
>>>>>
>>>>>> Which way would be the most efficient/fastest to access images
>>>>>
>>>>> from an image
>>>>>
>>>>>> library.
>>>>>> A) Store image files in a hash directory structure AND storing
>>>>>
>>>>> each file's
>>>>>
>>>>>> information in a mysql table
>>>>>> OR
>>>>>> B) Storing image information in mysql table AND storing the
>>>>>
>>>>> image in a BLOB
>>>>>
>>>>>> field in that table.
>>>>>
>>>>>> From all accounts I've read on this list, a database is not
>>>>> usually faster
>>>>> than a filesystem. And for large amounts of files, like 1000's,
>>>>> a hash will
>>>>> speed it up more.
>>>>>
>>>>>
>>>>>
>>>>>> The way I see it, considerations to be taken into acount:
>>>>>> - Is it quicker/better to retrieve image from table & then stream out
>> to
>>>>>> browser OR simply direct the browser to the file?
>>>>>> i.e <IMG SRC="/imagelib/image.php?iImageID=10"> OR <IMG
>>>>>> SRC="/imagelib/5/f/10">
>>>>>> - Will a database OR filesystem be more scalable i.e. which
>> wil perform
>>>>>> better when there are 10000 images in the libary?
>>>>>
>>>>> Filesystem should be quicker. You need to think about how
>> you hash the
>>>>> files up for the most even spread of files in each directory I guess.
>>>>>
>>>>>
>>>>> Justin
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> 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:
That was my original idea - and to take things to extremes, you might even want to recurse directories: using only a couple of recursiveness levels (1-1000/1-1000/1-1000.jpg) would ensure 1 bil. files without getting more than 1000 in any singe directory. The really nice thing about this approach is that you can start with a single level and in the unlikely event you get more than 1 mil. (you wish! :)) then you can add another in no time, with a down time of probably ten minutes.
In a slightly different train of thoughts, since this approach is so flexible, I'd recommend going for 500 files per directory - that's a limit which guarantees no slowdown. (And yes, I've read Jay's argument, but I have heard so many counter-arguments throughout time that I personally prefer to stay on the safe side - it's no big deal after all).
Just my 2c, obviously.
Bogdan
Justin French wrote:
> So hash them into groups of 1000 images????
>
> 1-1000
> 1001 - 2000
> 2001 - 3000
>
> etc etc, and just name the files 1.gif, 2.jpeg, etc etc
>
> Justin French
>
>
>
> on 22/08/02 12:41 AM, Scott Houseman (ScottH
JamWarehouse.com) wrote:
>
>
>>Hi there.
>>
>>So what you are suggesting is using an AUTO_INCREMENT field, possibly the
>>image's Primary Key as an identifier
>>for that image file., which is fine by me, but surely one should store files
>>across directories, as 10000 images
>>in a single directory might slow down access to those images in the
>>filesystem, or not so?
>>
>>Thanks for your input.
>>
>>Regards
>>
>>-Scott
>>
>>
>>>-----Original Message-----
>>>From: DL Neil [mailto:PHPml
DandE.HomeChoice.co.uk]
>>>Sent: 21 August 2002 04:31
>>>To: php-general
lists.php.net; Bogdan Stancescu
>>>Subject: Re: [PHP] Image library
>>>
>>>
>>>Scott (confirming Bogdan),
>>>
>>>Libraries of all types have had this concern for years - even though books
>>>are uniquely identified by ISBN, that is still not good enough for library
>>>purposes (eg multiple copies of a single title). So they, exactly
>>>as Bogdan
>>>suggests, use an "Accession" number sequence - which can be
>>>implemented very
>>>neatly in MySQL (from PHP) as an AUTO_INCREMENT field.
>>>
>>>Regards,
>>>=dn
>>>
>>>
>>>>I've seen this kind of random approach several times and I keep
>>>>wondering why not counting the files instead. Yes, it may take a little
>>>>longer when uploading but I personally think the safety of the approach
>>>>is worth the insignificant speed sacrifice.
>>>>
>>>>Bogdan
>>>>
>>>>Scott Houseman wrote:
>>>>
>>>>>Hi all.
>>>>>
>>>>>This confirms what I suspected.
>>>>>
>>>>>The hash algrithm:
>>>>>
>>>>>I have a directory structure: dirs 0 - f, and within each of
>>>>
>>>these, the
>>>same
>>>
>>>>>dir structure 0 - f.
>>>>>When an image gets uploaded into the library, do an md5sum of
>>>>
>>>the file,
>>>take
>>>
>>>>>the first 2 chars of that hash
>>>>>and there's your path. e.g
>>>>>$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
>>>>>
>>>>>I'm not sure what the mathematical randomness of this is, but I'm sure
>>>>
>>>it's
>>>
>>>>>pretty random, and the chances
>>>>>of collision should be virtually null, the only time you should
>>>>
>>>overwrite a
>>>
>>>>>file is if you upload the exact same file(?)
>>>>>Is there a better way of doing this?
>>>>>
>>>>>Cheers
>>>>>
>>>>>-Scott
>>>>>
>>>>>
>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Justin French [mailto:justin
indent.com.au]
>>>>>>Sent: 21 August 2002 03:25
>>>>>>To: ScottH
jamwarehouse.com; PHP General
>>>>>>Subject: Re: [PHP] Image library
>>>>>>
>>>>>>
>>>>>>on 21/08/02 9:45 PM, Scott Houseman (ScottH
JamWarehouse.com) wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Which way would be the most efficient/fastest to access images
>>>>>>
>>>>>>from an image
>>>>>>
>>>>>>
>>>>>>>library.
>>>>>>>A) Store image files in a hash directory structure AND storing
>>>>>>
>>>>>>each file's
>>>>>>
>>>>>>
>>>>>>>information in a mysql table
>>>>>>>OR
>>>>>>>B) Storing image information in mysql table AND storing the
>>>>>>
>>>>>>image in a BLOB
>>>>>>
>>>>>>
>>>>>>>field in that table.
>>>>>>
>>>>>>>From all accounts I've read on this list, a database is not
>>>>>>
>>>>>>usually faster
>>>>>>than a filesystem. And for large amounts of files, like 1000's,
>>>>>>a hash will
>>>>>>speed it up more.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>The way I see it, considerations to be taken into acount:
>>>>>>>- Is it quicker/better to retrieve image from table & then stream out
>>>>>>
>>>to
>>>
>>>>>>>browser OR simply direct the browser to the file?
>>>>>>>i.e <IMG SRC="/imagelib/image.php?iImageID=10"> OR <IMG
>>>>>>>SRC="/imagelib/5/f/10">
>>>>>>>- Will a database OR filesystem be more scalable i.e. which
>>>>>>
>>>wil perform
>>>
>>>>>>>better when there are 10000 images in the libary?
>>>>>>
>>>>>>Filesystem should be quicker. You need to think about how
>>>>>
>>>you hash the
>>>
>>>>>>files up for the most even spread of files in each directory I guess.
>>>>>>
>>>>>>
>>>>>>Justin
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>--
>>>>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:
Thanks again Bob,
First off, the site is still being debugged off-line, and part of the problem, as you suggested is my confusion over UNIX SERVER and the Apache Server. OK. Got that.
What I'm trying to do:
Any file that utilizes $_SESSION variables accessed through username/password validation is accessed via https. This includes the original signup screen, logins, etc. The only place for http files are static files that display non-sensitive info, and that do not require db access.
> If you are trying to hide scripts with important information (ie, > passwords) then running a secure server will not work. They will STILL be > available from the internet, just at >https://mywebsite/myfilewithapassword.php.
If the user is not logged in, they get an error message, and can go no further since $_SESSION['authenticate'] must match their username/password. All I'm trying to do is to provide an extra layer of security by shoving all sensitive files into the 'secure' directory, outside of the DOCUMENT_ROOT (but I have no idea what 'doc_root' in PHP is for??).
From what I'm trying to accomplish, do I really need to bother setting the 'secure' directory outside of the document_root? Wouldn't the setup I've done so far suffice? At any rate, I've tried just setting :
https://localhost/secure/test.php -- it still gives a 404
Tia, Andre
On Wednesday 21 August 2002 10:12 pm, Bob Irwin wrote: > > Thanks Bob, > > > > Got a 404: File not Found. Checked the ssl_error_log as suggested, and > > found > > > a rather interesting entry: > > > > "No such file: /var/www/html/var/www/secure/test.php" > > Ahhh - ok - I thought you were including them internally from PHP. You are > actually linking to the file being SERVED by the web server in HTML. IN > this case, all you need to do is reference to it as > https://secureserveraddress/filename.php > > First of all, we need to understand this. We have two seperate servers > here, the unix server that apache is running on and the apache server (this > runs PHP, the secure server etc) itself. > > So... your normal website (served by the apache server) is at > http://mywebsite.com/files.php > > BUT 'files.php' is located ON THE UNIX SERVER as /var/www/html/files.php > > The /var/www/html/ is the UNIX path to the file. The users who are using > your APACHE server to get file do not see this in anyway. All they see is > what is in the root directory, ie, /var/www/html from > http://mywebsite.com/, this is exactly the same for the secure server, > except the served files are encrypted. > > Success in this depends on what you are trying to do. Are you trying to > secure files that contain information like your database passwords? Or are > you just trying to run PHP scripts that produce HTML on a secure server > (so that you can take credit card details from the remote users?). > > If you are trying to hide scripts with important information (ie, > passwords) then running a secure server will not work. They will STILL be > available from the internet, just at > https://mywebsite/myfilewithapassword.php. This is not easily explained > and I don't want to spend time going into it if its not what you're after, > but if this is what you are doing, let me know and I'll help out. > > If you are just trying to encrypted the data from the server to the user, > then you are doing the right thing, you just need to lose the > /var/www/secure/ in the https:// address. > > > Obviously it's goes to DOCUMENT_ROOT (pre-pending the/var/www/html) and > > adds > > > what I've asked for. So, how do I tell it where to look, and not the > > default > > > setting? > > > > How am I including them? Well, most of the action occurs from the menu so > > it's: > > > > <a href="https://localhost/var/www/secure/test.php">Testing for Bugs</a> > > (I've also tried /secure/test.php > > > > Any ideas what I'm messing up? > > > > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
attached mail follows:
Generally looking your browser preferences is a great help. For IE mac it's known as "helper applications", and lists what IE should do with each mime type.
Justin French
on 22/08/02 7:17 AM, Wm (luvs2shoot
hotmail.com) wrote:
> Is there a resource somewhere that would show what the various MIME types > are? For a file upload page, I want to include .TIF, .AI, .PSD, etc., in > addition to the "standard" GIF and JPG types... > > Thanx, > Wm > > > >
attached mail follows:
Hi guys, I know this is off topic but any help appreciated..... I have a high speed cable connection...(I get around 100k a second on downloads) and I own a 2 domains that are not hosted...coz I cant afford hosting...is there any way I can host these 2 domains from my comp? if you can tell me how or just point me in the general direction with a url or two I would appreciate it... I tried google but either I was using the wrong keywords or the answers were too high funda for me :-) Kindly help,thanks in advance, Cheers, -Ryan.
attached mail follows:
You basicaly need to have the domains point to IP address within your box. This is done via a domain name server (DNS).
I used to use bpc-users.org for this, but now my ISP kindly hosts xxxxxx.indent.com.au as my office server.
In other words, you need someone with a DNS to point your websites to your box.
You can get hosting from like US$5/month. Why bother with all this though?
Justin
on 22/08/02 12:42 PM, Ryan A (r
jumac.com) wrote:
> Hi guys, > I know this is off topic but any help appreciated..... > I have a high speed cable connection...(I get around 100k a second on > downloads) and I own a 2 domains that are not hosted...coz I cant afford > hosting...is there any way I can host these 2 domains from my comp? if you can > tell me how or just point me in the general direction with a url or two I > would appreciate it... > I tried google but either I was using the wrong keywords or the answers were > too high funda for me :-) > Kindly help,thanks in advance, > Cheers, > -Ryan. >
attached mail follows:
Hi, im trying to do this the most automate as possible... i want this scripts to make the input as the user ask, for example "3" then, each input must have a different name, i've tried with the "for" control structure but can't get to the point. then the fields are created in a db... anyone?
<? require("conexion.php"); $query=mysql_query("Select * from empresas_dpto order by id desc");
$form = "<input type=\"text\" name=\"duh\"> | ";
if ($tipo=="crear") {
// si la cantidad de campos requeridos es mayor a 40 entonces da error //
if ($crear_empresas > 40) {
?> <table width="100%" border="0" cellspacing="1" cellpadding="1" align="center"> <tr> <td> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#FF0000"><b>La Empresa no puede tener más de 60 Departamentos Haga click <a href="javascript:history.back()">aqui</a> para volver</b></font></div> </td> </tr> </table> <? } ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td> <div align="center"><font size="3" color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif"><b>Recuerde que los campos no pueden contener espacios a la hora de crear los departamentos </b> </font></div> </td> </tr> </table><br> <?
echo str_repeat($form, $crear_empresas);
}
else {
?>
<form name="x" method="post" action="aempresas.php?tipo=crear"> <input type="text" name="crear_empresas" value=""> <input type="submit" name="Submit" value="Elaborar Planillas"> </form>
<? } ?>
attached mail follows:
Well, already did, for the newbies like me the thing would go like this:
first php ====================aempresas.php====================================
<? require("conexion.php");
// si el tipo es igual a "crear" entonces...
if ($tipo=="crear") {
// si la cantidad de campos requeridos es mayor a 40 entonces da error //
if ($crear_empresas > 40) { ?> <table width="100%" border="0" cellspacing="1" cellpadding="1" align="center"> <tr> <td> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="3" color="#FF0000"><b>La Empresa no puede tener más de 60 Departamentos Haga click <a href="javascript:history.back()">aqui</a> para volver</b></font></div> </td> </tr> </table> <? } ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td> <div align="center"><font size="3" color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif"><b>Recuerde que los campos no pueden contener espacios a la hora de crear los departamentos </b> </font></div> </td> </tr> </table><br> <form name="forms" method="post" action="aempresas2.php"> <?
// Aqui defino el valor para la variable $i igual a uno hasta igual o menor que $crear_empresas // de manera que haga el conteo. $conteo = $crear_empresas;
for ($i = 1; $i <= $conteo; $i++){
echo $i; // Esta es la variable que contiene los distintos forms
$form = "<input type=\"text\" name=\"form[]\"> | ";
}
// hace un string repitiendo la cantidad de campos requeridos por el usuario
echo str_repeat($form, $crear_empresas); ?> <input type="submit" name="submit2" value="crear departamentos"> </form> <? // si no se cumple ninguna de las variables definidas entonces coloca lo siguiente para la creacion // de los inputs: }
else {
?>
<form name="x" method="post" action="aempresas.php?tipo=crear"> <input type="text" name="crear_empresas" value=""> <input type="submit" name="Submit" value="Elaborar Planillas"> </form>
<? } ?> ================================================= second php
<? require("conexion.php");
for ($i = 0; $i < count($form); $i++) { $query = "INSERT INTO empresas_dpto VALUES ('','" . $form[$i] . "','" . $empresa . "')";
mysql_query($query);
} ?>
================================================
;)
Flavio Bastos Amiel
attached mail follows:
Hi,
Just setting up a new db at a new domain and the connection script does not work. I've always been able to connect to a db using the following:
<?php
// Connect to the database server
$dbcnx =
mysql_connect("localhost",
"username", "password");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}
The host support suggests the following:
> Root as the mysql user and localhost as the server, unless you selected remote mysql > connections from the web control panel.
BTW: I DID select remote mysql. Should I unselect it?
FMI (forgive my ignorance):
What connection script should I use?
Thanks So Much in Advance, Jim Long
attached mail follows:
$dbhost = ''; // MySQL server hostname $dbuser = ''; // MySQL username $dbpass = ''; // MySQL password $dbname = ''; // MySQL database name
mysql_connect("$dbhost", "$dbuser") && mysql_select_db("$dbname") or $failed = "Could not connect to database.";
"Jim Long" <jim
jimlong.net> wrote in message
news:3D646230.C2E17CE1
jimlong.net...
> Hi,
>
> Just setting up a new db at a new domain and the connection script does
> not work.
> I've always been able to connect to a db using the following:
>
> <?php
>
> // Connect to the database server
> $dbcnx =
mysql_connect("localhost",
> "username", "password");
> if (!$dbcnx) {
> echo( "<P>Unable to connect to the " .
> "database server at this time.</P>" );
> exit();
> }
>
>
>
> The host support suggests the following:
>
> > Root as the mysql user and localhost as the server, unless you selected
remote mysql
> > connections from the web control panel.
>
> BTW: I DID select remote mysql. Should I unselect it?
>
> FMI (forgive my ignorance):
>
> What connection script should I use?
>
> Thanks So Much in Advance,
> Jim Long
attached mail follows:
maybe yuou could try passing the variables into an input hidden field, so you know the answer wont be uncomplete, and you insert all of them in the last page.
Flavio Bastos Amiel
"Rick Widmer" <php3
developersdesk.com> wrote in message
news:5.1.1.6.0.20020729100127.00a2d3c0
mail.developersdesk.com...
> At 01:56 PM 7/29/02 +0000, Tyler Durdin wrote:
> >I have a DB that will take answers to an 82 question survey, but i have
> >the survey divided into 4 html pages(forms) of 20 or so question per
page.
> >The people taking the survey are not required to fill out every question
> >on the survey. i was wondering how i can insert the data into the db this
> >way. For example,
> >the first html page goes to question #24 the next starts at 25 an goes to
> >47. How can i enter 25 to 47 into the db and keep it all in numerical
> >order when 1-24 are entered first? One more question, does anyone have
any
> >recommendations on how i can make it so the users can take page one of
the
> >survey and then come back and finish pages 2 (or something similar to
this
> >where they finish one of the pages and come back to finish the others
> >later) later? Thanks in advance.
>
> If I was doing it, I would probably INSERT a mostly empty record in the
> database when they start the survey. It would just have the info to
> identify the person. Then on each page of the survey you can UPDATE the
> fields for that page. If you want to allow them to make changes it should
> be pretty easy.
>
> Rick
>
>
attached mail follows:
On Thursday 22 August 2002 10:12, Randy Johnson wrote: > I need some help, > > I need to go through a number of directories and rename each of the files > like this > > img001 > img002 > img003 > > do dir 1 would have > > img001 > img002 > img003 > > directory 2 might have > img004 > img005 > > and directory 3 would have > img006 > img007 > img008
Where is your question?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* According to the obituary notices, a mean and unimportant person never dies. */
attached mail follows:
Hey guys, got a basic question for you...
<? function getvar() { $vari = "bollocks"; }
getvar(); echo $vari; ?>
How do I make that function return the variable?
Thanks, Liam
attached mail follows:
You need to declare $vari as a global variable.
eg;
<? function getvar() { global $vari;
$vari = "bollocks"; } getvar(); echo $vari; ?>
Best Regards
Bob Irwin
Server Admin & Web Programmer
Planet Netcom
----- Original Message -----
From: "Liam MacKenzie" <phplist
operationenigma.com>
To: <php-general
lists.php.net>
Sent: Thursday, August 22, 2002 1:27 PM
Subject: [PHP] Dumb question
> Hey guys, got a basic question for you... > > > > <? > function getvar() > { > $vari = "bollocks"; > } > > getvar(); > echo $vari; > ?> > > > How do I make that function return the variable? > > > Thanks, > Liam > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/ > > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
attached mail follows:
In article <000901c2498b$ce972950$0e00a8c0
luke>,
phplist
operationenigma.com says...
> Hey guys, got a basic question for you...
>
>
>
> <?
> function getvar()
> {
> $vari = "bollocks";
> }
>
> getvar();
> echo $vari;
> ?>
>
>
> How do I make that function return the variable?
>
>
> Thanks,
> Liam
Strangely, by using return.
function getvar() { $vari = "bollocks"; return $vari; }
$answer = getvar(); echo $answer; ?>
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
I'm having a weird problem with the certain "date" fields using the imap_head() object in PHP4. Sorry about the long lines, but I wanted to get all the fields for imap_header() in so you could see what I mean.
Index Size udate date Date MailDate 0 2365 1023729291 Fri, 5 Apr 2002 08:30:42 -0800 Fri, 5 Apr 2002 08:30:42 -0800 10-Jun-2002 10:14:51 -0700 1 1611 1023729291 14 Apr 2002 23:33:02 -0000 14 Apr 2002 23:33:02 -0000 10-Jun-2002 10:14:51 -0700 2 2582 1023729291 Wed, 17 Apr 2002 11:55:26 -0500 Wed, 17 Apr 2002 11:55:26 -0500 10-Jun-2002 10:14:51 -0700 3 1745 1023729291 Thu, 18 Apr 2002 11:43:30 GMT Thu, 18 Apr 2002 11:43:30 GMT 10-Jun-2002 10:14:51 -0700 4 2322 1023729290 Wed, 1 May 2002 15:21:02 +1000 Wed, 1 May 2002 15:21:02 +1000 10-Jun-2002 10:14:50 -0700
The "udate" are all the same but one and they don't match what the real date of the email head says. They do however, match the "MailDate" field. Here's the phpinfo()
IMAP Supportenabled IMAP c-Client Version4.1 Apache-AdvancedExtranetServer/1.3.23 PHP Version 4.1.2
Any help is greatly appreciated!
Dave Christensen
attached mail follows:
Sorry all, I can't type. The reference should be "imap_header()" and also, here's a snip of the code I'm using:
>>SNIP
$mbox = imap_open("{localhost:143}","user","pass") or die("can't connect: ".imap_last_error());
for($i=1; $i <= 5; $i++) { $msg_header = imap_header($mbox,$i); print "<tr>\n"; print "<td>" . $i . "</td>\n"; print "<td align=right>" . $msg_header->Size . "</td>\n"; print "<td>" . $msg_header->udate . "</td>\n"; print "<td>" . $msg_header->date . "</td>\n"; print "<td>" . $msg_header->Date . "</td>\n"; print "<td>" . $msg_header->MailDate . "</td>\n"; print "</tr>\n"; }
<< SNIP
On Wed, 2002-08-21 at 20:42, David Christensen wrote: > I'm having a weird problem with the certain "date" fields using the > imap_head() object in PHP4. Sorry about the long lines, but I wanted to > get all the fields for imap_header() in so you could see what I mean. > > > Index Size udate date Date MailDate > 0 2365 1023729291 Fri, 5 Apr 2002 08:30:42 -0800 Fri, 5 Apr 2002 08:30:42 -0800 10-Jun-2002 10:14:51 -0700 > 1 1611 1023729291 14 Apr 2002 23:33:02 -0000 14 Apr 2002 23:33:02 -0000 10-Jun-2002 10:14:51 -0700 > 2 2582 1023729291 Wed, 17 Apr 2002 11:55:26 -0500 Wed, 17 Apr 2002 11:55:26 -0500 10-Jun-2002 10:14:51 -0700 > 3 1745 1023729291 Thu, 18 Apr 2002 11:43:30 GMT Thu, 18 Apr 2002 11:43:30 GMT 10-Jun-2002 10:14:51 -0700 > 4 2322 1023729290 Wed, 1 May 2002 15:21:02 +1000 Wed, 1 May 2002 15:21:02 +1000 10-Jun-2002 10:14:50 -0700 > > > The "udate" are all the same but one and they don't match what the real date of the email head says. They do however, match the "MailDate" field. Here's the phpinfo() > > IMAP Supportenabled IMAP c-Client Version4.1 > Apache-AdvancedExtranetServer/1.3.23 > PHP Version 4.1.2 > > Any help is greatly appreciated! > > Dave Christensen > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
On 21 Aug 2002 at 17:55, Shane wrote:
> Anyone know if there is a place I can query US shipping rates from say > UPS or FedEx? Possibly through Amazon's API?
I'm surprised on one has sold access to these. Back in the days when I did ecommerce:) I had carts that would use something like curl I guess and parse the remote files to get rates but I setup tables in mysql with data you can get from the UPS and from FedEx. UPS will send you a floppy disk (what they did to me) and you can reorganize or use the data structure as is (oh forgot, that was the USPS that did that).
UPS:
http://www.ups.com/using/software/currentrates/rates_in_us.html#zones
USPS
http://postcalc.usps.gov/Zonecharts/
Not too helpful but they'll sell you (about US$35.00 I think) a floppy with a matrix of all that stuff or you can just get the data for your shipping point of origin(s)
Try this:
FEDEX
http://www.fedex.com/servlet/RateFinderServlet?orig_country=US&language= english
has a link to download rates:
http://www.fedex.com/us/rates/downloads/?link=2
The problem with putting these rates in a database is that they will change and how will you know? I think Amazon has done a real good thing here that might wake up some other companies. All this stuff was available years ago. Who's working at these big companies.
Here is a site with lots of shipping info:
http://shipping.langenberg.com/
Peter
-- http://www.coremodules.com/ PETER J. SCHOENSTER (901)-652-2002
attached mail follows:
attached mail follows:
<? function getvar() {
$vari = "bollocks"; # this $vari is local to function }
$vari = getvar(); # this $vari is in global space echo $vari ?>
On Wed, 2002-08-21 at 20:35, Bob Irwin wrote:
> You need to declare $vari as a global variable.
>
>
> eg;
>
> <?
> function getvar()
> {
> global $vari;
>
> $vari = "bollocks";
> }
>
> getvar();
> echo $vari;
> ?>
>
> Best Regards
> Bob Irwin
> Server Admin & Web Programmer
> Planet Netcom
> ----- Original Message -----
> From: "Liam MacKenzie" <phplist
operationenigma.com>
> To: <php-general
lists.php.net>
> Sent: Thursday, August 22, 2002 1:27 PM
> Subject: [PHP] Dumb question
>
>
> > Hey guys, got a basic question for you...
> >
> >
> >
> > <?
> > function getvar()
> > {
> > $vari = "bollocks";
> > }
> >
> > getvar();
> > echo $vari;
> > ?>
> >
> >
> > How do I make that function return the variable?
> >
> >
> > Thanks,
> > Liam
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
> >
> > Scanned by PeNiCillin http://safe-t-net.pnc.com.au/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
('binary' encoding is not supported, stored as-is) Why not share a session DB across both servers?
Since your users disable cookies you'll have a url that looks like this anyway: http://www.myPHPserver.com/index.php?sid=12345 if you wanted to maintain session state
so, when redirecting to the ASP server do: header('location: http://www.myASPserver.com/default.asp?sid=12345')
then have default.asp open the DB that has the sessions for the PHP server through ODBC or ADO or whatever and match the session id pulling out the stored info for that session.
-GED
attached mail follows:
You cannot avoid using cookies. When you use Sessions web server is making use of cookies (unless you go for URL rewriting) which remains in the browser until one quits the browser.
To tackle your situation, you can effectively make use of a database table and a session cookie:
1. set a session cookie (different from one set by the server) as a soon as as a login is successful. This cookie should be set in such a way that the browser will send it back to any server in your domain. The value for this cookie can be the same as the value PHP generated for the Session ID. If you prefer to use some other value make sure that it is different for each session for each user to avoid security issues.
2. Store this value and the user ID (or something else to identify that user in your app) in a table.
3. Remove this row from the table when the user logs out or on Session timeout.
Now, when the user is taken to your ASP server, browser will send that cookie set by the PHP server along with the request and the ASP server can query the database for that cookie value to get the user ID. If it can find it in the table the application can make sure that the request is valid and the rest of the info can be pulled from the database.
Anil
On Wed, 21 Aug 2002, Mark McCulligh wrote:
> I have two server. One running PHP/Linux the other running ASP/2000.
> The user logins into the PHP server and session variables are made to hold
> their username, password, department, etc.. The site from time to time
> redirect the user to the ASP server. I want to pass the session variable
> across to the other server. I can't use the GET method.
> (www.domain.com/form.asp?username=Mark.....) because putting the password on
> the address bar is not an option. The ASP server will redirect them back
> when they are done on it. It will pass back the variables just in case the
> session on the PHP server has expired for the PHP server can create a new
> session if needed.
>
> I don't want to use a cookie.
>
> I was thinking of using cURL but I can't fine any information about using it
> in ASP. I know how to use cURL in PHP to redirect the user to the ASP
> server and pass the variables in the POST method, but not the other way.
>
> Any ideas would be a GREAT help.
> Mark.
>
> _________________________________________
> Mark McCulligh, Application Developer / Analyst
> Sykes Canada Corporation www.SykesCanada.com
> mmcculli
SykesCanada.com
>
>
>
-- +91 471 324341 (Office) +91 98473 22280 (Cell)Linuxense Information Systems Pvt. Ltd., Trivandrum, India http://www.linuxense.com
attached mail follows:
I have a simplistic forum, and I am trying to write some code to determine if the message box actually contains information, because if it is blank I obviously don't want to post it to the database. The message box has the name of 'reply'. Here is the code I'm trying to use, but its not working:
$reply2 = str_replace(" ","",$reply); if(empty($reply2)){ // echo some error message to the user that they can't post a blank message } else{ // post the message }
This however didn't work for me. So I had the thought that maybe the variable $reply2 isn't set because it is blank. So I tried this:
$reply2 = str_replace(" ","",$reply); if(empty($reply2) || !isset($reply2)){ // echo an error message } else{ // post the message. }
I've tried different variations on this same idea, but somehow none of them are working. Can anyone give me any suggestions or insight?
Jason Cathcart Check Out My Site: http://www.biohazardous.org
attached mail follows:
Use trim() instead of that str_replace and then an if(empty())
On Wed, 21 Aug 2002, Jason wrote:
> I have a simplistic forum, and I am trying to write some code to determine > if the message box actually contains information, because if it is blank I > obviously don't want to post it to the database. The message box has the > name of 'reply'. Here is the code I'm trying to use, but its not working: > > $reply2 = str_replace(" ","",$reply); > if(empty($reply2)){ > // echo some error message to the user that they can't post a blank message > } > else{ > // post the message > } > > This however didn't work for me. So I had the thought that maybe the > variable $reply2 isn't set because it is blank. So I tried this: > > $reply2 = str_replace(" ","",$reply); > if(empty($reply2) || !isset($reply2)){ > // echo an error message > } > else{ > // post the message. > } > > I've tried different variations on this same idea, but somehow none of them > are working. Can anyone give me any suggestions or insight? > > Jason Cathcart > Check Out My Site: http://www.biohazardous.org > >
attached mail follows:
Hi all,
Having trouble with the logic behind this.
I have a dynamic SKU, and a dynamic size_range array.
Examples:
$sku = '44044'; $size_range = array('S', 'M', 'L');
Which I use to build a pull down select box:
<SELECT name="myselect"> <? foreach($sizes as $k => $v) { echo "<OPTION value=\"$v\">$v</OPTION>"; } ?> </SELECT>
Note, the select's name is just a string now, not an array. Sinxe there are many SKU's on the page, What I'd like to do is dynamically generate this name, so that each SKU is part of an array. Eg:
$selected_size['44044'] = 'M'; $selected_size['44045'] = 'S'; $selected_size['44046'] = 'L'; etc etc
This will make processing the data HEAPS easier.
So I need to dynamically generate the SELECT's name:
<SELECT name="selected_size['<?=$sku?>']>
Easy.
BUT, since this form may be spat back out to the user if fields were left blank, etc etc, I like to do something like:
<SELECT name="myselect"> <? foreach($sizes as $k => $v) { $myselect = $_POST['myselect']; if($myselect == $v) { $sel = " selected"; } else { $sel = ""; } echo "<OPTION value=\"{$v}\"{$sel}>{$v}</OPTION>"; } ?> </SELECT>
Which ensures that any values they did select will still be selected when they get given the form again to make changes.
Trouble is, with a dynamically assigned SELECT name, I have no idea how to test for an existing value.
I thought it'd be something like:
<SELECT name="myselect['<?=$sku?>']"> <? foreach($sizes as $k => $v) { $myselect["$sku"] = $_POST['myselect']["$sku"]; if($myselect["$sku"] == $v) { $sel = " selected"; } else { $sel = ""; } echo "<OPTION value=\"{$v}\"{$sel}>{$v}</OPTION>"; } ?> </SELECT>
But this isn't working. My guess is that I need variable variables, or some other way of referencing the select's name.
Any ideas welcome.
Justin French
attached mail follows:
Solved it -- I *can* do what I wanted without variable variables... it was human error.
Justin French
on 22/08/02 4:09 PM, Justin French (justin
indent.com.au) wrote:
> Hi all, > > Having trouble with the logic behind this. > > I have a dynamic SKU, and a dynamic size_range array. > > Examples: > > $sku = '44044'; > $size_range = array('S', 'M', 'L'); > > > Which I use to build a pull down select box: > > <SELECT name="myselect"> > <? > foreach($sizes as $k => $v) > { > echo "<OPTION value=\"$v\">$v</OPTION>"; > } > ?> > </SELECT> > > > Note, the select's name is just a string now, not an array. Sinxe there are > many SKU's on the page, What I'd like to do is dynamically generate this > name, so that each SKU is part of an array. Eg: > > $selected_size['44044'] = 'M'; > $selected_size['44045'] = 'S'; > $selected_size['44046'] = 'L'; > etc etc > > This will make processing the data HEAPS easier. > > > So I need to dynamically generate the SELECT's name: > > <SELECT name="selected_size['<?=$sku?>']> > > Easy. > > > BUT, since this form may be spat back out to the user if fields were left > blank, etc etc, I like to do something like: > > <SELECT name="myselect"> > <? > foreach($sizes as $k => $v) > { > $myselect = $_POST['myselect']; > if($myselect == $v) { $sel = " selected"; } else { $sel = ""; } > echo "<OPTION value=\"{$v}\"{$sel}>{$v}</OPTION>"; > } > ?> > </SELECT> > > Which ensures that any values they did select will still be selected when > they get given the form again to make changes. > > Trouble is, with a dynamically assigned SELECT name, I have no idea how to > test for an existing value. > > I thought it'd be something like: > > <SELECT name="myselect['<?=$sku?>']"> > <? > foreach($sizes as $k => $v) > { > $myselect["$sku"] = $_POST['myselect']["$sku"]; > if($myselect["$sku"] == $v) { $sel = " selected"; } else { $sel = ""; } > echo "<OPTION value=\"{$v}\"{$sel}>{$v}</OPTION>"; > } > ?> > </SELECT> > > But this isn't working. My guess is that I need variable variables, or some > other way of referencing the select's name. > > Any ideas welcome. > > > > Justin French >
attached mail follows:
Hi,
I want to make a web page that can retrive data from my tables automatically, periodically. Does PHP have some timer control ? I know we can do with JavaScript (setInterval() or setTimeOut()) but I cann't join java script with PHP.
I've tried make simple script with JavaScript to open new window that contain PHP script for show current time every 5 seconds.
function showData() { newWindow = Window.open('data.php','screen'); }
function loadData() { setInterval('showData()','5000') }
data.php :
<? echo date("l dS of F Y h:i:s A"); ?>
in result, data.php will reload every 5 seconds, but it doesn't change.
Can someone help me and give me suggestion ?
TIA
regards,
Budi Kelana
attached mail follows:
your pages should be dynamic, meaning every time user open your page it keep on getting data from table how about using the Meta tags from html it will refresh you page in x seconds (define x as you need)
<meta http-equiv="refresh" content="x">
On Thursday 22 August 2002 02:01 pm, Budi Kelana wrote: > Hi, > > I want to make a web page that can retrive data from my tables > automatically, periodically. > Does PHP have some timer control ? > I know we can do with JavaScript (setInterval() or setTimeOut()) but I > cann't join java script with PHP. > > I've tried make simple script with JavaScript to open new window that > contain PHP script for show current time every 5 seconds. > > function showData() { > newWindow = Window.open('data.php','screen'); > } > > function loadData() { > setInterval('showData()','5000') > } > > data.php : > > <? > echo date("l dS of F Y h:i:s A"); > ?> > > in result, data.php will reload every 5 seconds, but it doesn't change. > > Can someone help me and give me suggestion ? > > TIA > > regards, > > Budi Kelana
-------------------------------------------------------
attached mail follows:
Hello,
Another possibility might be to open a persistent http connection so the update would be in realtime instead of intervals of x seconds and with a cronjob it might as well be periodically *g* search for fsockopen() or 'persistant http conection'
I can confirm Yamins answer also as a much easier way, as long as you are not trying to make a _good_ phpchat.
greetz Jochen
P.S. This is my first post in this mailinglist :)
*********** REPLY SEPARATOR ***********
On 22.08.02 at 15:44 Yamin Prabudy wrote:
>your pages should be dynamic, meaning every time user open your page it >keep >on getting data from table >how about using the Meta tags from html it will refresh you page in x >seconds >(define x as you need) > ><meta http-equiv="refresh" content="x"> > >On Thursday 22 August 2002 02:01 pm, Budi Kelana wrote: >> Hi, >> >> I want to make a web page that can retrive data from my tables >> automatically, periodically. >> Does PHP have some timer control ? >> I know we can do with JavaScript (setInterval() or setTimeOut()) but I >> cann't join java script with PHP. >> >> I've tried make simple script with JavaScript to open new window that >> contain PHP script for show current time every 5 seconds. >> >> function showData() { >> newWindow = Window.open('data.php','screen'); >> } >> >> function loadData() { >> setInterval('showData()','5000') >> } >> >> data.php : >> >> <? >> echo date("l dS of F Y h:i:s A"); >> ?> >> >> in result, data.php will reload every 5 seconds, but it doesn't change. >> >> Can someone help me and give me suggestion ? >> >> TIA >> >> regards, >> >> Budi Kelana > >------------------------------------------------------- > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
"Budi Kelana" <deeboed
softhome.net> wrote in message
news:20020822070118.92400.qmail
pb1.pair.com...
> Hi,
>
> I want to make a web page that can retrive data from my tables
> automatically, periodically.
> Does PHP have some timer control ?
> I know we can do with JavaScript (setInterval() or setTimeOut()) but I
> cann't join java script with PHP.
>
> I've tried make simple script with JavaScript to open new window that
> contain PHP script for show current time every 5 seconds.
>
> function showData() {
> newWindow = Window.open('data.php','screen');
> }
>
> function loadData() {
> setInterval('showData()','5000')
> }
>
> data.php :
>
> <?
> echo date("l dS of F Y h:i:s A");
> ?>
>
> in result, data.php will reload every 5 seconds, but it doesn't change.
>
> Can someone help me and give me suggestion ?
> TIA
> regards,
> Budi Kelana
>
Not quite sure what you want to do... but why don't you just enclose your JavaScript in a PHP Script...
echo "<language = javascript>" echo 'function Afunc(){ .... .... }';
Or alternatively, this is the way I would approach it (and forgive me if I'm getting a head of myself and misunderstood the question): - if you are on a Linux/UNIX type machine you could use Unix tools to achieve the desired effect by time intervals... One way of doing this is to implement code that utilizes the cron utility. Use cron to execute a script at the desired time intervals, the output of what ever script is executed can hence be written to a file and read using php and finally spatt out onto your page...
Hope this helps...
Spike...
attached mail follows:
Hi again,
i got a question concerning OOP, would be nice if anyone could help.
I am trying to build a class that builds SQL statements dynamically like i send tablenames, fieldnames, etc and it should build select, insert, update... statements. e.g. i have a table PERS_DATA with following structur :
ID | FIRSTNAME varchar(40) | LASTNAME varchar(40) | REGISTRATION date | AGE int (5) (sure it makes no sence to save the age but itīs an example)
Now i want to save postdata of a registerform in this table and it should work like this :
$query_obj = new sql_class('insert','PERS_DATA',$postvars); $db_obj = new db_class(); $db_obj -> query ($query_obj -> sql);
sql_class should instance a check_persdat_postvars_class that sends me a predefined error in case the entries of the form where wrong (age not numeric for example)
Now the sql class would have to build a insertstatement like this :
$fields = ""; $vals = ""; $i=0; while ( list ( $key,$val ) = each ( $param_arr ) ) { if (!empty($i)) { $fields .= ','; $vals .= ','; } $fields .= $key; $vals .= $val; $i++; } $this -> SQL = "insert into $table ($fields) values ($vals)";
but elements of $vals 'can' be strings and some can be numeric...
Do you think itīs a good idea to make queries to find out about fieldtypes as i need that info to set quotes for the string entries? Or do you think i should predefine it instead in the class that checks the postvars?
Or do you think i have a absolute stupid idea?
Tia
regards
Jochen
attached mail follows:
Hi every1 I got this script that works fine on my local windows pc but on the remote server (FreeBSD) I get this message:
Warning: Wrong datatype for first argument in call to in_array in /usr/local/......
the script should bookmark an user choice storing it in the $_SESSION["bkmks"] array. this is the code: $rty->mark($id,$tab); // call to the method that perform a standard query on the db if(mysql_num_rows($rty->resu)) { //result $rec = mysql_fetch_array($rty->resu); if(!isset($_SESSION["bkmks"]) || !in_array($rec, $_SESSION["bkmks"])) { $_SESSION["bkmks"][] = $rec;
when I store for the first time no problem ... When I try to store another item or the same item again I got that awful error
thanks in advance ! Ricky
attached mail follows:
Hi Riccardo,
> if(mysql_num_rows($rty->resu)) { //result > $rec = mysql_fetch_array($rty->resu); > if(!isset($_SESSION["bkmks"]) ||
When you save something for the first time, the element of $_SESSION["bkmks"] is a string and you can compare the array $rec with this string. >!in_array($rec, $_SESSION["bkmks"])) {
Than you convert the element into an array > $_SESSION["bkmks"][] = $rec;
and AFAIK in_array() canīt compare two arrays, correct me if i am wrong...
Greetings
Jochen
*********** REPLY SEPARATOR ***********
On 22.08.02 at 12:06 Riccardo Sepe wrote:
>Hi every1 I got this script that works fine on my local windows pc but >on the remote server (FreeBSD) >I get this message: > >Warning: Wrong datatype for first argument in call to in_array in >/usr/local/...... > >the script should bookmark an user choice storing it in the >$_SESSION["bkmks"] array. >this is the code: >$rty->mark($id,$tab); // call to the method >that perform a standard query on the db > if(mysql_num_rows($rty->resu)) { //result > $rec = mysql_fetch_array($rty->resu); > if(!isset($_SESSION["bkmks"]) || >!in_array($rec, $_SESSION["bkmks"])) { > $_SESSION["bkmks"][] = $rec; > >when I store for the first time no problem ... When I try to store >another item or the same item again >I got that awful error > >thanks in advance ! > > Ricky > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Dear programmers,
I have some trouble setting up a php nuke version on http://www.mydomain.be/nuke I have put all the files in the directory nuke. But when I start the first page I get error messages. Apparantly the files are searched in www.mydomain.be and not in the directory nuke. How can i solve this problem?
I already put in the config.php the url to my site as http://www.mydomain.be/nuke but this doesn't seem to solve my problem.
Any tips or tricks r welcome!!!!
-- Thomas Goeminne Executive NV Kortrijksepoortstraat 7 9000 Gent Belgium Tel/fax: + 32 9 223 0393 BTW: BE 455.676.207 URL: http://clik.to/bomb
attached mail follows:
On Thursday 22 August 2002 18:20, Thomas Goeminne wrote: > Dear programmers, > > I have some trouble setting up a php nuke version on
Just because there is php in the name phpnuke, it does not automatically mean it's a php question. You are asking in the wrong place. Try the phpnuke support forums.
> http://www.mydomain.be/nuke I have put all the files in the directory nuke. > But when I start the first page I get error messages.
Hey we're 'programmers' not mind readers. If you're posting this expecting some decent answers then it's a good idea to provide some decent information. What _are_ these error messages?
> Apparantly the files > are searched in www.mydomain.be and not in the directory nuke. How can i > solve this problem? > > I already put in the config.php the url to my site as > http://www.mydomain.be/nuke but this doesn't seem to solve my problem.
Presumably you _have_ followed the installation instructions? IIRC after copying the phpnuke files you have to run install.php (or something like that) to initialise the thing and to write out a config file. I'm not sure that you had to edit config.php by hand.
As I said above, you'll probably get better help over at the phpnuke support forums.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* "Even if you're on the right track, you'll get run over if you just sit there." -- Will Rogers */
attached mail follows:
I am getting this message running one off my neat scripts? what does the basedir restriction mean?
Warning: open_basedir restriction in effect. File is in wrong directory in /www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php on line 175
Warning: Failed opening '/admin/includes/include_once.php' for inclusion (include_path='/www/T/tgoeminne/web/www.hiphopstore.be') in /www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php on line 175
Warning: open_basedir restriction in effect. File is in wrong directory in /www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php on line 183
Warning: Failed opening '/admin/includes/include_once.php' for inclusion (include_path='/www/T/tgoeminne/web/www.hiphopstore.be') in /www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php on line 183
Fatal error: Call to undefined function: tep_session_start() in /www/T/tgoeminne/web/www.hiphopstore.be/admin/includes/application_top.php on line 186
-- Thomas Goeminne Executive NV Kortrijksepoortstraat 7 9000 Gent Belgium Tel/fax: + 32 9 223 0393 BTW: BE 455.676.207 URL: http://clik.to/bomb
attached mail follows:
On Thursday 22 August 2002 19:31, Thomas Goeminne wrote: > I am getting this message running one off my neat scripts? what does the > basedir restriction mean?
Put simply you're not allowed to access files that are outside of the directory specified by "open_basedir".
See php.ini and manual -> Safe Mode
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* So you're back... about time... */
attached mail follows:
How to create pattern for function eregi_replace to replace in html document every html tag <a href="...."> for empty string.
Thanks
roman
attached mail follows:
eregi_replace('<a href[^>]+>','',$string);
Op donderdag 22 augustus 2002 14:42, schreef Roman Duriancik: > How to create pattern for function eregi_replace to > replace in html document every html tag <a href="...."> for empty string. > > Thanks > > > roman
attached mail follows:
I've set up a mysql db to store all news updates at our site and I'm thinking about setting up a search function so our visitors can search the news db after specifics words or strings. Is there somewhere some nice place that have posted a "change-some-variables-then-its-ready-to-go" PHP file some where ? Or do I have to start all from scratch ?
/Kris
attached mail follows:
jochen schultz wrote:
> Hi Riccardo, > > > >> if(mysql_num_rows($rty->resu)) { //result >> $rec = mysql_fetch_array($rty->resu); >> if(!isset($_SESSION["bkmks"]) || > > > When you save something for the first time, the element of > $_SESSION["bkmks"] is a string and you can compare the array $rec with > this string. > > >> !in_array($rec, $_SESSION["bkmks"])) { >> > > > Than you convert the element into an array > >> $_SESSION["bkmks"][] = $rec; >> > > > and AFAIK in_array() canīt compare two arrays, correct me if i am > wrong... > > > Greetings > Jochen > > > > I think I've sorted it out .... at least I know why it doesn't work:
bool in_array ( mixed needle, array haystack [, bool strict]) Searches haystack for needle and returns TRUE if it is found in the array, FALSE otherwise. If the third parameter strict is set to TRUE then the in_array() function will also check the types of the needle in the haystack. Note: If needle is a string, the comparison is done in a case-sensitive manner. Note: In PHP versions before 4.2.0 needle was not allowed to be an array. PHP on the server is 4.1.2 !!!
Is a foreach loop the only thing that I can do???
regards
Ricky
attached mail follows:
Hi,
I am using a session variable to create an area where customers can access certain pages via login/password. If they successfully login, I create a session variable and initialize it with their logon username.
I also have a logout button which unregisters the session variables and issues a session_unset() and session_destroy(). Then is takes them back to the login page.
Now all my pages in this area first check if the session variable is set and if not, displays a message that the user must first login.
I noticed that after logging out and clicking click on the "Back" button in my browser, it takes me back to the previous page which is does NOT display the warning that the user must login. However, when I click on the Refresh, it does. Is this some sort of caching problem? I note that other sites with similar setups do not have this problem. When I click on the "Back" button, I saw an expiry message.
How can I emulate this please?
Thanks, Don
attached mail follows:
Really I am just thinking out loud here as the subject just came up in an early morning meeting, so bear with me (I look forward to your opinions / ideas on this) ...
Does the autoglobal $_FILES contain a ['time'] or ['timestamp']? If not I could use a filemtime() to test each file.
Anyhow, we have some files on an Intranet for which I have created a file management utility that will upload the file, return lists of files as links, delete files, etc. "Can we upload files that replace existing files?" was the question asked this morning. I off handedly said that this would not be a problem, as long as the updated file was the same name as the existing file.
I want to compare file datetimes so that I can make sure a newer file replaces an older one. move_uploaded_file() threw no errors or warnings when overwriting a file of the same name (kinda' scary, huh?) and type. I will add a confirmation to ask "Hey, you know a file by that name exists already, do you really want to replace it?". Maybe I should move a file to be updated to a 'lower' folder as backup.
upload file? yes -> does file exist? yes -> is existing older? yes -> move to 'lower' directory, upload newer into current directory
Opinions, ideas, criticisms?
Jay
***********************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* San Antonio Area PHP Developers Group *
* Interested? Contact jay.blanchard
niicommunications.com *
***********************************************************
attached mail follows:
Hi list,
I have a form to post resumes. In one parte the user have a option to choose up to 5 languages and his knowledge in it. example : english: basic advanced .... My problem is that was stored serialized in the BD and now I need to do a search by language and knowledge. How can I do this. I've tried everything unsuccessfully. example: search english advanced. If the user have english basic and another advanced he/her appear in the search.
Thank's in advance
Rodrigo
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]