Amezis
Oct 7 2006, 11:33 AM
| | I am trying to make a login system that looks and works like .htaccess using sessions, with a PHP script that detects the username used.
Let's say I log on with the username "Amezis" and correct password. Then I want a PHP (or any other kind of script) to create a cookie or session which stores the user name, so it could be possible to store it in a variable as long as the user is logged in, and so it can be printed when needed.
Basically, this is what I want the script to do:
CODE /* This file can only be executed after logging in with the htaccess-style login screen */
/* Then, detect the used username, so it can be stored in a variable using a cookie or session, and that way, it can be printed on this page, or on another restricted user page as long as the user has logged in with the htaccess-screen and the session is valid */
/* Content */
|
Reply
rvalkass
Oct 7 2006, 03:51 PM
When you say an .htaccess-style login, do you mean you want a popup login box, or you want usernames and passwords stored in a text file? The PHP code for reading a text file and reading a database is very different and requires different logic. A popup login box would just require some JS, or if it doesn't need to popup then a simple HTML form would suffice.
Reply
Amezis
Oct 8 2006, 02:22 PM
I was thinking about a popup login box, preferably made with .htaccess. I want the PHP script to simply detect what the entered information is (username, password).
Reply
jlhaslip
Oct 8 2006, 03:17 PM
java or javascript would be the wise way to do the pop-up, yes?
Reply
Amezis
Oct 8 2006, 06:12 PM
No, I want something like the cPanel login screen, which can be made using a .htaccess file. I do not have problems using .htaccess, but I want PHP to detect the submitted info, which is in this case the username and password. A javascript login would be plain stupid and not secure at all, and it's not possible to make the .htaccess login box with javascript, and I don't see why I would use java for it. If someone still don't understand my problem, then I'll try to explain it again: I have a .htaccess file pointing to a password file outside the public directory with 4 usernames and passwords, which protects a specific directory. When the user submits the correct username and password, PHP will detect the username used for the login so it can be either stored in a cookie or saved as a session so it can be possible to echo the user name later.
Reply
jlhaslip
Oct 8 2006, 06:37 PM
Exactly. Use javascript to pop-up the box containing the php script.
Reply
shadowx
Oct 8 2006, 08:06 PM
I understand your problem, but as said javascript is the best way to go . javascript will make the popup box and it will look identical to that of the .htaccess method then the values of username and password will be stored in GET or POST global variables so that the php page that comes next will take those values and compare them to the ones in the file, if correct you get in, if not you get redirected. the easiest way in my opinion would be to use a database or to include the correct usernames and passwords list in the php file. it will be safer i think and easier to work with
Reply
michaelper22
Oct 9 2006, 02:10 AM
I understand what the guy wants, and I know there is a way to do it. It does not involve JS. When you make a CGI request, there are two variables that are included in the array of environment variable. I do not know the names of those variables offhand, but some research will bring results. The variables contain the username and the passowrd, most probably Base64 encoded.
Reply
Amezis
Oct 9 2006, 10:05 AM
Well, I want to do this to secure folders and files that cannot be loaded by regular visitors. I'm pretty sure that there is no good way to secure images and .exe files using PHP, that's why I'm using .htaccess for it. Heck, I will have to make two login systems: One protecting the folder, and one identifying the user. I know it is possible, because I have seen several systems using it. And I don't really see why I should do a popup login screen with Javascript, there wouldn't be much sense making one. A popup login like .htaccess made with javascript wouldn't be more useful than a regular login form. I have to use .htaccess. There is no way, as far as I know, to make better login system which protects all types of files (PSD, JPG, GIF, EXE, ZIP, RAR, and so on) except .htaccess. But again, I want to make it possible to allow the .htaccess login to work for the PHP files, so the user don't have to log in twice.
Reply
michaelper22
Oct 9 2006, 02:39 PM
I will look into this for you. As I said, there is a way to do this. like cPanel did. Just give me some time - might have a sloution by the afternoon (my time - as I post it's 10:40 AM).
Reply
Latest Entries
farsiscript
Oct 13 2006, 08:23 AM
Dear rvalkass which one is better login form pop menu ( .htaccess ) or database ? i know in datbase we can use password in many format like (md5) and .... but i want to know which login is be in safe ?
Reply
Amezis
Oct 10 2006, 03:11 PM
Wow! That's all I needed! Thanks a lot!!! I can't believe it was that easy, but many, many thanks once again!!
Reply
michaelper22
Oct 10 2006, 02:58 PM
I did some research, and came up with these to findings: QUOTE 'PHP_AUTH_DIGEST' When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation).
'PHP_AUTH_USER' When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user. 'PHP_AUTH_PW' When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user. 'AUTH_TYPE' When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.
I got this from the PHP manual ( http://us2.php.net/manual/en/reserved.variables.php).
Reply
Similar Topics
Keywords : htaccess, style, login, system, php
- One Login Account At One Time
(3)
Html Site With Login
Is it possible? (2) Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
and mysql database in a html site? ....
Login System
(6) i am designing a site for my alliance for the game Dark Throne. and i want some content to be
availabe to members of the alliance only, and other content to be available to people with a certain
rank within the alliance. i know this should be somewhat simple, but i am not that sure how to do
it. my idea for the website is just have basic info about the alliance available to everyone, then
news about the alliance and member lists and other things like that available to every alliance
member, then things such as the strike team, diplomat team, and special areas like that,....
Php Login Script
(1) I'm looking for a good php login script. I would like one where it pops up. like http-auth. but
with out the data base. I would also like for it to have a log out fuction.....
Creating A Login Box That Links To My Phpbb Forum
Have my phpBB Forum Intergrated with my Website (4) Can someone please give me a code that I can use to put a login box on my website, that will login a
user into my phpBB Forum? Sort of like Having my phpBB Forum Intergrated with my Website? Thank you
so much if you can! /angel.gif" style="vertical-align:middle" emoid=":angel:" border="0"
alt="angel.gif" /> Ex. ....
Windows Login Credentials
(0) On an intranet I'm running php. apache and mysql. We use Windows logins. I have a form that
users can submit. This will require a login. I would prefer to use the windows login and passwords.
can I link to the windows authentication? The issue I see is when a user changes the password. My
link would need to update the password....
Is This A Good Script?
A login script (9) Okay, I am trying to password one page of my website. I need confirmation if this is a safe code or
not. The whole code is on the page I'm protecting. CODE <?php
include('header.php') ?> <?php // Define your username and password
$username = "THE_USERNAME"; $password = "THE_PASSWORD"; if
($_POST['txtUsername'] != $username ||
$_POST['txtPassword'] != $password) { ?>
<h1>Login</h1> <form name="form" method=&....
Phpmyadmin Login Problem!
(1) I have easyphp. But i can not log when i go to phpmyadmin. I directly enter the page. But i think i
should normally have to log in before enter that page. What should i do to configure the access to
phpmyadmin? Thank for help....
Login System Help...
(3) I know, nol tried to use this script.. and erm.. i think failed.. but i installed it all good, works
fine, UNTILL........ i tried to add a new option to the registration. Thhis is the url to the
site.. where the dl is.. http://evolt.org/PHP-Login-System-with-Adm...nts_per_page=50 I would
really appreciate it if somebody could add, in all the php files properly a new registration thing,
called "name" where they write their name in so i know it for future reference. if somebody could
get that to me i would really appreciate it. ALSO... if you can't do that, or jus....
<?php ?> Sloppy Login Script
Sloppy login script, couse i used @ on one string (12) Here's a sloppy 3 files login script. First file is Login file that looks like this login.php
CODE <form action="check.php" method="post"> Username: <input
type="text" name="username1"><br /> Password: <input
type="password" name="password1"><br /> <input type="submit"
value="Login"> </form> Basicly that is HTML form that's used for input
Second part of the script is the check.php that we call from our login.php form QUOTE ....
New Arisen Site Problem
Nettek Login Trouble (2) Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
it's incorrect. I've gone into the Database and gotten the password and since it was
simple, put them in and had tried but with no success. I tried changing the password but I still
couldn't get in. I tried adding another login and it still didn't work. I have no idea
what's wrong and I need some help.....
What Does This Do?
$ban = ($data->login) ? $lban : $iban; (4) I'm correcting a 'few' php-files for a friend, but I got this line of code: CODE
$ban = ($data->login) ? $lban : $iban; and I don't know
what it does xD Could someone please explain me what this line does? Thanks....
Help Improving My Login Script Code
The code works okay...just not the authorization part (4) I have developed a piece of code /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
alt="smile.gif" /> that is going to work as my login script for my website. I need some help making
improvements and creating additional features. Here is my code: CODE <?php
session_start(); $name = $_POST['username']; $password =
$_POST['password']; $con =
mysql_connect("localhost","myDbUser","myDbPassword");
if(!$con) { die(....
[^] Need Help With Regex (for .htaccess)
(2) Well, I ran into a problem. I tried to make a code that matched everything, except strings
containing the word "php", "gif", "jpg" etc. I tried doing something like this, but it didn't
work: CODE ([^\b(php|gif|jpg)\b]+)$ But that works
just like if I would do this: CODE ([^phgifj]+)$ That code is a part of
a larger code that only works partially: CODE RewriteEngine on RewriteRule
([^\b(php|gif|jpg)\b]+)$ item.php?n=$1 Some
strings, su....
Login Script
(11) I am using the following code as a login page. I try to start by checking if a session already
exists so that people don't have to login each time. The problem is that it is just being
ignored. How do I check if a session is already set? CODE if
(isset($_SESSION['loginname'])) { print('you were
already logged in'); } else { if (submit) {
list($users,$passwords,$accounttypes)=GetCurrentUsers($user,$
password,$accounttype); $nologin=1; for (&....
Sessions And Login
Without Cookies (5) Hi, I have a login script i made using PHP sessions and MySQL. It works fine but there is a
problem. As you know Sessions are stored in Cookies by PHP. So if someone has switched Cookies off
then no sessions will work. How to solve this problem ? Please help me. Thanks and have a good
day. ....
Automatic Login Using Curl
(1) If you'are lazy people like me. This script may help u. This script is to automated our login to
some site. You must have cURL installed to use this script. CODE <?php // INIT CURL
$ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch,
CURLOPT_URL, 'http://www.external-site.com/Members/Login.php'); // ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH
FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldna....
"grand" Login System?
To Forums, Chat, and Site (7) Major problem I got here. A site at which I am employed as PHP Coder (privet-drive.com), needs a
"grand" login. The login needs to be able to login them into the forums, the chat, and the site, all
at the SAME time! The big problem is, the chat is located on another website (potterchat.net),
and the forums are IPB and not PHPBB. Any comments, or some tips on how I am to go about this? I am
freaking out, and any advice at all would be nice! Thanks in advanced!....
Login / Authetication System Using Database
adding information (4) Is there any way to make such database where I can write like name and passwords.. Then make an
login box, and when somebody trys to acces the login he needs to write the name and password.. Then
it is verifyed if is there such name and password and if it is then acces the page.. I think there
is posible something like that with MySQL (db).. but can anybody say me a script or way to make
something like that? Alredy thanks......
Customizing Login Script
please help anyone good in PHP.. (8) On my main site i have this login box: Click here! ... And I want to change the look of it in
new adress but I have only things can be get from that adres.. I put that login box (new) in my
website and changed the page that opens but when you try to login with wrong username or password..
It opens like you typed right usernam and password.. So I need to make it work like normal login
box but there can be logen in with only right username and password.. I think there need to be added
some cookies or something to that page.. So someone who is good in PHP please help....
.htaccess Redirect Question
redirect ALL traffic to another domain (6) I want to redirect all my traffic from one site to another domain name. Is this possible, and if so,
would I do something like this: .htaccess code: CODE redirect 302 /
http://www.mynewdomain.com Thanks!....
Problem With A Login Script
(10) I'm making a simple login script, but it doesn't seem to work like I want. The error
messages work, but if I actually write the right username and password, it won't work.
Here's the message I get: QUOTE Warning : Cannot modify header information - headers
already sent by (output started at /home/ngnorge/public_html/fsm/index.php:7) in
/home/ngnorge/public_html/fsm/logginn/login.php on line 9 Here's the script: login.php
CODE <?php include('config.php'); if($action ==
"submit"){ if((....
Login
(4) I have a mysql database with 99 people. The first column on db is call id and assigns a diferent 4
digit number to each person. Second column contains each person`s complete name.... someone tells
me i need an adittional user column to asign a username to each person...(cause i want a login page)
but since i already have a different name and a different id for everybody, why would i need a such
column? can someone please tell me how can i use this 2 columns (name and id) so they can type
their complete 4 digit id and just part of their name to enter through a login p....
User Login System With Setcookies
(13) a friend of mine is quite good at php and told me not to use sessions and to use setcookie im not
sure how to use setcookie to make a user authentication system and was wondering if anyone here know
a tutorial on how to do it....
Php G-mail Login
Compatable on all browsers (8) I fount a PHP G-mail login script to login to your g-mail using any browser. Even IE1, I installed
it on my site at http://www.gmail.mbd5882.trap17.com/ I tested it myself, Its safe. gmail-lite is
an html-only interface of GMail. It was develope it with PDA browser (mostly Netfront) in mind, it
should be workable with any browser on Earth (e.g. lynx, ie3, netscape4, opera5. The only tags being
used are A, B, FORM, H1, I, INPUT, P, SELECT, TEXTAREA, TABLE, TR, and TD (and META and STYLE in
HEAD). It alows you to send 10 invites at once and is fast. It uses cookies i, An....
Php Sessions
Multiple users using the same login (2) Hi, I'm realtively new to PHP and I'm considering creating some login functionality.
However I want a group of users to use the same loginname and password. They will be loggin infrom
different machines. The users will know they are sharing the account. Can anyone give me an idea
of what kind of effect this might have on my sessions? Will it create any odd hiccups or other
strange things?....
Php Login Script
Removing the login field once the user logs in (18) Hey everyone. I have a login script that i know works. My question is that on my main page, it have
a form to allow the user to log in. What i want it to do is that once the user logs in, the form
disappears and the users data (aka username) is displayed where the form was. At the moment i cant
get it to work. Below is my code. CODE <div id="loginMenu"> <?php if
($logged_in == 1) { ?> <!-- User information --> <?php
}//if else { ?> <form action="<?php echo &....
Login Not Working (uses Mysql)
(11) I don't know what's going wrong here, but it's probably a typo: CODE $iusername
= $_POST['username']; $ipassword =
stripslashes($_POST['password']); include "opendatabase.php";
opendatabase(); $userrow = mysql_query("SELECT * FROM `users` WHERE
`username`='$iusername' LIMIT 1;"); $userarr =
mysql_fetch_array($userrow); $ipassword = md5($ipassword);
if($ipassword != $userarr[3]....
.htaccess Charset Problem...
(2) I have a problem with the charset in my php page... firstly the whole site included .html and .php
didn't automaticly get the right charset i put in the meta content so I added a .htaccess file
CODE AddDefaultCharset Big5 then it works fine with the .html file extension... but not my
php file... so i added another line in .htaccess file CODE AddCharset Big5 .php but still
not working... there is something i wondering... coz my link to the php file is "foo.php?A=B" would
that be the problem that the .htaccess file dun see it as a normal .php? Pl....
Login System
Let's do it! :) (40) First, let's do register.php: include("conn.php"); // create a file with all the database
connections if($do_register){ // if the submit button were clicked if((!$name) ||
(!$email) || (!$age) || (!$login) || (!$password) ||
(!$password2)){ print "You can't let any fields in blank.\n"; // if the user did
not put some field exit; } $name = stripslashes($name); $email =
stripslashes($email); $age = stripslashes($age); $login =
stripslashes($login); $passw....
Looking for htaccess, style, login, system, php
|
|
Searching Video's for htaccess, style, login, system, php
|
advertisement
|
|