LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-17-2005, 05:51 AM   #1
aznita
LQ Newbie
 
Registered: Jun 2005
Posts: 11

Rep: Reputation: 0
Block user in PHP


Hello, I want to do security which will check if user enter password for 3 time then block...else...can enter again until 3 time...

Help me please
 
Old 06-17-2005, 06:13 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I would use a $_SESSION variable
PHP Code:
<?
session_start
();

if(!isset(
$_SESSION['PASS_TRY'])) {
    
$_SESSION['PASS_TRY'] = 1;
} else {
    
$_SESSION['PASS_TRY']++;
}
?>
 
Old 06-17-2005, 06:22 AM   #3
aznita
LQ Newbie
 
Registered: Jun 2005
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks...Erm..
Then..i shoud do if statement right...
if $PASS_TRY = 3
{
exit
}
else
{
//can enter again
}

am i in the right track..because i am realy new in php..and when i seacrh in internet, i didn't get what i want(maybe i am not a good surfer..hahaha).
Please..help me...
 
Old 06-17-2005, 06:30 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You have to use the $_SESSION Array
PHP Code:
if( $_SESSION['PASS_TRY'] == 3) {
    exit;

look at www.php.net for documentation
From here, the session docs : http://www.php.net/manual/en/function.session-start.php
 
Old 06-17-2005, 06:49 AM   #5
aznita
LQ Newbie
 
Registered: Jun 2005
Posts: 11

Original Poster
Rep: Reputation: 0
It's work...thank you so much....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Block User Login minil Linux - Security 6 12-19-2005 09:00 AM
Block a Particular User through FTP service karthi Linux - Security 1 11-07-2005 03:57 PM
Block a Particular User through FTP service karthi Linux - Security 1 11-07-2005 02:23 PM
How can I block net access for 1 user? jimk Linux - Security 10 11-26-2004 11:43 AM
How to block lsmod and su so user can't use those command Ninja_212 Slackware 4 04-18-2004 12:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration