Placing a Password Box on a Web Page

Discussion in 'PHP' started by Jetheat, Jan 23, 2006.

  1. #1
    I don't know much php and that is why I'm asking the experts here for a solution.

    I wish to set up a password box on a web page.

    I will then advertise my website at various places and hand out different passwords depending on where I advertise.

    When a visitor arrives at my site, they will be asked for their password to enter the site.

    No.1 - How do I set up this password box?
    No.2 - How do I keep track of the number of visitors from a particular ad by use of their password?

    I know simple html and I can make a password box from Dreamweaver.
    I just don't know how to connect that box to do anything.

    I can make a MySQL Table in my cpanel.

    I don't know what fields to put in there.

    I don't know how to work with submitted form data either.

    I can make simple sql statements but I don't know any of them except "SELECT * from Table".


    At the same time, is there a better way of viewing my tracking results with a user friendly interface rather than logging into my cpanel MySQL Database?

    I don't know any php which makes this all the more difficult.

    Can anybody help,

    JH
     
    Jetheat, Jan 23, 2006 IP
  2. mitchandre

    mitchandre Peon

    Messages:
    313
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're in luck. I just did this recently.
    
    <?php
    If ($_POST['pass'] == 4711)	{
    echo '<br>
    <IFRAME SRC="http://mitch.chemicalforums.com/pass4711.php" WIDTH=1600 HEIGHT=1600 frameborder=0 framespacing=0 border=0></iframe>';
    }?>
    <?php
    If ($_POST['pass'] == 1234)	{
    echo '<br>
    <IFRAME SRC="http://mitch.chemicalforums.com/pass1234.php" WIDTH=1600 HEIGHT=1600 frameborder=0 framespacing=0 border=0></iframe>';
    }?>
    <form action="pass.php" method="post">
    Password: <input type="password" name="pass"><br>
    <p><input type="submit" /></p>
    </form>
    
    PHP:
    The 4711, 1234, just represent different passwords that the user puts in and it open that associate page in an iframe of the same page. There are much more elegant ways to do what you are asking, but I had this lying around and it'll do the trick until you learn php better.

    The page you do this on has to be called pass.php for this instance and you will also need to create an associated page called pass1234.php and pass4711.php . Or you can edit the above code appropriately.
     
    mitchandre, Jan 23, 2006 IP
  3. Jetheat

    Jetheat Well-Known Member

    Messages:
    260
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Thanks for that but how do I add the login attempt and information into a MySQL DB?

    JH
     
    Jetheat, Jan 23, 2006 IP
  4. mitchandre

    mitchandre Peon

    Messages:
    313
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #4
    First, I'm not a MySQL guy. But, I would just put webcounters on those pages to track that info for you.
     
    mitchandre, Jan 24, 2006 IP
  5. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5
    dave487, Jan 24, 2006 IP