RE: [PHP-DB] Login script help

2006-12-22 Thread Haig Dedeyan
Thanks Miles.

That works nicely.

Regards


-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 21, 2006 10:29 PM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Login script help


When user has authenticated successfully, start a session with an 
authentication key - almost anything you want.

After that, any page you want to protect you just put one line at the
top 
to check for the presence of this value; redirect to login page if it's
not 
there.

Regards - Miles


At 11:19 PM 12/21/2006, Haig Dedeyan wrote:

Thanks.

If I do it that way, can't someone get into the index page if they link
directly to it without having to log in?



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 21, 2006 7:36 PM
To: Haig Dedeyan; php-db@lists.php.net
Subject: RE: [PHP-DB] Login script help

why not just create a simple single logon page and not include
itthen on
sucessful login, redirect the user to the index page?

bastien


 From: Haig Dedeyan [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] Login script help
 Date: Thu, 21 Dec 2006 16:36:11 -0500
 
 Hi everyone,
 
 My 1st attempt at creating a login script isn't going so good, so
 hopefully someone can help me out.
 
 The login script itself works fine but when I include it into a web
 page, the login.php script shows up but the entire index.html page
also
 shows up.
 
 I just want people to log in before they get to index.html.
 
 Index.html starts off with:
 
 ?php
 session_start();
 include(database.php);
 include(login.php);
 ?
 
 I'm using php5.
 
 Thanks
 
 Haig
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

_
Off to school, going on a trip, or moving? Windows Live (MSN) Messenger
lets
you stay in touch with friends and family wherever you go. Click here
to

find out how to sign up!  http://www.telusmobility.com/msnxbox/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.26/594 - Release Date:
12/20/2006

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Login script help

2006-12-21 Thread Bastien Koert
why not just create a simple single logon page and not include itthen on 
sucessful login, redirect the user to the index page?


bastien



From: Haig Dedeyan [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Login script help
Date: Thu, 21 Dec 2006 16:36:11 -0500

Hi everyone,

My 1st attempt at creating a login script isn't going so good, so
hopefully someone can help me out.

The login script itself works fine but when I include it into a web
page, the login.php script shows up but the entire index.html page also
shows up.

I just want people to log in before they get to index.html.

Index.html starts off with:

?php
session_start();
include(database.php);
include(login.php);
?

I'm using php5.

Thanks

Haig

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



_
Off to school, going on a trip, or moving? Windows Live (MSN) Messenger lets 
you stay in touch with friends and family wherever you go. Click here to 
find out how to sign up!  http://www.telusmobility.com/msnxbox/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Login script help

2006-12-21 Thread Haig Dedeyan
Thanks.

If I do it that way, can't someone get into the index page if they link
directly to it without having to log in?



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 21, 2006 7:36 PM
To: Haig Dedeyan; php-db@lists.php.net
Subject: RE: [PHP-DB] Login script help

why not just create a simple single logon page and not include
itthen on 
sucessful login, redirect the user to the index page?

bastien


From: Haig Dedeyan [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Login script help
Date: Thu, 21 Dec 2006 16:36:11 -0500

Hi everyone,

My 1st attempt at creating a login script isn't going so good, so
hopefully someone can help me out.

The login script itself works fine but when I include it into a web
page, the login.php script shows up but the entire index.html page also
shows up.

I just want people to log in before they get to index.html.

Index.html starts off with:

?php
session_start();
include(database.php);
include(login.php);
?

I'm using php5.

Thanks

Haig

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_
Off to school, going on a trip, or moving? Windows Live (MSN) Messenger
lets 
you stay in touch with friends and family wherever you go. Click here to

find out how to sign up!  http://www.telusmobility.com/msnxbox/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Login script help

2006-12-21 Thread Miles Thompson


When user has authenticated successfully, start a session with an 
authentication key - almost anything you want.


After that, any page you want to protect you just put one line at the top 
to check for the presence of this value; redirect to login page if it's not 
there.


Regards - Miles


At 11:19 PM 12/21/2006, Haig Dedeyan wrote:


Thanks.

If I do it that way, can't someone get into the index page if they link
directly to it without having to log in?



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 21, 2006 7:36 PM
To: Haig Dedeyan; php-db@lists.php.net
Subject: RE: [PHP-DB] Login script help

why not just create a simple single logon page and not include
itthen on
sucessful login, redirect the user to the index page?

bastien


From: Haig Dedeyan [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Login script help
Date: Thu, 21 Dec 2006 16:36:11 -0500

Hi everyone,

My 1st attempt at creating a login script isn't going so good, so
hopefully someone can help me out.

The login script itself works fine but when I include it into a web
page, the login.php script shows up but the entire index.html page also
shows up.

I just want people to log in before they get to index.html.

Index.html starts off with:

?php
session_start();
include(database.php);
include(login.php);
?

I'm using php5.

Thanks

Haig

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_
Off to school, going on a trip, or moving? Windows Live (MSN) Messenger
lets
you stay in touch with friends and family wherever you go. Click here to

find out how to sign up!  http://www.telusmobility.com/msnxbox/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.26/594 - Release Date: 12/20/2006

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] login script

2004-04-27 Thread Mikael Grön
Here you go:

Table:

ID  Login   PW  Admin
1   admin   abc123  1
2   normal  bcd234  0
3   normal2 cde345  0
PHP:

[BOF]
?php
	if($_POST['login']) {
		$result = mysql_query(select * from users where login = ' . 
$_POST['login'] . ') or die(mysql_error());
		if (mysql_num_rows($result)) {
			$data = mysql_fetch_array($result);
			if ($data[2] == $_POST['pw']) {
$_SESSION['login'] = $data[1];
if ($data[3]) {
	$_SESSION['admin'] = true;
}
header(Location: logged_in.php);
exit;
			} else {
$error = Wrong password;
			}
		} else {
			$error = No such user!;
		}
	}
if ($error) {
	echo span class=\loginError\$error/spanbr /;
}
?
html
head
	titleLogin Script by [EMAIL PROTECTED]/title
style
!--
.error {
	color: #ff;
}
--
/style
head
body bgcolor=#FF
form action=login.php method=post
Login name: input type=text name=login value=?php echo 
$_POST['login'] ? /br /
Password: input type=password name=pw /br /
input type=submit value=Login  /br /
/form
/body
/html
[EOF]

In your admin system, just check for the variable $_SESSION['admin']. 
If true, the user is admin and can do cool stuff.. ;)
I don't care about just having given you a lot of script, since I write 
at least 3 of these per week.
And, make sure there is nothing echoed either by PHP or HTML before the 
login script (or else the redirecting upon successful login won't work)

Regards, Mike

On Apr 27, 2004, at 01:15, andy amol wrote:

hi,
  does anyone have a login script which will take data from the table 
and decide whether the given user is a admin or a normal user.
thanks in advance.

Also if there is some help on session variable I would like to know.

		
-
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] login script

2004-04-27 Thread Mikael Grön
Err...

As usual I forgot the most important part...
Add
	session_start()

just above the

	if($_POST['login']) {

row, or it won't work at all.. ;)
Or rather, it'll work, but no sessions will be saved.
Mike

On Apr 27, 2004, at 08:48, Mikael Grön wrote:

Here you go:

Table:

ID  Login   PW  Admin
1   admin   abc123  1
2   normal  bcd234  0
3   normal2 cde345  0
PHP:

[BOF]
?php
	if($_POST['login']) {
		$result = mysql_query(select * from users where login = ' . 
$_POST['login'] . ') or die(mysql_error());
		if (mysql_num_rows($result)) {
			$data = mysql_fetch_array($result);
			if ($data[2] == $_POST['pw']) {
$_SESSION['login'] = $data[1];
if ($data[3]) {
	$_SESSION['admin'] = true;
}
header(Location: logged_in.php);
exit;
			} else {
$error = Wrong password;
			}
		} else {
			$error = No such user!;
		}
	}
if ($error) {
	echo span class=\loginError\$error/spanbr /;
}
?
html
head
	titleLogin Script by [EMAIL PROTECTED]/title
style
!--
.error {
	color: #ff;
}
--
/style
head
body bgcolor=#FF
form action=login.php method=post
Login name: input type=text name=login value=?php echo 
$_POST['login'] ? /br /
Password: input type=password name=pw /br /
input type=submit value=Login  /br /
/form
/body
/html
[EOF]

In your admin system, just check for the variable $_SESSION['admin']. 
If true, the user is admin and can do cool stuff.. ;)
I don't care about just having given you a lot of script, since I 
write at least 3 of these per week.
And, make sure there is nothing echoed either by PHP or HTML before 
the login script (or else the redirecting upon successful login won't 
work)

Regards, Mike

On Apr 27, 2004, at 01:15, andy amol wrote:

hi,
  does anyone have a login script which will take data from the table 
and decide whether the given user is a admin or a normal user.
thanks in advance.

Also if there is some help on session variable I would like to know.


-
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] login script

2004-04-26 Thread Marcjon Louwersheimer
This is kind of a big thing. Email me and I'll give you instructions/tips
on making it.


- Original message -
From: andy amol [EMAIL PROTECTED]
To: php php [EMAIL PROTECTED]
Date: Mon, 26 Apr 2004 17:15:27 -0700 (PDT)
Subject: [PHP-DB] login script

hi,
  does anyone have a login script which will take data from the table and
  decide whether the given user is a admin or a normal user.
thanks in advance.
 
Also if there is some help on session variable I would like to know.


-
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] login script

2003-01-31 Thread SELPH,JASON (HP-Richardson,ex1)
try: 
http://www.hotscripts.com/PHP/Scripts_and_Programs/User_Authentication/
there are loads of pre done scripts you can reference.

Cheers
Jason

-Original Message-
From: Matt [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 11:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] login script


Anyone have any suggestions on how to go about creating a solid login
script?  I have a MySQL database with a field called LoggedIn that is by
default NO but I want it to turn to YES when the user logs in, and I
want it to turn back to NO when the user either logs out, or a certain
amount of time goes by and they timeout.  I was just wondering if anyone had
any suggestions for me on how to go about this process.  Thanks a lot.

Matt



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] login script

2003-01-31 Thread Bruno Pereira
Hi,
is like this, i will try to explain my self.
I have a sendmail in GNU/linux, and a radiator GNU/Linux with Mysql. I have
to give a diferente user for de dialup login and the sendmail, cause i can't
or i dont know a way to change the user and pass for the user in the two
servers. Like this, the user to make a dialup conection has a user and a
pass and for the sendmail has another, and, if there is any changes, when
the user changes de user or pass from one can't at the same time change the
user/pass from the other. can someone help me


Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]]
Sent: sexta-feira, 31 de Janeiro de 2003 17:52
To: Matt; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] login script


try:
http://www.hotscripts.com/PHP/Scripts_and_Programs/User_Authentication/
there are loads of pre done scripts you can reference.

Cheers
Jason

-Original Message-
From: Matt [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 11:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] login script


Anyone have any suggestions on how to go about creating a solid login
script?  I have a MySQL database with a field called LoggedIn that is by
default NO but I want it to turn to YES when the user logs in, and I
want it to turn back to NO when the user either logs out, or a certain
amount of time goes by and they timeout.  I was just wondering if anyone had
any suggestions for me on how to go about this process.  Thanks a lot.

Matt



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Login Script please?

2001-11-11 Thread Peter Lovatt

If they don't allow external connections then you won't be able to connect
directly from UltraDev, only from uploaded scripts.

Learn php, write them and run them!

Alternatively switch to a host which allows external connections?

No quick answers.


Peter

 -Original Message-
 From: W3bDevil [mailto:[EMAIL PROTECTED]]
 Sent: 11 November 2001 10:52
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Login Script please?


 I have a server that doesn't allow external connections. They say its to
 protect the data for me and my customers (even though I don't actually
 have any). Anyway, I've tried everything, and I'm going to start learning
 PHP later this year, but I'm in a hurry here:

 I've configured my database with PHPmyAdmin, and I've got UltraDev 4 with
 PHAkt. Not forgetting all the other stuff I downloaded, like mySQL MAX 4.0
 and OmniCron HTTPd Pro.

 I've got a connection set-up with all the correct details by just entering
 the connection details in PHAkt connection settings, and I've made the
 System DSN. But when I click test or try to define a log-in server
 behaviour (where it then tries to connect and aquire a list of tables and
 fields) It comes up with an unknown host message. I contaced my host and
 they said its because they don't allow external connections.

 So does anyone have a solution?
 Or should I just modify a working PHP Log-in page and replace it with my
 values and variables?

 Thanks
 W3bDev£



 --
 PHP Database 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 Database 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]