[PHP] .htaccess and determining if a user is logged in
I'm using Apache .htaccess to require certain users to log into the system in order to view certain files. However, on one of my php scripts, it's not within the realm of .htaccess protection. How do I determine if the user viewing the page is an authenticated user or not? I want to present these authenticated users with additional features while viewing the page. Do I just check REMOTE_USER for a value? I'm not even sure if that works. For the most part, I don't want to really care about any intensive php link with user log in's. I like the simple approach of .htaccess. Any help would be greatly appreciated. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] .htaccess and determining if a user is logged in
I've done further investigation and it seems that if I go with the approach of looking for a REMOTE_USER value, I'll have to do the following: Since Apache only fills out the REMOTE_USER if the file is in a protected directory, I have to make a symbolic link within a protected directory to the non-protected script. Then Apache will require authentication for the file. Thus, both non-authenticated and authenticated users are running the same script. Any problems with this approach? My worry is that if the user passes $REMOTE_USER="FooledYou" in the url, it'll fool my script into thinking Apache sent it. I'll have to check into that one. Any better ideas? -Original Message- From: David Hall Sent: Tuesday, July 24, 2001 6:15 PM To: [EMAIL PROTECTED] Subject:[PHP] .htaccess and determining if a user is logged in I'm using Apache .htaccess to require certain users to log into the system in order to view certain files. However, on one of my php scripts, it's not within the realm of .htaccess protection. How do I determine if the user viewing the page is an authenticated user or not? I want to present these authenticated users with additional features while viewing the page. Do I just check REMOTE_USER for a value? I'm not even sure if that works. For the most part, I don't want to really care about any intensive php link with user log in's. I like the simple approach of .htaccess. Any help would be greatly appreciated. Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: insert to DB
$sql = "UPDATE leaderboard SET Name='$Name', Rating='$Rating' WHERE ID=$id"; //replace news with your table name above $result = mysql_query($sql); echo "Thank you! Information updated."; } } ?> You don't set id in this case. Of course, from some of your other code, it looks like you're relying on register_globals to be on, so maybe it is and that's not why. David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with modifying values
modify_values2.php ++ You'll want to do something like: $id = mysql_real_escape_string($_GET['id']); $sql = "Select * from leaderboard WHERE ID='$id'"; David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] Load from db into -list
Gustav Wiberg wrote: Ajax? What is that? http://en.wikipedia.org/wiki/AJAX php is a server side language, so you must refresh the page to have php do it directly, so using AJAX, you can talk to the server from the page. D. Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP interference in frames
Albert wrote: same server at the same time. Don't know where to change it in Mozilla. type about:config in browser window network.http.max-persistent-connections-per-server in the line the default value is 2, so I think that's our answer David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP for Mac
Richard Correia wrote: Hi, I want to install PHP5 on Mac powerbook G4. Can someone please let me know where I can find it and it's related module? I am mainly looking for GD and mingswf module on Mac. http://www.phpmac.com/articles.php?view=244 very good instructions on compiling. As shown in that tutorial (and works for me), just saying --with-gd in the configure options works well. As for mngswf, I'd just recommend doing .\configure --help and seeing what that pops up for how to build mngswf in, but it should just be --with-ming, presuming you have installed mngswf from http://ming.sourceforge.net/ (which is a whole different world that I can't help you with. But those directions gave me php 5 on my powerbook, so . . . David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: creating new class from wrapper class (OOP question)
Henrik Gemal wrote: In a image gallery I have to class'es: class GPicFilePicture extends GPicFileType class GPicFileMovie extends GPicFileType both of them are based on: abstract class GPicFileType In my code I need to create a new GPicFilePicture. To avoid duplicated code I've create a wrapper class: class GPicFile that does something like this: if (fileextension == "jpg") return new GPicFilePicture(); else return new GPicFileMovie(); so my PHP code looks like: $file = new GPicFile($filename); getFileDate() is implemented in both GPicFilePicture and GPicFileMovie. Now I try to do: $file->getFileDate(); I get an error saying: Call to undefined method GPicFile::getFileDate() Where am I going wrong? My way for doing this summed up by the Factory Pattern described on this page: http://www.phptr.com/articles/article.asp?p=346958&seqNum=4 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5.0.5 include() terminates script BUGBUGBUGBUG
Jochem Maas wrote: the first and second line you can alter it or just switch between pending if you want it to display the file or just to tell you if it exists or not so...applying this code just before my include statments all verifys ok(thats the file exists) if i use line 1 nothing appearsit says the file exists according to line 2 yet it wont display??? of course i REM either line out accordingly.so...the register page starts with an include called session.php in that session.php i have another 3 includes... mailer.php,database.php and form.php each tested for line 2 and ok but not for line 1 nothing appears if i move that phpinfo.php file around into those directories(folders and subfolders) and test it then it ok's for line 1 i get a display and ok for line 2 too. but of course phpinfo.php when called doesnt have another include statement in it... i really cant explain it perhaps php 5.0.5 doesnt support multiple include statementsstrange??? thats just silly. it just isn't displaying errors, doing all this nonsense with file exists is a waste of time, just add two lines to the top of your script (that includes the file): error_reporting(E_ALL); ini_set('display_errors','on'); (or set these values in the php.ini if you have access to that) and look at what that tells you. You might not understand the error at first, but hopefully you will. My guess is that it will tell you it can't parse your included file. David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Managing sessions...
David BERCOT wrote: I think it is very heavy to write... I read about ini_set("session.auto_start",1) but, on my server (Debian), it doesn't session.auto_start doesn't make sense as being set in the actual file. its meant to be something that's done by the server on every file, so setting that in every file is something that wouldn't make sense with its function So, I'd like to put my options (use_trans_sid, 0, etc...) and to have lite scripts. Is it possible ? Isn't there, like in asp, a global.asa where I can put all my parameters ? I mean, there's the php.ini . . . Otherwise use includes like the other poster said Also, if you can't change the php.ini, but you're on an apache server, see this stuff http://us2.php.net/manual/en/configuration.changes.php David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] way to write mysqli result set to disk
James Benson wrote: jonathan wrote: hmm is this a mysql 5 feature. could be interesting but haven't heard much about it. You cannot see the mysql 5 plastered all over the page? I can see at least 5 different sections that say MySQL 5 you obviously don't use the mysql website enough to know that just cause you're looking in the mysql 5 manual, its a mysql 5 feature. http://dev.mysql.com/doc/refman/4.1/en/query-cache-in-select.html That's proof it was before mysql 5, because mysql 5 isn't plastered everywhere . . . Your reply was rude and unintelligent (Oh noes . . . http://dev.mysql.com/doc/refman/5.1/en/select.html Select statements are a mysql 5.1 only feature. We're gonna die . . .) David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: doubt regarding while loop
suresh kumar wrote: while(list(t1,t2,...)=mysql_fetch_row($result)): do you mean to use: while(list($t1, $t2, . . .) = mysql_fetch_row($result)): David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID vs NAME in different browsers
Niels wrote: name = cdata [CI] This attribute names the element so that it may be referred to from style sheets or scripts. Note. This attribute has been included for backwards compatibility. Applications should use the id attribute to identify elements. Uh, sorry to disappoint, but that's a description of the form element, not of the input element or select input. In fact, if you go to http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 , you will see that the example form quite clearly uses name. And for the input element, http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.4.2 says that name assigns the control name. The attributes for the form element are completely independent of the input elements. (Note, for things like radio buttons, using id makes no sense. You must have multiple elements with the same name. If you used id for these multiple elements, you would be breaking the rules of html saying only one element can have a certain id . . .) David Hall -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php