Announcement

Collapse
No announcement yet.

Login Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CeleronXT
    replied
    Originally posted by DirectPixel
    Okay, thanks for your help. I managed to fix it on my own.


    ...noticed that config.php wasn't even used in the script, so I just wrote my own MySQL connection routing.
    If this was for vB, you could've just included global.php and used $DB_site functions.

    Leave a comment:


  • Blazed
    replied
    i did everything that the script readme told me to do but i dont know what it means by this
    "If you would like a login box for different protected directories, you will need
    to upload another copy of phplogin.php to another directory, and make the appropriate
    changes to the $server variable."

    where do i get my $server variable not sure what to put inthere for that if anyone give me some insight that would be awsome thanks

    Leave a comment:


  • Zorg
    replied
    Cool. Glad I could help

    Leave a comment:


  • DirectPixel
    replied
    Okay, thanks for your help. I managed to fix it on my own.


    ...noticed that config.php wasn't even used in the script, so I just wrote my own MySQL connection routing.

    Leave a comment:


  • DirectPixel
    replied
    Okay, I think I have it almost figured out...

    On this line:
    PHP Code:
    $result mysql_query($sql); 
    the connection variable isn't included.

    Now, the new question is, how the heck do I get that from vB's config.php file?

    Leave a comment:


  • DirectPixel
    replied
    Yes, I have seen that, but I'm implementing the code right now, and everything seems fine, except that it won't log in the user for some reason.

    I have my username and password entered into the DB, and typed in right, but just won't work...weird.

    The error seems to be occurring on this line:
    PHP Code:
    if ($number mysql_num_rows($result) == 0) { 
    It says invalid MySQL resource.

    Leave a comment:


  • The Prohacker
    replied
    Have a look at:
    http://www.hotscripts.com/PHP/Script...uthentication/

    Leave a comment:


  • DirectPixel
    replied
    Okay, I'll try it out when I get a change.

    Leave a comment:


  • Zorg
    replied
    Try this

    Make this file login.php or whatever
    PHP Code:
    <?php
    include("config.php");

    session_start();
    if(!isset(
    $uid)) {
    ?>
    <html><head>
    <title>Boxx admin</title></head>
    <body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">
    <br><br><br>
    <table cellpadding="1" cellspacing="0" border="0" align="center" width="450" bgcolor="#7A99E9">
    <tr><td><table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr><td><font size='2'><b><font size="3" face="Arial" color="#000000">Please Log in:</font></b></font></td>
    </tr><tr>
    <td align="center" nowrap bgcolor="FFFFFF"> 
    <p><font face="Arial" size="2" color="#000000">You are either not a valid administrator or have not logged in.<br>
    </font>
    <form method="post" action="<?=$PHP_SELF?>">
    <table cellpadding="0" cellspacing="1" border="0">
    <tr><td><input type="text" name="uid"></td>
    <td><input type="password" name="pwd"></td>
    <td><input type="submit" value="Log in"></td>
    </tr><tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Username</font></td>
    <td colspan="2"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="#000000">Password</font></td>
    </tr></table>
    </form>
    </td></tr></table>
    </td></tr></table>
    <p align="center"><font size="1" face="Verdana"><b>bla bla Administrator Control Panel</b></font></p>
    </body></html>

    <?php
    exit;
    }
    session_register("uid");
    session_register("pwd");

    $sql "SELECT * FROM admin WHERE userid = '$uid' AND password = '$pwd'";
    $result mysql_query($sql);

    if (
    $number mysql_num_rows($result) == 0) {
    session_unregister("uid");
    session_unregister("pwd");
    ?>

    <br>
    <meta http-equiv ="Refresh" content = "0 ; URL=<?=$HTTP_REFERER?>">
    <?php
    exit;
    }
    $adminname mysql_result($result,0,"userid");
    $adminemail mysql_result($result,0,"email");
    $password mysql_result($result,0,"password");
    ?>
    On every page you want passwored, use

    inlcude("login.php");

    Database structure

    CREATE TABLE admin (
    aid int(11) NOT NULL auto_increment,
    userid varchar(100) NOT NULL default '',
    password varchar(16) NOT NULL default '',
    email varchar(100) NOT NULL default '',
    PRIMARY KEY (aid),
    UNIQUE KEY userid (userid)
    ) TYPE=MyISAM;

    INSERT INTO admin VALUES (1, 'admin', 'Admin', '[email protected]');

    Hope this works for you.

    Leave a comment:


  • DirectPixel
    started a topic Login Script

    Login Script

    Does anybody have any examples of a simple login script, where the user enters a username and password, and if correct, is brought to a "main" page?

    I'm trying to write a members area script, like at vbulletin.com/members.
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X