Results 1 to 3 of 3

Thread: Password To Enter site and remain on site script

  1. #1
    Join Date
    Feb 2006
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Password To Enter site and remain on site script

    Ok I am just wondering how hard would this be to do.

    Here's what I am looking to do. I set up a webpage for a friend who has an online resume. You go to www.example.com and it would go right to her page.

    Obviously anyone could see the resume. What I wanted to do was assign a single password to the page www.example.com lands at. It would be the same password given to everyone. No need to create users or passwords. Then that user woud enter the password and be able to view any of the pages on that site.

    I thought about doing it with javascript cookie. The cookie could check against the password entered and give a session cookie. Each page in the resume would check that the session cookie was valid, if so then let that person view that page on the website.

    Now of course the drawback is the password is on the source code with javascript.

    I was told to use PHP, but I am unfamiliar with PHP, the only time I've used it was to email a form someone fills out to me.

    I was going to go check out some books on PHP but would what I am looking to do be very complicated? So before I start looking around how hard would this be to do from scratch.

    I don't want to spend weeks working on something that I would need to take a regular course on. I have enough trouble getting my cookies to work right )

    Thanks

  2. #2
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It wouldn't be hard at all, actually. Declare a variable called $password or whatever you want to call it. Draw up an html form that asks for the password. (Use method=post in the html form.) The user's input will become a variable with whatever name you gave it in the html form. So if you called it something like "user_input", then do an if() construct kind of like in javascript:
    Code:
    if ($_POST["user_input"] == $password) { 
         echo("my dear friend's resume"); 
    } else {
         do something else;
    }
    That's the simple version, because it looks like you really want to look this up for yourself. But yeah, to answer your question, it's pretty straight forward.

  3. #3
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You can consider this script

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •