[PHP] If statement w/ multiple conditions
I'll be trying to use a routine that checks 4 seperate variables for content and need to know the easiest method to do so. The function works on 2 conditions; either all the variables are empty and I do something or I do something else. $lineone $linetwo $linethree $linefour Would you use if ($lineone && $linetwo && $linethree && $linefour = "") Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If statement w/ multiple conditions
All four must be an empty string. I will be pulling the values from a MySQL database. If these fields are empty I'll be prompting for information. If any one of them contain anything I'll be showing it to the user and asking if they want to change it. Thanks, Ed On Tue, 26 Nov 2002, Ernest E Vogelsinger wrote: > At 13:50 26.11.2002, [EMAIL PROTECTED] said: > [snip] > > I'll be trying to use a routine that checks 4 seperate variables for > >content and need to know the easiest method to do so. The function works > >on 2 conditions; either all the variables are empty and I do something or > >I do something else. > > > >$lineone > >$linetwo > >$linethree > >$linefour > > > > Would you use > > > >if ($lineone && $linetwo && $linethree && $linefour = "") > [snip] > > Your expression yields true if 1-3 are not-empty AND four is an empty > string. Not sure if that's what you want. > > All empty: > !($lineone || $linetwo || $linethree || $linefour) > --or-- > !$lineone && !$linetwo && !$linethree && !$linefour > > All set: > $lineone && $linetwo && $linethree && $linefour > > > -- >>O Ernest E. Vogelsinger >(\)ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] If statement w/ multiple conditions
The db will include these 4 rows even though they don't store data. Eventually they will contain data for contact info as soon as the users log in and it prompts them for it. On Tue, 26 Nov 2002, DL Neil wrote: > Ed, > Assuming there will be a response from the db-tbl, here is another choice: > > if ( $lineone . $linetwo . $linethree . $linefour > "" ) > { >//show it to the user and ask if they want to change it > } > else > { >//prompt for information > } > > Do you mean that the db-tbl will have a row of data even if the four fields > are empty, or if there is no data (in those fields) will that imply that > there is no row (and thus different code needed)? > =dn > > > > All four must be an empty string. I will be pulling the values from a > > MySQL database. If these fields are empty I'll be prompting for > > information. If any one of them contain anything I'll be showing it to > > the user and asking if they want to change it. > > > > Thanks, > > > > Ed > > > > > > On Tue, 26 Nov 2002, Ernest E Vogelsinger wrote: > > > > > At 13:50 26.11.2002, [EMAIL PROTECTED] said: > > > [snip] > > > > I'll be trying to use a routine that checks 4 seperate variables for > > > >content and need to know the easiest method to do so. The function > works > > > >on 2 conditions; either all the variables are empty and I do something > or > > > >I do something else. > > > > > > > >$lineone > > > >$linetwo > > > >$linethree > > > >$linefour > > > > > > > > Would you use > > > > > > > >if ($lineone && $linetwo && $linethree && $linefour = "") > > > [snip] > > > > > > Your expression yields true if 1-3 are not-empty AND four is an empty > > > string. Not sure if that's what you want. > > > > > > All empty: > > > !($lineone || $linetwo || $linethree || $linefour) > > > --or-- > > > !$lineone && !$linetwo && !$linethree && !$linefour > > > > > > All set: > > > $lineone && $linetwo && $linethree && $linefour > > > > > > > > > -- > > >>O Ernest E. Vogelsinger > > >(\)ICQ #13394035 > > > ^ http://www.vogelsinger.at/ > > > > > > > > > > > > -- > > > 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
Re: [PHP] Re: If statement w/ multiple conditions
That's what I was looking to acheive. Thanks! Ed On Tue, 26 Nov 2002, Craig wrote: > Something like this will work... > > > if(empty($_GET['1']) && empty($_GET['2']) && empty($_GET['3']) && > empty($_GET['4'])){ > > echo "All vars are EMPTY"; > > }else{ > > echo "Some vars contain Content"; > > } > > ?> > > > > > > <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > I'll be trying to use a routine that checks 4 seperate variables for > > content and need to know the easiest method to do so. The function works > > on 2 conditions; either all the variables are empty and I do something or > > I do something else. > > > > $lineone > > $linetwo > > $linethree > > $linefour > > > > Would you use > > > > if ($lineone && $linetwo && $linethree && $linefour = "") > > > > Thanks, > > > > Ed > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] How to handle "so called" expired sessions??
I've noticed this as well with the things I've been doing for sessions. They way I understand it is that the server side session storing values is supposed to expire after a certain lenght of time. I currently have this at default so I think it should expire after 24 mins. The cleanup is done within php itself so nothing is cleaned up until php is called again. Is this correct? If so, I have sessions located within my /tmp directory that are over 3 weeks old and have been there ever since they were first created. Ed On Wed, 4 Dec 2002, Tom Rogers wrote: > Hi, > > Wednesday, December 4, 2002, 4:01:07 AM, you wrote: > >> Ive just been getting myself deep into using sessions. > >> Sessions are working as it should except for one condition. > >> Say I log into the site, and the session is started, and I don't do > >> anything for the next 30 mins, then go back to the site. > >> Im temporarily logged out, but because the session cookie is still > JWH> good, > >> the next page load logs me back in. > >> How do the people who use sessions handle this type of scenario?? > > JWH> Whether your logged back in or not is dependant on your program. Once > JWH> you are gone for over X minutes, your session file is deleted. So, even > JWH> though the cookie is still good, the session will not have any data. > JWH> What's usually done is to check for a certain session value, like > JWH> $_SESSION['logged_in'] and if it's present, then continue, otherwise > JWH> force the user to log back in again. > > JWH> ---John Holmes... > > Not quite that simple as the cleanup proccess may not have run and the data is > still sitting there, I use msession so I am not sure if the normal session stuff > will return expired data after it expires and before it is deletedmsession > does so I hacked it to cleanup if expired data is requested. > > -- > regards, > Tom > > > -- > 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] Output of MySQl sorted query to text or Word file.
I've got a routine that queries a MySQL database and outputs the sorted results to a web page (script snippet below.) How can I output the exact same thing to a txt file using this script? $ Page Break"; $count = 0; } } while($row = mysql_fetch_array($result)); mysql_close(); } ?> Thanks in advance for any ideas Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Output of MySQl sorted query to text or Word file.
On Fri, 6 Dec 2002, Tim Ward wrote: > everything you need is here > > http://www.php.net/manual/en/ref.filesystem.php > > in particular fopen(), fputs(), fwrite(), etc. > > Tim Ward > http://www.chessish.com > mailto:[EMAIL PROTECTED] I found all this and have worked on getting the file output and formated to my (actually my boss') liking. The text file gets formatted just fine when read in Linux but the newlines appear as blocks when viewing in Windows. I've included the scipt that reads and formats the output below. What do I need to use to create real linefeeds or new lines when viewing under windows? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Output of MySQl sorted query to text or Word file.
success. And I have read through the user contributed notes and havent' found it there. Ed On Fri, 6 Dec 2002, 1LT John W. Holmes wrote: > > What do I need to use to create real linefeeds or new lines when viewing > > under windows? > [snip] > > $newline = "\n"; > > Use \r\n for Windows. > > ---John Holmes... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic vs. Static
When you compile php for apache using the dynamic module example used in the documentation, do you not get an exacutable php to use from the command line? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic vs. Static
Can I do that using the same src I used to create the dynamic module and both would work hapilly together? Thanks, Ed On Mon, 9 Dec 2002, John Nichel wrote: > No. To get the binary executable, compile it without the apache switch. > > [EMAIL PROTECTED] wrote: > > When you compile php for apache using the dynamic module example used in > > the documentation, do you not get an exacutable php to use from the > > command line? > > > > Ed > > > > > > > > > -- > By-Tor.com > It's all about the Rush > http://www.by-tor.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic vs. Static
Thanks to all that replied. Ed On Mon, 9 Dec 2002, John Nichel wrote: > Yes you can. Just use clean source, but the config line can be the same > less the "--with-apache" switch. > > [EMAIL PROTECTED] wrote: > > Can I do that using the same src I used to create the dynamic module and > > both would work hapilly together? > > > > Thanks, > > > > Ed > > > > > > On Mon, 9 Dec 2002, John Nichel wrote: > > > > > >>No. To get the binary executable, compile it without the apache switch. > >> > >>[EMAIL PROTECTED] wrote: > >> > >>> When you compile php for apache using the dynamic module example used in > >>>the documentation, do you not get an exacutable php to use from the > >>>command line? > >>> > >>>Ed > >>> > >>> > >>> > >> > >> > >>-- > >>By-Tor.com > >>It's all about the Rush > >>http://www.by-tor.com > >> > > > > > > > > > > > > > -- > By-Tor.com > It's all about the Rush > http://www.by-tor.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to force an image to reload
As one who has had to do the same thing and had gotten some help from this list I'll put in my two cents. the past > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always > modified > header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 > header("Cache-Control: post-check=0, pre-check=0", false); > header("Pragma: no-cache");// HTTP/1.0 > ?> > > Yama! > > > > if($submit == "Rotate 90") > { > $output=`mogrify -rotate 90 pictures/028_25.jpg`; > echo "$output"; > } > $submit=" "; > echo "new value of submit=$submit"; > ?> > > > > > > > > > > Regards & thanks in advance > Adam White > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to force an image to reload
Even though I did forget the ending > on the tag. Cool. Ed On Tue, 10 Dec 2002, Adam White wrote: > Many thanks Ed, works a treat! > > Regards > Adam White > > Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: 10 December 2002 18:31 > To: Adam White > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] How to force an image to reload > > > As one who has had to do the same thing and had gotten some help from > this list I'll put in my two cents. > > > > > the past > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always > > modified > > header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 > > header("Cache-Control: post-check=0, pre-check=0", false); > > header("Pragma: no-cache");// HTTP/1.0 > > ?> > > > > Yama! > > > > > > > > > if($submit == "Rotate 90") > > { > > $output=`mogrify -rotate 90 pictures/028_25.jpg`; > > echo "$output"; > > } > > $submit=" "; > > echo "new value of submit=$submit"; > > ?> > > > > > > > > > > > > > > > > > > > > Regards & thanks in advance > > Adam White > > > > > > > > -- > > 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
Re: [PHP] take text before '-' and after it
Wouldn't it be simpler to just remove the '-'? $var = str_replace("-","",$var); Ed On Thu, 12 Dec 2002, Antti wrote: > How can I take some text before the mark - and after it and put them for > example in array. The purpose of this is to read trough mp3 files which > are in the form of artist - song.mp3 and put them into a text file so I > can put them into mysql db. > > antti > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need to place a comma into a string of 4 or 5 digits
IF you're looking to break digits into thousands by use of a comma search the manual for number_format. Ed On Thu, 12 Dec 2002 [EMAIL PROTECTED] wrote: > Hello All! > > I am racking my brain and scouring the books and I can't seem to find a solution > to this simple problem. > > Any help is appreciated. > > Thanks > > Ruusvuu > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Disable session cookies
I'm guessing then that it's possible to use only server side sessions and use trans_id then if you need to store values throughout a site? Ed On Fri, 20 Dec 2002, John W. Holmes wrote: > > Is there any way to disable using cookies in sessions? I haven't found > a > > good > > reason to do this, only my boss's predisposition against cookies ;). > > Yep, session.use_cookies setting in php.ini. Set it to zero to not use > cookies. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Question
Does php use cookies for sessions even if you don't explicitly use cookie functions to save session data server side? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session Question
Sorry I didn't make myself more clear. I only want to use server side sessions. I don't want to have to rely on a client having cookies enabled in their browser. So far having trans_sid is just doing the trick. I can save values into sessions server side and not explicitly create a client side cookie with any values to retrieve the information. Thanks again, Ed On Fri, 3 Jan 2003, Ford, Mike [LSS] wrote: > -Original Message- > From: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > > Does php use cookies for sessions even if you don't explicitly use > cookie > functions to save session data server side? > -- > > That question doesn't even make sense to me -- cookie functions can't save > data server side, for one thing! Can you try to explain exactly what it is > you're trying to find out? > > Cheers! > > Mike > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Case Matching
Not really sure if this would be a PHP or a MySQL issue. I'm using a database to store username for authentication purposes. Is there a way to make the user entry match case in the mysql database? Right now I have some users with all uppercase usernames that are able to login typing their username in all lower case letters. TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] anyway to do a 'whos online' from session variable?
On Wed, 8 Jan 2003, Timothy Hitchens (HiTCHO) wrote: > Hmm... yes you could create an array of the files then check the last > mod stamp using stat (remember to reset stat). > > Sessions are also cleaned up via the garbage collection system > controlled via php.ini How do you force garbage collection? I've written an application using sessions for storage and there's been a session sitting in my /tmp directory for 2 days now, well over the 1440 seconds expiration. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] imageCreate() error
I'm running PHP 4.3 and W2k with IIS 5.0. I have enabled php_gd and it does show up when I do a phpinfo. The php_gd.dll is in the winnt/system32 directory (I've also tried it in almost every other directory too) and I get these error messages: Cannot add header information - headers already sent by (output started at C:\Inetpub\wwwroot\template\index.php:1) in C:\Inetpub\wwwroot\template\index.php on line 3 Fatal error: Call to undefined function: imagecreate() in C:\Inetpub\wwwroot\template\index.php on line 4 Here's the code: Any help would be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and PDF Forms
Anyone have some good examples of using PDF forms and parsing the form using PHP? I've done some searching (ala google and manual) but all they seem to mention is parsing a .fdf file. Seemingly when you use a PDF form and set the action to a php script a file is still generated on the client machine in the temp directory that inserts the context of the action taken by the script it's sending the form data to. For instance, I set a pdf form to pass the form data to a file called pdfform.php on my server. The pdfform.php file parses the data then stores it in a database. This works. From there the pdfform.php script sends the user to my homepage. What happens from here is the page comes up but is being called by a file on the local machine. The file po3426.html located in my temp directory is actually made up of the source code for my homepage. All I really want to do is yuse the data from the form and continue on with my script. How do I go about that? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and FDF
I'm trying to create web page based on a PDF Form with the action assigned to a php script to parse out the vars. It seems to be working because I can parse and write the vars to a database but it seems that a file is getting passed back to the client containing the output of the php script that was called. If I write in a header("Location") command and route the client to another page their browser opens a file locally on their computer that contains the source code of the page called. How do I just get the results of the form? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot show reuploaded image file on page unless manualrefresh
Aha! Something I can chime in on. I happened across the same scenario a few months back. The list helped me then so I'll give back. Call the image using a random identifier. $rand = rand(1000, ); echo "http://someurl.com/image.jpg?$rand";; Since the browser will more than likely not have the image file identified by the random number it must request it again from the server. Works great where I need it! Ed On Mon, 20 Jan 2003, Chris Shiflett wrote: > --- Phil Powell <[EMAIL PROTECTED]> wrote: > > I am using the following header() functions to force > > view.php to not cache: > > > > header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); > > header("Last-Modified: " . gmdate("D, d M Y H:i:s") . > > " GMT"); > > header("Cache-Control: no-store, no-cache, > > must-revalidate"); > > header("Cache-Control: post-check=0, pre-check=0", > > false); > > header("Pragma: no-cache"); > > :-) > > I think you killed it. > > > However, when a user reuploads a file in manage.php, it > > does a form post onto manage.php and reuploads the file > > (which I verified works). However, when redirected via > > header() to view.php, they still see their OLD image > > file, NOT the new one! Unless I manually refresh the > > page, they never see it, until they manually refresh the > > page, then the new image file appears! > > Right. > > I think you are forgetting that the image is not really > part of the PHP resource. Meaning, this is the series of > events for a PHP script that refernces a single image > called bar.jpg using the tag: > > 1. HTTP request sent for foo.php (Web client -> Web server) > 2. HTTP response sent that includes the output of foo.php >(Web server -> Web client) > 3. Web client (browser) notices tag referenced in >the HTML. > 4. HTTP request sent for bar.jpg (Web client -> Web server) > 5. HTTP response sent that includes bar.jpg > > So, the headers that you are setting only matter for the > resource returned in step 2. Meaning, the HTML output of > foo.php is not cached. The image, since it is returned by > the Web server and not your PHP script, is cached. > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] + in filenames
On Fri, 31 Jan 2003, Marek Kilimajer wrote: > I use this: > $name=strtr( $name, > " ?*#$%^:+=<>/\"", > "__"); > I'm hoping that double quote was a typo?? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] + in filenames
I'll be the first to admit I was wrong and missed that. This will work out great for me. I'm writting scripts for Realtors to upload photos to us via the web and you can only imagine what these people will include in a filename. Ed On Mon, 3 Feb 2003, Marek Kilimajer wrote: > That double quote is escaped > > [EMAIL PROTECTED] wrote: > > >On Fri, 31 Jan 2003, Marek Kilimajer wrote: > > > > > > > >>I use this: > >>$name=strtr( $name, > >>" ?*#$%^:+=<>/\"", > >>"__"); > >> > >> > >> > > > > > >I'm hoping that double quote was a typo?? > > > >Ed > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] authentication
There is a way to supposedly do this by authenticating a username and password through php first through such methods as database lookups and then passing the username and password through $PHP_AUTH_USER and $PHP_AUTH_PW using the header() command to point to the URL of the .htaccess protected directory but I have never gotten it to work myself. if ($pass = $pass) { header("Location:$PHP_AUTH_USER:$PHP_AUTH_PW@http://www.someprotectedsite.com";); } My command above my be wrong. I haven't tried it for a while. I know you can do such a thing on the Address bar of any browser and pass it that way though. Ed On Mon, 3 Feb 2003, Chris Winters wrote: > Chris, > > Exactly. I am relying on the webserver to provide the restrictions. > > Now my next question: > what functions should I utilize or come close to to do it? There isnt any > PHP pages directed towards teh directory itself. Its is just a hard link to > the protected areas. Are there any functions that support it? > > Im googling now ;) > > Thanks for your answers in advanced and previously. > Chris > > "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > --- Chris Winters <[EMAIL PROTECTED]> wrote: > > > So, if one was to protect a directory or folder, a > > > regular dialog will appear for username and passcode > > > prompt within the web browser. I was researching some > > > variables that I came across which is called > > > $PHP_AUTH_USER, $PHP_AUTH_PW, and $PHP_AUTH_TYPE. > > > > Yes, these variables deal with HTTP basic authentication. > > > > > I would like to by pass that by a user entering the > > > username and passcode via HTML, instead of the dialog > > > showing. > > > > In that case, you will want to do exactly as you say, > > collect the username and password via an HTML form and > > authenticate the credentials with PHP. It sounds like you > > are currently relying on your Web server to provide the > > access restrictions. > > > > So, you can either: > > > > 1. Keep HTTP basic authentication enabled in the Web server > > for these directories and live with the behavior. > > 2. Turn off HTTP basic authentication in the Web server and > > write a login page in PHP. It is then up to you to control > > access to whatever resources you want to protect, so this > > will require a bit of work on your part. > > > > Hope that helps. > > > > Chris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] authentication
I'm sorry the line should have been... header("Location:http://$PHP_AUTH_USER:$[EMAIL PROTECTED]";); Ed On Mon, 3 Feb 2003 [EMAIL PROTECTED] wrote: > > There is a way to supposedly do this by authenticating a username and > password through php first through such methods as database lookups and > then passing the username and password through $PHP_AUTH_USER and > $PHP_AUTH_PW using the header() command to point to the URL of the > .htaccess protected directory but I have never gotten it to work myself. > > if ($pass = $pass) { > > header("Location:$PHP_AUTH_USER:$PHP_AUTH_PW@http://www.someprotectedsite.com";); > > } > > My command above my be wrong. I haven't tried it for a while. I know you > can do such a thing on the Address bar of any browser and pass it that way > though. > > Ed > > > On Mon, 3 Feb 2003, Chris Winters wrote: > > > Chris, > > > > Exactly. I am relying on the webserver to provide the restrictions. > > > > Now my next question: > > what functions should I utilize or come close to to do it? There isnt any > > PHP pages directed towards teh directory itself. Its is just a hard link to > > the protected areas. Are there any functions that support it? > > > > Im googling now ;) > > > > Thanks for your answers in advanced and previously. > > Chris > > > > "Chris Shiflett" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > --- Chris Winters <[EMAIL PROTECTED]> wrote: > > > > So, if one was to protect a directory or folder, a > > > > regular dialog will appear for username and passcode > > > > prompt within the web browser. I was researching some > > > > variables that I came across which is called > > > > $PHP_AUTH_USER, $PHP_AUTH_PW, and $PHP_AUTH_TYPE. > > > > > > Yes, these variables deal with HTTP basic authentication. > > > > > > > I would like to by pass that by a user entering the > > > > username and passcode via HTML, instead of the dialog > > > > showing. > > > > > > In that case, you will want to do exactly as you say, > > > collect the username and password via an HTML form and > > > authenticate the credentials with PHP. It sounds like you > > > are currently relying on your Web server to provide the > > > access restrictions. > > > > > > So, you can either: > > > > > > 1. Keep HTTP basic authentication enabled in the Web server > > > for these directories and live with the behavior. > > > 2. Turn off HTTP basic authentication in the Web server and > > > write a login page in PHP. It is then up to you to control > > > access to whatever resources you want to protect, so this > > > will require a bit of work on your part. > > > > > > Hope that helps. > > > > > > Chris > > > > > > > > -- > > 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
Re: [PHP] authentication
I don't think the process is an extra step at all. In fact, it's just a trade off using one or the other. You can either login using php and a database backend or just authenticate using .htaccess directives. In my case (a few months back) what I was trying to do was offer up a single login page for 500 or so different companies each having their own directory on my server. Each directory is password protected via .htaccess. They would all login using my php interface which would in turn check the username and password for matching. Their database record would also contain the URL to their directory on my server. After logging in I tried to use a header call containing the username, password and URL but it never quite worked although you can actually do it in the address bar of the browser with ease. Theoretically it should work like a charm but I never got the chance to investigate any further because I was rushed off to the next "Big Project." Ed On Mon, 3 Feb 2003, Chris Shiflett wrote: > > There is a way to supposedly do this by authenticating > > a username and password through php first through such > > methods as database lookups and then passing the > > username and password through $PHP_AUTH_USER and > > $PHP_AUTH_PW using the header() command to point to the > > URL of the .htaccess protected directory but I have > > never gotten it to work myself. > > The variables $PHP_AUTH_USER and $PHP_AUTH_PW are available > to you when the user authenticates via HTTP basic > authentication. Thus, the user has already had to type in > the username and password into a separate window, which is > what the original poster is trying to avoid. > > To then send the user to another URL and supply the > authentication credentials in the URL itself just creates > an unnecessary step. > > > There isnt any PHP pages directed towards teh directory > > itself. Its is just a hard link to the protected areas. > > Are there any functions that support it? > > > > Im googling now ;) > > I'm still having a bit of trouble interpreting your > question, so Google might have a hard time, too. :-) > > If you are protecting static resources such as images and > HTML files with your Web server currently, the only way to > protect these with PHP is to store them outside of the > document root (so that your Web server cannot serve them > directly) and serve them with PHP (using > header("Content-Type: whatever")) once you have determined > whether the user should be allowed to access the particular > resource. > > Hopefully that can help refine your search. > > Chris > > -- > 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] Date format from file
Is it possible to read a string from a text file (i.e. 0502031130) and be able to use that in a date function such as: $date = date("dmyHi", strtotime('+28 days)); How would I use that string as the date in the above code? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date format from file
I'm not using this for any database related function. What I'm trying to do is come up with a method for scheduling processes needed for our company that are run through command line php scripts. I'll be using cron or to run a command that will check the date within the file and see if the process needs to be run on that day and then rewrite the date + 28 days back into the file spawning the process if need be. To the best of my knowledge cron cannot run schedules this way. It can only run on specific days or times outlined directly. Our processes must run every 28 days, not a specific day of the month. If there is any other scheduling system out there that can do this type of thing on Linux/Unix I'd much rather use it than doing it this way. Ed On Wed, 5 Feb 2003, John W. Holmes wrote: > > Is it possible to read a string from a text file (i.e. > > 0502031130) and be able to use that in a date function such as: > > > > $date = date("dmyHi", strtotime('+28 days)); > > > > How would I use that string as the date in the above code? > > What database are you using? You can probably do all of this in your SQL > statement if you're using the correct columns. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date format from file (END)
> I don't know of another program. As long as you write a unix timestamp > or some date format that can be parsed by strtotime(), then you can do > it this way. Use fopen()/fread() to get the last time saved in the file. > If you're using unix timestamps, just see if the current time is greater > than the old timestamp + 28 days... > > If(time() < $old_timestamp + 60*60*24*28) > { //run script and save new time(); } > > ---John W. Holmes... > Thanks alot for all the help. Using cron to run the checktime script I can then make sure the process gets run on the exact time it needs to be run along with the exact date in the file. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Running system commands
Before I ask, I have read the documentation but nothing seems to work. I want to run a system command from behind the scenes (totally secure area of my server) that creates a directory and changes permissions on it. i.e. system ("mkdir $path"); Example above uses a value from a form passed to the script and is assigned from $_POST['path']; When I run it no directory is created. Ideas?? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Making a true statement false.
Whenever I query a database with php I've always used the following code as a result. if ($row = mysql_fetch_array($result)) { do something } else { do seomthing else } This method will persuades you to take action on something true first then false. How would I write it so it would assume false then true? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Making a true statement false.
Thanks for all the help. I was just placing the ! in the wrong place. Thanks again, Ed On Fri, 7 Mar 2003, Greg Beaver wrote: > > > Mincu Alexandru wrote: > > On Fri, 2003-03-07 at 18:16, [EMAIL PROTECTED] wrote: > > > >>Whenever I query a database with php I've always used the following code > >>as a result. > >> > > > > this way: > > > > if (!$row = mysql_fetch_array($result)) { > > do something } > > else { > > do seomthing else } > > It is simpler to do this: > > if ($row = mysql_fetch_array($result)) { > do something else > } else { > do something > } > > You would be well advised to use this syntax: > > if (!($row = mysql_fetch_array($result))) > > to ensure operator precedence is clear. (the equals followed by not) > > Regards, > Greg > -- > phpDocumentor > http://www.phpdoc.org > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Auth question
That is one way to try it but I haven't been able to get it to work. Questions about PHP variable authentication through .htaccess protected directories has been brought up many times since I've been on this list but has never been completly answered. Apparently it cannot be done. The closest thing you can do is create a .htaccess type pop up with PHP but the username and password still have to be entered via the user which is what I take to be what you are trying to avoid. Ed Curtis On Tue, 1 Jul 2003, Dave Carrera wrote: > I have a issue with basic auth which I hope someone here can throw some > light on. > > 1) I have already got my SESSION auth working well > > 2) Once someone logs in I need to send some basic auth info to a dir on > another server to let my logged in user to view it. This is where I am stuck > :-( > > I think one answer is > > If(isset($_SESSION[userokcode])){ > > header(Location http://username:[EMAIL PROTECTED]://www.domain.name/dir); > } > ?> > > Is that anyway close or have I got it the wrong way around? > > Any help is appreciated. > > Dave C > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.493 / Virus Database: 292 - Release Date: 25/06/2003 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Mysql Limit
I've created a script that reads a sorted mysql query and outputs specific results into text files defined by the start and limit of mysql. The database holds 178 records. I want to start my output on #9 with 10 records per page. Should leave me with 17 equal pages right? $count = 178 $start = 8; (Mysql starts at record 0) $per_page = 10; $page = 1; while ($start <= $count) { $fp = fopen("Page$page.txt", "w"); mysql_connect ($host, $user, $pass); mysql_select_db ($database); $result = mysql_query ("SELECT * FROM internal_listings, agents WHERE internal_listings.agent = agents.name AND category = 'Standard' ORDER by area,price LIMIT $start, $per_page"); if ($row = mysql_fetch_array($result)) { do { ##misc ouput to file $fp for 10 records in query } while($row = mysql_fetch_array($result)); } fclose($fp); mysql_close(); $start = $start + $per_page; $page++; } When I run the script outlined above I get 18 pages. Page number 18 is blank as it should be as there should be no more listings to output to a text file but why is there a page number 18 to begin with? It should end with page number 17. Thanks in advance for any insight, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Mysql Limit
Yes, the next page of results would start at #18. The page number only increments by 1. Ed On Wed, 2 Jul 2003, Chris Sherwood wrote: > It looks like your adding 10 to 8 thus getting 18... of course I maybe > looking at this wrong > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, July 02, 2003 9:23 AM > Subject: [PHP] PHP and Mysql Limit > > > > > > I've created a script that reads a sorted mysql query and outputs specific > > results into text files defined by the start and limit of mysql. The > > database holds 178 records. I want to start my output on #9 with 10 > > records per page. Should leave me with 17 equal pages right? > > > > $count = 178 > > $start = 8; (Mysql starts at record 0) > > $per_page = 10; > > $page = 1; > > > > while ($start <= $count) { > > > > $fp = fopen("Page$page.txt", "w"); > > > > mysql_connect ($host, $user, $pass); > > > > mysql_select_db ($database); > > > > $result = mysql_query ("SELECT * FROM internal_listings, agents WHERE > > internal_listings.agent = agents.name AND category = 'Standard' ORDER by > > area,price LIMIT $start, $per_page"); > > > > if ($row = mysql_fetch_array($result)) { > > > > do { > > > > ##misc ouput to file $fp for 10 records in query > > > > } > > > > while($row = mysql_fetch_array($result)); > > > > } > > > > fclose($fp); > > > > mysql_close(); > > > > $start = $start + $per_page; > > > > $page++; > > > > } > > > > > > When I run the script outlined above I get 18 pages. Page number 18 is > > blank as it should be as there should be no more listings to output to a > > text file but why is there a page number 18 to begin with? It should end > > with page number 17. > > > > Thanks in advance for any insight, > > > > Ed > > > > > > > > -- > > 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
Re: [PHP] PHP and Mysql Limit
On Wed, 2 Jul 2003, Jeff Harris wrote: > Then, once you've done it enough times, $start = $count = 178. > [code] > while ($start <= $count) { > // when $start = $count = 178, you won't retrive any data > [/code] The recordset would not alway contain an even number of records resulting in 10 records per page. It may contain something like 1027 records which should then produce 103 pages. 102 pages each with 10 records and one page of only 7 records. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Red Hat 9, Apache 2, and PHP
I'm current;y in the process of setting up a new web server myself. The obvious choice for me was to use Red Hat 7.3 for the install. On a clean install all the nice options are already present, (ssl, php, mysql, gd lib) which is much better thatn what we used to run, Red Hat 5.2! Been running that for the past 4 years on that dinosaur. Ed On Thu, 3 Jul 2003, Joseph Szobody wrote: > Folks, > > I'm just getting ready to built a webserver this weekend and was planning on using > RH9, so this thread especially caught my eye. The website that the server will be > hosting is pretty simple, some basic DB queries, no special Apache modules. Is > Apache 2.0 still not a good choice for something simple? > > If I really should use Apache 1.3, then which route would be easier... > > 1. Install RH9, remove Apache 2.0 and manually install Apache 1.3 (from tarball). > The only problem with this is that I will no longer be able to use the Red Hat > Network's "up2date" tool to download and apply patches (from what I understand). > Up2date is a huge time saver for me. > > 2. Install RH7.3, and manually install the latest version of PHP (I simply can't use > the version that comes with RH7.3). Of course then I still have the older version of > MySQL, and everything else. > > Comments? > > Joseph > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Red Hat 9, Apache 2, and PHP
Does anyone remember the warning concerning MySQL and glibc. I distinctly remember some conflict between the two and up2date installing a bad mismatch lib making MySQL act funny. It's one of the reasons I'll stick with Red Hat 7.3 but I my conclusions about the situation may be clouded because of this. Ed On Thu, 3 Jul 2003, Mark McCulligh wrote: > I am also building a new server. I am going with RedHat 8, but only > installing the Classic server from the CDs. Then installing/configuring > Apache/PHP/MySQL/SSL manually. I like the rpm install programs but I like to > be able to add modules in the future and I find it easier the configure it > all by hand. > > I also use the up2date, but only for the basic server part, not the > webserver part. I will reconfigure my web server is a new version or patch > comes out. > > I am doing to use Apache 1.3.27, because I too have read all the warnings > about 2.X and PHP, it does not look stable. Maybe with PHP 5 it will be > stable. > > I went with Redhat 8 over 9 because I have also read about a lot of bugs > with redhat 9. > > I usually don't like to use the new of anything until it have been out for > sometime and I don't see any see bug reports. > > Just my two cent. > > Mark. > > > > "Joseph Szobody" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Folks, > > I'm just getting ready to built a webserver this weekend and was planning on > using RH9, so this thread especially caught my eye. The website that the > server will be hosting is pretty simple, some basic DB queries, no special > Apache modules. Is Apache 2.0 still not a good choice for something simple? > > If I really should use Apache 1.3, then which route would be easier... > > 1. Install RH9, remove Apache 2.0 and manually install Apache 1.3 (from > tarball). The only problem with this is that I will no longer be able to use > the Red Hat Network's "up2date" tool to download and apply patches (from > what I understand). Up2date is a huge time saver for me. > > 2. Install RH7.3, and manually install the latest version of PHP (I simply > can't use the version that comes with RH7.3). Of course then I still have > the older version of MySQL, and everything else. > > Comments? > > Joseph > > > > -- > 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] Older Version problems
I'm moving some scripts to a new server but the PHP installation on the new server is actually older than the version I currently have installed on the production server. I'm moving from 4.2.3 to 4.1.2. In my file upload scripts I can't seem to get any $_FILES values out of my upload. The scripts don't error out and the file appears to transfer. I've enabled E_ALL and logging. Uploads are on and max upload size is sufficient. When I check $_FILES['filename']['tmp_name'] or ['size'] or ['name'] or ['type'] they are all empty. Did I miss something in the ini file somewhere? I'd really hate to upgrade at this time as this came from a Red Hat 7.3 install and I'd hate to lose all the functions that are already pre-compiled into it (gd, mysql, etc) Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I display an image within a script?
Yes, the method below would work just fine if you only needed to display one image. Trying it on a second image within the same generated page would give you a "headers already sent" error. Ed > Ok, assuming that the image files are outside the public web tree and > you can read them with a script. You will have to write a php script > that will read the file (sending the appropriate headers). > > So your script will generate html like > > > then showimage.php will do something: > header('content-type: appropricate/type'); > // content-length would be good > readfile($file); > > HTH Curt -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error on mysql_num_rows
I've been trying to count records that match my query in MySQL using the examples given in the on-line manual as well as the user comments and I'm still getting the error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource. Here's the code. mysql_connect ($local_host, $local_user, $local_pass); mysql_select_db ($local_db); $result = mysql_query ("SELECT count(id) FROM listings WHERE agent = '$agent' AND child = '0'"); $rc = mysql_num_rows($result); mysql_close(); Is there something I'm missing here? I've tried using just about every example in the on-line manual and get the same error. I can run other queries just fine though. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error on mysql_num_rows
I think I've found my problem. The query does work if I place the exact same code directly into my script but I had previously been calling it as a function from an include file. It's working just great now. Thanks, Ed On Thu, 20 Mar 2003, Tom Rogers wrote: > Hi, > > Thursday, March 20, 2003, 10:44:33 PM, you wrote: > > ehhc> I've been trying to count records that match my query in MySQL using the > ehhc> examples given in the on-line manual as well as the user comments and I'm > ehhc> still getting the error: > > ehhc> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result > ehhc> resource. > > ehhc> Here's the code. > > ehhc> mysql_connect ($local_host, $local_user, $local_pass); > ehhc> mysql_select_db ($local_db); > ehhc> $result = mysql_query ("SELECT count(id) FROM listings WHERE agent = > ehhc> '$agent' AND child = '0'"); > ehhc> $rc = mysql_num_rows($result); > ehhc> mysql_close(); > > ehhc> Is there something I'm missing here? I've tried using just about every > ehhc> example in the on-line manual and get the same error. I can run other > ehhc> queries just fine though. > > ehhc> Thanks, > > ehhc> Ed > > > I would be guessing that there is a mysql error so put in some checking and echo > mysql_error() > Also count(id) will ever only return 1 row so you have to retrieve that to get the > actual count. > An easy way is like this > > if(!$result = mysql_query ("SELECT count(id) AS id_count FROM listings WHERE agent = > '$agent' AND child = '0'")){ >echo 'Oops : '.mysql_error(); > }else{ >$row = mysql_fetch_array($result); >echo 'count = '.$row['id_count']; > } > -- > regards, > Tom > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP or Mysql or Combination
I'm currently stuck in a project where I need to pull info from a database and sort it by order of 2 seperate fields and creates a text report of the results. No problems there but now what the boss is wanting to do is break it up into slices of 8 records per file and save each file individually so you get issue3page1.txt is the first 8 results from the query and issue3page2.txt would be result 9-16 of the query. Anything results less than 8 for the final recordset would consitute 1 page as well. Here's what Im using now. -- mysql_connect ($host, $user, $pass); mysql_select_db ($database); $result = mysql_query ("SELECT * FROM listings,agents WHERE listings.agent = agents.name ORDER by area, price DESC"); if ($row = mysql_fetch_array($result)) { do { $agent = $row['agent']; if ($row['banner'] != "No Banner") { fputs($fp, $row['banner']); } fputs($fp, $nl); fputs($fp, $sp); fputs($fp, $sp); fputs($fp, $ar); fputs($fp, $sp); fputs($fp, $row['area']); fputs($fp, $sp); fputs($fp, $dol); fputs($fp, number_format($row['price'], ",")); fputs($fp, $sp); fputs($fp, $sp); fputs($fp, $nl); fputs($fp, $row['copy']); fputs($fp, $nl); $agent_name = $row['name']; fputs($fp, $agent_name); fputs($fp, $nl); $line1 = $row['line1']; $line2 = $row['line2']; $line3 = $row['line3']; $line4 = $row['line4']; fputs($fp, $line1); fputs($fp, $nl); fputs($fp, $line2); fputs($fp, $nl); fputs($fp, $line3); fputs($fp, $nl); fputs($fp, $line4); fputs($fp, $nl); fputs($fp, $nl); } while($row = mysql_fetch_array($result)); } fclose($fp); mysql_close(); echo "Done Creating Sorted Listing Report"; ------ How would I go about creating files of 8 records each in individual files? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strtr question
I want to remove unwanted characters from filenames of files uploaded to our server. I am currently using strtr to do this. I have a few characters that are being removed but I would also like a single quote to be removed if it is in the filename. I think it has to be escaped in the command though. How do I do this? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and .htaccess
I didn't want to steal a thread so here's a new one. I've seen this subject come up alot since joining the list last fall and believe that the question meant to be asked never got the expected answer simply because it wasn't asked in the correct way, myself being one of the culprits. From scanning documentation and all the responses on the list we all know PHP can do .htaccess type authentication by popping up the username/password box. That's easy enough but, can you create a form page in PHP prompting for a username and password and then redirect into an .htaccess protected directory without having the server pop up another username/password box? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP extensions and multiple source files?
Howdy folks! Is there a way to have multiple *.c source files and still end up with a single *.so while using gcc? How would that be reflected in the config.m4 file? I searched for examples in the source tree, but did not find one. I tried different things, but ended up with multiple *.so's. I have been using *.h for a few pieces, but compiling gets long and the source a bit unwieldy. Thanks!
[PHP] authorize.net
Hey all. I have an app that I need to integrate with an online payment service. I read an article here http://www.devshed.com/Server_Side/Administration/CREDIT/page4.html that uses authorize.net as the example and suggests that you don't need an account to test your app with their service. Does anyone know if this is true? The article is over a year old so the info might be outdated. I tried modifying the code from the example to work for me, but I kept getting error messages back from authorize.net's servers. Stuff like "Cannot process this request." .. I tried emailing their tech support but haven't heard back from them. Does anyone know of any payment services that I can use for free just for testing my app with it? Can you suggest any php libraries out there that will make life easier? tia, --ed __ 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
Re: [PHP] What the heck is this Zope?
Check this page out: http://www.zope.org/WhatIsZope .. And click the links on that page too. I don't know much about it. But what I gather is that it's sort of like an open source "cold fusion" type application written in python. Not that it necissarily resembles cold fusion in any way, but that it's sort of a framework for building web applications. I don't know a whole lot about python either, but it looks really cool. I think python is probably a better general-purpose scripting language than php, similar to perl in that respect. But as far as building applications that are strictly for the web, is there anything as good as php? I would probably say no, but a lot of it is a matter of taste. hth, --ed - Original Message - From: Deependra B. Tandukar <[EMAIL PROTECTED]> Newsgroups: php.general To: PHP General <[EMAIL PROTECTED]> Sent: Friday, August 09, 2002 6:09 AM Subject: What the heck is this Zope? Dear all: What the heck is this Zope? Which is better PHP or Zope? Any idea ! DT __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] funtion exporter; static inclusion of external scripts
Does anyone know of any tools for php that will let you include only certain functions from a file. For example if I only wanted a function named "login" from a file named "func_common.php", I could maybe do something like this: my_require('path/to/func_common.php', 'login'); I was thinking of writing a script that would offer an api to let you include only certain parts of a file, or maybe you'd could use "*" in conjunction with a directory name to include all the files in a directory. What I have in mind is building a new static version of the "main" script with the "included" code being a part of the main script. I guess if you're scripts are being cached then the disk reads that including files requires isn't that big of a deal. But it could probably make a big difference on sites where people aren't caching their php scripts. Let me know if anything like this exists. tia, --ed __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] addslashes() and stripslashes()
Is it a good idea to always use addslashes() on a value gathered from a text field or textarea? If you use addslashes() to "INSERT" the stuff into a db, should you always use stripslashes() when you "SELECT" it from the database? tia, --ed __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/mysql slow with zone alarm
Hey all. I do most of my coding on win98 before uploading it to my web host running linux. I'm running the windows versions of apache/mysql/php. I'm using the cgi version of php. I also run the personal firewall software, zone alarm. When zone alarm is running it slows php/mysql down so much that the script usually times out. I have given these programs the permissions that they need in zone alarm. Zone alarm doesn't keep them from running, it just makes them really slow. It doesn't run slow unless I query the mysql DB from a php page. Php in and of itself is not slow, just when used in conjunction with mysql. Also, when I use mysql from the command line it doesn't seem to be slow. I know this isn't necessarily a php issue, but thought maybe some of you may have run into a problem like this before and would know a remedy. Any help appreciated. tia, --ed __ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variables and Forms
I'm trying to pass variables from one page to the next but don't want to use a hidden input type=text box. I need to break from frames and I don't know a way to pass that to the action tag in the form. If there's a way to do that then great but I haven't found it. I've also tried the meta http-equiv="window-target" content tag on the action page from the form and it didn't work either. TIA Ed Curtis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remote files to servers
While were on the subject what about retreiving a web page and images based on URL? Ed Curtis On Fri, 27 Sep 2002, Simon Angell wrote: > Hi all. > i was wondering if it is possible to use PHP to retrieve a remote file and > then write a copy to my own server for quicker access? > > -- > Cheers > - > Simon Angell > Canberra ACT > www.canberra-wx.com > - > Member of: > Australian Severe Weather Association. > www.severeweather.asn.au > - > This email is virus free. > Scanned before leaving my mailbox > using Norton Antivirus 2002 for Win2k > Scanned with the latest definition File. > > > > > -- > 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] Simple directory listing
I've been hunting all over to find a script that will just list a directory. I don't need a full feature file system manager just something I can list files and choose to delete a file if I wish. Where would I find this. TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.0.2 => 4.2.3, form vars are empty?
I recently have experienced the same thing in upgrading from 4.0.0 to 4.2.3 All variables are now stored globally and can only be retrieved using $_POST['var'] or $_GET['var'] declarations i.e. $username = $_POST['username']; or get if your method was get in the form. On Fri, 27 Sep 2002, Qmail List wrote: > Hello List, > > I'm putting a php app that has been off-line for about 18 months back > on-line. During my absence from php I had heard about some security issues, > so figured I'd try the latest 4.2.3 release. > > Sessions and the DB are fine, but GET/POST vars are continually empty. I > mean a form submission from .html to .php (about the simplest thing > possible) the variables are not getting populated with their form values. > > Actually, phpinfo() does show the variables and their values if I throw it > in the .php file. But tailing the mysql log shows the following: > > SELECT * FROM users WHERE username='' AND password='' > > from this code. > > $query = mysql_query("SELECT * FROM users WHERE username='$username' AND > password='$password'"); > > > Regards, Thx > > > -- > 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] Getting part of a string
I've got a situation where I need to pull a string from a variable but I can't seem to get it figured out. I.e. value of $a = /realtor/Remax/Ed/files/ I need to get the string between the second and third / (slash) What I need: Remax Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] coding standards - control structures
Hey all. I've read the pear coding standards. I assume that if php has any official coding standards then the pear standards would be them, correct? Anyways, the pear docs on coding standards show examples of using controls structures like the following: if ( !$var ) { do_something(); } else { do_something_else(); } --- But I really don't like putting the opening brace on the same line as the control statement. I really prefer doing this: if ( $var ) { do_something(); } or if( $var ) { do_something(); } else { do_something_else(); } --- Putting the opening brace one line down on the same column that the control statement starts on seems to give me a much better visual cue, especially when dealing with nested control statements. Is doing it my preferred way acceptable? Will my code be looked down on? thanks, --ed __ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security and register globals
Having recently switched from php 4.0.0 to 4.2.3 I quickly realized the change in variable handling. I still experience problems using the $_POST and $_GET globals so I currently have my register globals ON so I can have the ability to pass variables from page to page without using the $_POST and $_GET methods although I would really like to use them. My current project has me creating a login interface for users to access a form and file upload tools. I am using only 1 set of scripts for everyone. Each user is assigned a path to their file area and these records are kept in a MySQL database along with username, password and contact info. As Each page is loaded the ID variable is checked and table data is then loaded for them for use on that page. If the ID variable is null they are given an error and redirected to the login page. This is to keep them from bookmarking the index page for the tools. My question is this: If I were to turn off register_globals and use the $_POST and $_GET methods, what are the chances of a user getting someone else's variable information using only one set of scripts for all. There could be up to 700 people using the script at any given time. Cookies are not an options as many users may have them turned off and sessions have never worked for me or at least I have never figured them out to work the way I think they should. TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Security and register globals
Correct! Problem is that I have been given explicit instructions to not use cookies to do this. The only way I can think of doing it without using cokkies is to pass at least one variable from page to page so the scripts know who the user is. Getting them to the user index page with links to the tools without knowing what the ID is was my main focus. I did this using hidden input type variables so it's not included on the URL when they get there. I could continue to do so if I were using all based links but the value could still be seen in the source for the page. Ed On Mon, 30 Sep 2002, John W. Holmes wrote: > > Having recently switched from php 4.0.0 to 4.2.3 I quickly realized > the > > change in variable handling. I still experience problems using the > $_POST > > and $_GET globals so I currently have my register globals ON so I can > have > > the ability to pass variables from page to page without using the > $_POST > > and $_GET methods although I would really like to use them. > > > > My current project has me creating a login interface for users to > access a > > form and file upload tools. I am using only 1 set of scripts for > > everyone. Each user is assigned a path to their file area and these > > records are kept in a MySQL database along with username, password and > > contact info. As Each page is loaded the ID variable is checked and > table > > data is then loaded for them for use on that page. If the ID variable > is > > null they are given an error and redirected to the login page. This is > to > > keep them from bookmarking the index page for the tools. > > > > My question is this: > > > > If I were to turn off register_globals and use the $_POST and $_GET > > methods, what are the chances of a user getting someone else's > variable > > information using only one set of scripts for all. There could be up > to > > 700 people using the script at any given time. Cookies are not an > options > > as many users may have them turned off and sessions have never worked > for > > me or at least I have never figured them out to work the way I think > they > > should. > > Using _POST or _GET doesn't make your scripts any more secure. It is > still all dependant on how you write them. If you assume that the ID > coming from _POST or _GET is the user that just logged in, then anyone > can just change the ID and get other peoples information. > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Security and register globals
It would be possible to do this if I then created another table to load their profile data to and use the unique id as the identifier. It would make it alot harder for someone to guess an ID. I would then need a way to flush out their records from the second table when they are finished. Easily enough done using a logout script but who actually does this anymore. It would be possible to create a script to run through cron to delete records from that table that are more than say 30 minutes old. Good idea, thanks. Ed > > If that's the way you have to do it, then make the ID that identifies > the user something very hard to guess. Take a look at uniqid() in the > PHP manual. Assign the user a unique id after they supply the correct > username and password, and then pass that value around in the URLs. > > ---John Holmes... > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Security and register globals
I think I would rather do it using a new table than have to handle sessions. It actually sounds harder to do it this way but I like hard. :) Thanks, Ed On Mon, 30 Sep 2002, John W. Holmes wrote: > > It would be possible to do this if I then created another table to > load > > their profile data to and use the unique id as the identifier. It > would > > make it alot harder for someone to guess an ID. I would then need a > way to > > flush out their records from the second table when they are finished. > > Easily enough done using a logout script but who actually does this > > anymore. It would be possible to create a script to run through cron > to > > delete records from that table that are more than say 30 minutes old. > > Yeah, that would be a good way to do it. Save a timestamp along with the > unique identifier. Update the timestamp whenever the user does > something. Then delete the unique identifier if the timestamp ever gets > to be more than X minutes old (cron is best way for that). > > What you are basically doing, though, is recreating sessions with the > trans_sid enabled. PHP will go through your code for you and > automatically add the session ID to all URLs and forms. You can turn off > cookies in php.ini, too, so you have to use the URL method. Only setback > is that PHP must be compiled a certain way (--enable_trans_id or > something) for it to work. > > ---John Holmes... > > > > -- > 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] Session cleanup
I was wondering why a session doesn't automatically get cleaned up after the maximum life time? Default to 1440 (24 min) session is still there until I start a new session then it disappears. Is there a simple script to run via cron to clean up old sessions? TIA, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] extract($_POST)
I thought of this was well and into the PHP documentation about this option. Here's a side note that the documentation includes: Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. Even thought it's not a sure-fire method, it can be included along with other security methods to increase the amount of security on a script. Ed Curtis On Fri, 25 Oct 2002, John Nichel wrote: > And if you want to take it a step further, to ensure that the values are > submitted from YOUR form, check the $_SERVER['HTTP_REFERER'] to see if > it's coming from your domain | page. > > Paul Nicholson wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > > On Friday 25 October 2002 11:23 am, Johnson, Kirk wrote: > > > >>>And what should these precautions be? If a malicious user can submit > >>>his own form and you are looking for a POST variable, how can you > >>>ensure that $admin came from your form and not that user's? > >> > >>The problem is when a cracker uses form variables in an attempt to set the > >>values of "flag" variables kept only in the session, for example, $isAdmin. > >>As far as the form variables *you* put in your form, it doesn't matter > >>whether the user submits your form or a form they made themselves. Those > >>form variables are just data you are trying to collect. > >> > >>With register_globals on, PHP takes *all* variables (GET, POST, COOKIE) > >>received from the client and assigns them to global variables. So if the > >>user posts a value for $isAdmin, she can give herself admin privileges. > >> > >>The key is to retrieve *only* the form variables *you* put in the form from > >>the the $_POST array. So don't write a loop and grab *everything* from that > >>array. > >> > >>Kirk > > > > > > Exactly! Not only should you retrieve *only* the vars you need from POST, > > you should also filter them to make sure they contain what you're looking > > for.is_alpha($_POST['name']). And no, php doesn't have an 'is_alpha' > > functionI created that as part of a filtering class. > > > > ~Paul > > > > > > - -- > > ~Paul Nicholson > > Design Specialist @ WebPower Design > > "The webthe way you want it!" > > [EMAIL PROTECTED] > > > > "It said uses Windows 98 or better, so I loaded Linux!" > > Registered Linux User #183202 using Register Linux System # 81891 > > -BEGIN PGP SIGNATURE- > > Version: GnuPG v1.0.6 (GNU/Linux) > > Comment: For info see http://www.gnupg.org > > > > iD8DBQE9uXoKDyXNIUN3+UQRAkugAJ0aftPjxhmV0tSk125UZSTCuWp47QCfaKJ7 > > z5+ja1P4NtWUwVMCMsFVt2M= > > =UG2o > > -END PGP SIGNATURE- > > > > > > -- > 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] Checking for a string.
I'm currently writting a redirect script for my site which will transfer someone to either a external link or a directory on my server. In order to do this I need to use a directive that either contains the directory path or a URL. How do I check the contents of a string to see if it contains "http"? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for a string.
Seems to work but I'm getting a Warning Message: Delimiter must not be alphanumeric or backslash Here's the code: $path = "http://somehost.somedomain.com";; preg_match ("http", $path, $matches); if ($matches[0] = "http") { $action = "this action"; } else { $action = "that action"; } Thanks much, Ed On Tue, 29 Oct 2002, John Nichel wrote: > preg_match() > > [EMAIL PROTECTED] wrote: > > I'm currently writting a redirect script for my site which will transfer > > someone to either a external link or a directory on my server. In order to > > do this I need to use a directive that either contains the directory path > > or a URL. How do I check the contents of a string to see if it contains > > "http"? > > > > Thanks, > > > > Ed > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for a string.
Thanks, figured that out shortly after I posted. Ed On Tue, 29 Oct 2002, John Nichel wrote: > http://www.php.net/manual/en/function.preg-match.php > > Wrong syntax, and more code than needed. Your code would always resolve > true (if ($matches[0] = "http")). Doing that sets the value of > $matches[0] to "http". Equality is ==. RTFM. > > If all you want to know is if the URL contains a "http", then... > > if ( preg_match ( "/http/i", $path ) ) { > $action = "this action"; > } else { > $action = "that action"; > } > > If you want to know if the URL starts with a "http", then... > > if ( preg_match ( "/^http/i", $path ) ) { > $action = "this action"; > } else { > $action = "that action"; > } > > [EMAIL PROTECTED] wrote: > > Seems to work but I'm getting a Warning Message: > > > > Delimiter must not be alphanumeric or backslash > > > > Here's the code: > > > > $path = "http://somehost.somedomain.com";; > > > > preg_match ("http", $path, $matches); > > > > if ($matches[0] = "http") { > > $action = "this action"; > > } > > else { > > $action = "that action"; > > } > > > > Thanks much, > > > > Ed > > > > > > On Tue, 29 Oct 2002, John Nichel wrote: > > > > > >>preg_match() > >> > >>[EMAIL PROTECTED] wrote: > >> > >>>I'm currently writting a redirect script for my site which will transfer > >>>someone to either a external link or a directory on my server. In order to > >>>do this I need to use a directive that either contains the directory path > >>>or a URL. How do I check the contents of a string to see if it contains > >>>"http"? > >>> > >>>Thanks, > >>> > >>>Ed > >>> > >>> > >>> > >> > >> > >> > >>-- > >>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] PHP and .htaccess authentication
I just got done reading the online docs concerning http authentication and tried out a script that appears on the page. Apparently it is easy enough to protect any page with http authentication after you have already forced someone to enter a username and password on a regular .htaccess prompting under Apache. What I need to try to accomplish is checking a username and password against a MySQL database and redirect to a different directory upon success. The directory would be protected via a .htaccess file. Is there a way to pass through a .htaccess file if they have already passed a previous authentication scheme as above? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mutiple header statements?
Why doesn't this work? If I select "that" from the form submitting the value to "var" I get a header already sent error. There is nothing else above these statments in my script. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mutiple header statements?
On Wed, 30 Oct 2002, Rick Emery wrote: > > if ($_POST['var'] == "this") { > header("Location: scipt1.php"); exit;} > > if ($_POST['var'] == "that") { > header(Location: script2.php"); exit; } Nope, I still get a header already sent error if I choose "that." Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mutiple header statements?
On Wed, 30 Oct 2002 [EMAIL PROTECTED] wrote: > Not sure if this is what you're looking for, but a possible solution could > be: > > if ($_POST['var'] == "this") > $page = "script1"; > > if ($_POST['var'] == "that") > $page = "script2"; > > header("Location: $page.php"); } > ?> This could be an option if neither of the if's matched it could continue with additional scripting below these conditions without getting sent a header. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mutiple header statements?
On Wed, 30 Oct 2002, Marek Kilimajer wrote: > I suppose this is just an excerpt, could you paste some more code here? > > [EMAIL PROTECTED] wrote: > > >On Wed, 30 Oct 2002, Rick Emery wrote: > >> >> > >>if ($_POST['var'] == "this") { > >>header("Location: scipt1.php"); exit;} > >> > >>if ($_POST['var'] == "that") { > >>header(Location: script2.php"); exit; } My original code is: What I'm trying to accomplish here is to check the value of a variable against these two conditions at the very top of my script. If any one condition matches is sends the user to it's respective script as defined above. If neither of these conditions match it continues on with the script. I'm getting header already sent errors if I choose the variable that makes the second condition true. It works just fine If I choose to make the first condition true or choose to make both conditions false. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mutiple header statements?
> WHAT IS THE ERROR?? It tells you _exactly_ in the header error message where > the output was started. Look on or near that line because it caused some > output to the browser and now headers cannot be sent. > > ---John Holmes.. Here's the code: and on from here Here's the error: Warning: Cannot add header information - headers already sent by (output started at script.php:4) in script.php on line 5 Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mutiple header statements?
On Wed, 30 Oct 2002, Marek Kilimajer wrote: > You have an empty line there, get rid of the > ?> > > pair That did it!! I didn't know a blank line inside php tags would be interpeted as output. Thanks! Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mutiple header statements?
You're right again as usual Oh List God. Sorry about that. I love this list!! On Wed, 30 Oct 2002, John W. Holmes wrote: > It's not inside PHP tags, look at your code again. You have two PHP > blocks with a blank line between them. > > ---John Holmes... > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:ed@;home.homes2see.com] > > Sent: Wednesday, October 30, 2002 8:49 AM > > To: Marek Kilimajer > > Cc: PHP > > Subject: Re: [PHP] Mutiple header statements? > > > > > > On Wed, 30 Oct 2002, Marek Kilimajer wrote: > > > > > You have an empty line there, get rid of the > > > ?> > > > > > > > > pair > > > > That did it!! I didn't know a blank line inside php tags would be > > interpeted as output. > > > > Thanks! > > > > Ed > > > > > > > > -- > > 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] stipslashes
Is stripslashes($_POST); the same as stripslashes($_POST['var1']); stripslashes($_POST['var2']); stripslashes($_POST['var3']); Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] number_format question
I using number_format where I need to turn a number say "123456789" into "123,456,789" and it works just fine. I also need it to strip the decimal out if someone enters it. I.E "123456.00" would become "123,456" the command I'm using right now is: number_format($number, ","); If I enter "123456.00" it comes out as "123". Did I miss something? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] number_format question
If I try that I get a wrong parameter count error. Ed On Thu, 31 Oct 2002, Jay Blanchard wrote: > [snip] > I using number_format where I need to turn a number say "123456789" into > "123,456,789" and it works just fine. I also need it to strip the decimal > out if someone enters it. I.E "123456.00" would become "123,456" > > the command I'm using right now is: > > number_format($number, ","); > > If I enter "123456.00" it comes out as "123". Did I miss something? > [/snip] > > You're missing an attribute, try > > number_format($number, '', ','); > > HTH! > > Jay > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] number_format question
Tried it. It works but crops everything after the first "," in the number if you enter a number with commas. Works great if you don't enter any commas. What I need to be able to do: IN OUT 123456789 > 123,456,789 123456789.00 > 123,456,789 123,456,789.00 > 123,456,789 Ed On Thu, 31 Oct 2002, Jay Blanchard wrote: > [snip] > If I try that I get a wrong parameter count error. > > [/snip] > > number_format ( float number [, int decimals [, string dec_point [, string > thousands_sep]]]) > > number_format($number, 0, '', ','); > > Try that ... > > Jay > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Who can tell me where I can get the cracked Zend Encoder3.0?
> Asking for something illegal is *wrong*. But just stealing it without asking is OK? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Authentication with PHP and HTTP
I've tried both methods without success. header("Location: http://(user):(pass)@www.mysite.com"); does the transfer but I still get prompted for a username and password by Apache readfile("http://(user):(pass)@www.mysite.com"); brings a warning message. Warning: readfile("http://...@;www.mysite.com/") - Success in redirect.php on line 2 It's a warning but says Success? Ed On Mon, 4 Nov 2002, Chris Shiflett wrote: > You can "hide" URLs by fetching them with one of your own PHP scripts: > > > readfile("http://user:password@;www.site.com/"); > ?> > > I think it might be at least better than frames. :-) > > Chris > > silver wrote: > > >you could use this URL syntax: > >http://user:password@;www.site.com to automatically log your user in to the > >htaccess protected area. the bad thing about it is that user / password show > >up in the URL, but you could hide this information with using frames... > >are PHP/MySQL usernames + passwords the same like in Apache/HTTP? > > > > > -- > 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] What's up with php.net
Seems the site is down? Just when I was needing to get to the documentation. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What's up with php.net
Great. Thanks! On Thu, 7 Nov 2002, Adam Williams wrote: > I can't get to it either, but the mirror http://uk.php.net works fine. > > Adam > > On Thu, 7 Nov 2002 [EMAIL PROTECTED] wrote: > > > > > Seems the site is down? Just when I was needing to get to the > > documentation. > > > > Ed > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Outputting multiple images
I've found a little problem that's not explicitly a php problem but I was hoping that php may be the solution. Someone is shown an image and then asked if they wish to change that image. If they answer yes they are taken to an upload form and the new image is upload to the server overwitting the old image using the same filename. They are then taken to a page to show them the image they just uploaded but the old image is diplayed from cache instead of the new photo being shown. I'm using absolute path to the image on the server, not URL. Is there a way to get the script to load in the new photos? Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
But I don't think headers would work because I would be using it on a page that has already had output before the images would and also multiple images which means multiple header statements. Ed On Thu, 7 Nov 2002, 1LT John W. Holmes wrote: > > I've found a little problem that's not explicitly a php problem but I was > > hoping that php may be the solution. > > > > Someone is shown an image and then asked if they wish to change that > > image. If they answer yes they are taken to an upload form and the new > > image is upload to the server overwitting the old image using the same > > filename. They are then taken to a page to show them the image they just > > uploaded but the old image is diplayed from cache instead of the new photo > > being shown. I'm using absolute path to the image on the server, not URL. > > > > Is there a way to get the script to load in the new photos? > > I'm sure there are some no-cache header()s you can send. Take a look on the > header() manual page, I think there are some examples there. > > www.php.net/header > > ---John Holmes... > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
I think the random number query will work but I have a problem with the context of the echo line. Here's how I get the image path. How would I use the rand function in the above statement? Ed > When you create the src tag in for the image, add a random number query > string - that will cause the browser to request the image instead of > using the cached version. I.e... > > echo ''; > > -- > Stuart > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting multiple images
On Thu, 7 Nov 2002, Ernest E Vogelsinger wrote: > At 16:57 07.11.2002, [EMAIL PROTECTED] spoke out and said: > [snip] > > I think the random number query will work but I have a problem with the > >context of the echo line. > > > >Here's how I get the image path. > > > > >$root_path = "/www/special_projects/Elkhart"; > >$agent_url = "$root_path/$agent_name"; > >?> > > > > > > > >How would I use the rand function in the above statement? > [snip] > > 1) I believe the root path you gave is the server's file path, not the URL > it should point to... well, it just looks like this. > > 2) code your template like this: > > > This will result in something like > I got it working by doing thus: http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 features?
Hi all. I was wondering if there are resources on the web that will help me get an idea of the changes and new features that will be in php5. I'm particularly interested in what's gonna be added or changed to php in regards to its OOP capabilities. I already love this language. I'm just looking forward to seeing in what areas it is going to be made even better. tia, --ed __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 features?
Hi all. I was wondering if there are resources on the web that will help me get an idea of the changes and new features that will be in php5. I'm particularly interested in what's gonna be added or changed to php in regards to its OOP capabilities. I already love this language. I'm just looking forward to seeing in what areas it is going to be made even better. tia, --ed __ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and MySQL sorting using COUNT
I'm sorting records using COUNT with the following mysql command $result = mysql_query ("SELECT company_name, agent_name, count(*) FROM $cur_listings GROUP BY company_name, agent_name"); Running this in MySQL does exactly what I need it to do but how do I echo the COUNT portion of the array? I know the company_name would be $row['company_name'] and agent_name is $row['agent_name']; Thanks, Ed Curtis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Auth with Apache
I'm now understanding how you can get PHP to present you with a username and password promt just like APache would do if you had a .htaccess file in the directory you were trying to enter. Great idea but it seems that it would be easier to just use the .htaccess file in the directory. What I've been trying to find out is how to pass through a .htaccess file if someone has already passed an database authentication lookup in PHP. I have an area on my site "Special Publications" where users login and their username and password is checked against a MySQL database. One field in their user records is the URL to their directory on our server. Each one of these directories is protected via .htaccess. What I would really like to do is have them redirected to their URL if they pass authentication and not have them enter their username and password again. Is their a way to do this? Thanks, Ed On Wed, 13 Nov 2002, Ewout de Boer wrote: > in httpd.conf > > > AllowOverride AuthConfig > > > > More info at http://httpd.apache.org/docs/mod/core.html#allowoverride > > > regards, > > Ewout > > > - Original Message - > From: "Alexander Bemme" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 13, 2002 12:02 PM > Subject: [PHP] PHP Auth with Apache > > > > Hi, > > i got a little problem (i hope so) > > > > I have installed Apache 1.3.26 and PHP 4.2.3 as module. > > > > I used the example from www.php.net to do a PHP authentication, > > but it didn't work, the pop appears but i can't login. > > > > In PHPManual is someting about "AuthType" but nothing about how > > to fix it. > > > > Can someone help out? > > > > Thanks > > > > --Alex > > > > > > > > -- > > 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
Re: [PHP] PHP Auth with Apache
I can set the $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] easily enough but how would you pass that information along with the redirect so apach doesn't prompt you for username and password? I have tried the header("Location http://usernam:password@;URL") method and it always prompts as well. Thanks, Ed On 14 Nov 2002, BigDog wrote: > Ed, > > When you do auth with mysql and they succeed then u can set the > $_SERVER['PHP_AUTH_USER'] and in theory that should allow you to connect > to the directory because that should be set for apache http > authentication. > > You might have to play with it, but i am sure you can get it to work. > > > On Thu, 2002-11-14 at 16:42, [EMAIL PROTECTED] wrote: > > I'm now understanding how you can get PHP to present you with a username > > and password promt just like APache would do if you had a .htaccess file > > in the directory you were trying to enter. Great idea but it seems that it > > would be easier to just use the .htaccess file in the directory. > > > > What I've been trying to find out is how to pass through a .htaccess file > > if someone has already passed an database authentication lookup in PHP. > > > > I have an area on my site "Special Publications" where users login and > > their username and password is checked against a MySQL database. One field > > in their user records is the URL to their directory on our server. Each > > one of these directories is protected via .htaccess. What I would really > > like to do is have them redirected to their URL if they pass > > authentication and not have them enter their username and password again. > > Is their a way to do this? > > > > Thanks, > > > > Ed > > > > > > > > On Wed, 13 Nov 2002, Ewout de Boer wrote: > > > > > in httpd.conf > > > > > > > > > AllowOverride AuthConfig > > > > > > > > > > > > More info at http://httpd.apache.org/docs/mod/core.html#allowoverride > > > > > > > > > regards, > > > > > > Ewout > > > > > > > > > - Original Message - > > > From: "Alexander Bemme" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Wednesday, November 13, 2002 12:02 PM > > > Subject: [PHP] PHP Auth with Apache > > > > > > > > > > Hi, > > > > i got a little problem (i hope so) > > > > > > > > I have installed Apache 1.3.26 and PHP 4.2.3 as module. > > > > > > > > I used the example from www.php.net to do a PHP authentication, > > > > but it didn't work, the pop appears but i can't login. > > > > > > > > In PHPManual is someting about "AuthType" but nothing about how > > > > to fix it. > > > > > > > > Can someone help out? > > > > > > > > Thanks > > > > > > > > --Alex > > > > > > > > > > > > > > > > -- > > > > 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 > > > > -- > .: B i g D o g :. > > > > -- > 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] dns_get_record()
Hi, Is there a corresponding php method that would accomplish the same thing as: dig @ns_srvr_name thisdomain.com So far, dns_get_record() uses the default nameserver values from the /etc/resolve.conf (afaik, at least); how do I get it to lookup the domain name using ns_srvr_name as the name server? Any help appreciated. Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Acessing session vars
I just started using sessions and am having some trouble understanding how to pull values out of sessions to use in another page. I set the values as: session_start(); session_register{'magazine'); session_register('company'); The data is saved as a session because I can read the file located in my /tmp directory. Now I click on a link and go to a different page and I do: session_start() Magazine: Company: Should I be able to retrieve the values in this fashion? I'm using php 4.1.2. Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Checking Client's Cipher Strength with IIS
Hello, I have a question who's answer has been bugging me for a while. What I need to do is write a script that detects if a browser is using 128-bit encryption when connecting to our website. While this is easy for most (I have the script working for them), a real problem for me has come up with clients that run IE on Windows 2K without 128-bit support (ie 40-bit or 56 instead). Do any of you fine ladies and gentlemen know how to detect a browser's cipher strength using PHP (or any other web language)? I am running PHP 4.3.1 on IIS 5.0 on a Windows 2000 server. I have tried using some server vars (namely HTTPS_KEYSIZE) but that reports incorrect data with the win2k/IE/56-bit configuration I mentioned above. Any help is appreciated and thanks in advance, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php session not persisting
Do you have cookies enabled on your browser? If not then you will need to make sure that you compile or change your php.ini to reflect that (ie with trans-sid). ed -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 3:42 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] php session not persisting On Tuesday 03 June 2003 12:28, Eric D. wrote: > I have two very simple php scripts and the second srcipt is not seeing the > variables session_registered by the first script. > I'm running the latest version of php. And have both "register_globals" and > "track_vars" set to "ON". It's best to state the specific version of PHP you're using rather than just 'latest' (as it could mean different things to different people at different times). > Well, the first script prints out the session var fine, but not the second > one. What is wrong? Is there something else I overlooked? Thanks for your > help! If you're using PHP > 4.1.0 then you ought to be using $_SESSION for all your session needs -- see manual for examples. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I have a map of the United States. It's actual size. I spent last summer folding it. People ask me where I live, and I say, "E6". -- Steven Wright */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problems?
Couple of clarifications Dale: Is this an internal intranet server? Can it be? Do you have admin rights to the server? What's OS and Server are you running? ~Ed -Original Message- From: Dale [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 1:21 PM To: [EMAIL PROTECTED] Subject: [PHP] problems? I have the following scenario: I have this timeclock program that my employees access by logging into and the program pretty much allows them to clock-in and clock-out. The problem is that I noticed some of the employees were clocking-in and clocking-out from their home. The main problem is that the machine at work that the employees use to access this program does not have a static ip address. Is there any way to access the mac address in php. Any ideas? thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Registered sessions.
You need to append the session name and id to the header location everytime you redirect that way. So your header redirect should read: header('Location: researchpapers2.php?'.session_name().'='.session_id()); When you have normal links to other pages you don't have to do this but on header redirects like the one above you do. Hope this helps, ed -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 5:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Registered sessions. Hi, I have a php page that validates if a username and password are valid. if they are the php page registers and assignes a session variable a value. Then straight after that it automatically calls then next php page using the header("Location: researchpapers2.php"); command. My question is: does the session variable still get passed to the researchpapers2.php page, with the header command? because it doesnt seem to receive a session variable. any advice as to where i am going wrong??? thanx Angelo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php