Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Need Help: PHP Security - Login Script For Site, security
thenumberone
post May 6 2006, 10:04 AM
Post #1


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 28
Joined: 27-April 06
Member No.: 13,048



i made a website with php.
after user enters username and password then i direct him to index.htm
Question:I want when unregistered user enter www.mysite.com/index.htm a message must be come that you must be login.
I wait your helps.
Go to the top of the page
 
+Quote Post
ganeshn11
post May 6 2006, 04:33 PM
Post #2


Advanced Member
Group Icon

Group: Banned
Posts: 149
Joined: 2-December 05
From: Bangalore, India.
Member No.: 9,923



This is a very good site that can solve your problem fully. Here is the link http://www.free2code.net/plugins/articles/read.php?id=99, go a head!
Go to the top of the page
 
+Quote Post
AVEX
post May 7 2006, 06:46 AM
Post #3


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 7
Joined: 7-May 06
Member No.: 13,254



Webmaster avex

I read this topic and i helps surely

I made a admin secure room

CODE

<?php
if( isset($_POST["login"]))
{
    $query = mysql_query("select * from account where name='".$_POST["name"]."'");
    $row = mysql_fetch_object($query);
    $pass = md5($_POST["password"]);
    if("password" == $row->password && $_POST["name"] == $row->name)
    {
        setcookie ("login", $_POST["name"],time()+3600*365);
        echo "U bent ingelogt.";
        echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=?p=home\">";
    }
    else
    {
        echo "Error.";
    }
}
?>


This is the login aera it calls simply the database
And sets a cookie when you are logged in and calls error when you are not registered!

CODE

<?php
if( isset($_POST["reg"]))
    {
        if($_POST["name"] != "" && $_POST["email"] != "" && $_POST["name1"] != "" && $_password != "")
            {
                $telgb = mysql_query("SELECT gebruikersnaam FROM account WHERE name='".$_POST["name"]."'") or die($error[1]);
                $numgb = mysql_num_rows($telgb);
                if($numgb == "1")
                {
                    echo"<center>Account allready exists</center>";
                }
                else
                {
                       if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$", $_POST["email"]))
                           {
                            echo"<center>Error mail!</center>";
                          }
                         else
                             {
                                if($password != $_POST["password2"])
                                {
                                    echo "<center>Password are not the same</center>";
                                }
                                else
                                {
                                    echo"<center>You are registered.</center>";
                                    $pass= md5($password1);
                                    mysql_query("insert into account (name1,name,password,idate,email) values ('".$_POST["naam"]."','".$_POST["gebruikersnaam"]."','".$password."','".date."','".$_POST["email"]."')") or die(mysql_error());
                                }
                             }
                }
                }
                else
                {
                    echo "<center>Something is not ready.</center>";
                }
            }
?>



This is the register account name

And this you must copy on each page you want to secure
CODE

<?php
$query = mysql_query("select * from account where id='".$_GET["id"]."'");
$row = mysql_fetch_object($query);
$ex = mysql_num_rows($query);
if($ex == "0")
{
    echo "Dit acountje bestaat niet.";
    exit();
}
else
{here your tabel }
?>

After the else is your tabel when its a correct login
Go to the top of the page
 
+Quote Post
wojta
post Jun 1 2006, 03:57 PM
Post #4


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 23
Joined: 18-April 06
Member No.: 12,839



QUOTE(thenumberone @ May 6 2006, 11:04 AM) *

i made a website with php.
after user enters username and password then i direct him to index.htm
Question:I want when unregistered user enter www.mysite.com/index.htm a message must be come that you must be login.
I wait your helps.


if (! successfully_logged_in($_POST['user'])) {
display_login_form();
exit;
} else {

session_start();
$_SESSION['user'] = $_POST['user'];
header("Location: http://www.example.com/resricted_page.php");

}
Go to the top of the page
 
+Quote Post
vicky99
post Jun 7 2006, 04:10 AM
Post #5


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 54
Joined: 28-May 06
Member No.: 13,691



Dear AVEX
I have a request for you. Would you please give me the database structure of the login script you have build? I want to build a CMS. I guess this code can help me in understand how things wotk.
Go to the top of the page
 
+Quote Post
iGuest
post May 24 2008, 12:48 PM
Post #6


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



Security Log in
Need Help: PHP Security - Login Script For Site

How I can create security log in dialoge box.
I want only people that I let them visit my site and also manage them add baned and ... ??????


-reply by mk63
Go to the top of the page
 
+Quote Post
Feelay
post May 25 2008, 09:11 AM
Post #7


Kinda N00B
Group Icon

Group: Members
Posts: 219
Joined: 13-January 08
From: Sweden
Member No.: 27,579



sorry.. I didn't understand what you need.
QUOTE
How I can create security log in dialoge box.
? what is that huh.gif
maybe if you write a bit more clear, I am sure that I can help you.

This post has been edited by Feelay: May 25 2008, 09:11 AM
Go to the top of the page
 
+Quote Post
magiccode9
post Jun 1 2008, 05:04 PM
Post #8


Member [ Level 2 ]
Group Icon

Group: [HOSTED]
Posts: 55
Joined: 7-November 05
Member No.: 9,489



May be Feedbacker require show a login dialog when a anonyomous user visit to their site.
One they got auth, then, allowed to visit the site.

If so, try check the cookies set before. If they exists then, allow users to access the member area.
Otherwise, show the login dialog.
Go to the top of the page
 
+Quote Post
Mike gambino
post Jul 25 2008, 04:15 AM
Post #9


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 15
Joined: 25-July 08
Member No.: 31,646



QUOTE(thenumberone @ May 6 2006, 06:04 AM) *
i made a website with php.
after user enters username and password then i direct him to index.htm
Question:I want when unregistered user enter www.mysite.com/index.htm a message must be come that you must be login.
I wait your helps.

well for instant, there is also a loggedin.php or somethinglike that, depends on what you display but if you go onto loggedin.php, you can change the redirect key to longer than it is. that also lets you have enough time to post your message at the front page when they log on and people would read it and then they can manually redirect them self or let it redirect. what do you have?
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How Do U Make Members Only Web-site(7)
  2. Trainable Anti-spam Filter Script(3)
  3. Php Script To Download File From Another Site(9)
  4. Need Help With A PHP - MySQL Registration Script(13)
  5. What Would Make A Good Registration Script?(4)
  6. Installed A PR Checker Script - But Not Working Correctly(6)
  7. How To Delete File Using PHP Shell Script(3)
  8. Online Multiplayer Chess Script(2)
  9. Automated File Structure Creation Script(3)
  10. Authentication Script(1)
  11. Login Script(5)
  12. Please Help (php Join Script)(5)
  13. Adding Security Enhancements To Php Programs(0)
  14. Automatic/remote Php Script Execution(9)
  15. Something Wrong With This Script?(9)
  1. Automated Product Suggestion Script(2)
  2. Run A Script When Expires A Session(6)
  3. Php Script Help(1)
  4. SQL Doesn't Connect In PHP Script(19)
  5. Warning: Mysql_result(): Supplied Argument Is Not A Valid Mysql Result Resource In ...(4)
  6. Password Recovery Script(6)
  7. Login Script(8)
  8. Free Forum Hosting Type Script Help!(2)
  9. Script Request(2)
  10. Writing And Testing My Own Login Script [solved](20)
  11. Make A Script Run Even If No User Is Online(6)
  12. Php Login Script(0)
  13. Myspacetv Download Php Script Help(6)


 



- Lo-Fi Version Time is now: 5th September 2008 - 10:58 AM