Results 1 to 9 of 9
  1. #1
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default [PHP] Help, links won't show.

    Hii
    I have this PHP code for my admin panel, but the links don't show up, any ideas?

    PHP Code:
    <?php
    require_once("includes/pass.php");
    require_once(
    "includes/phpfunct.php");
    echo 
    "<h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>";
    if(isset(
    $_SESSION['authuser']))
    {
        if(
    $_SESSION['authuser'] == $A_user)
        {
            if(
    $_SESSION['authpass'] == $A_pass)
            {
                echo 
    "<p><br /><a href=\"***\">File Editor for the /htdocs folder</a>";
                echo 
    "<br /><a href=\"***\">File Editor for the /htdocs/html folder</a>";
                echo 
    "<br /><a href=\"***\">File Editor Recursive mode</a>";
                echo 
    "<br />//TODO: Add some things to do other than logging out.";
                echo 
    "<br /><br /><a href='logout.php'>Logout</a></p>";
    exit();
            }
        }
    }
        echo 
    "<p>Please Login to the jcs.me.uk Control Panel<br />";
        echo 
    '<form name="login" action="login.php" method="post">';
        echo 
    'Username: ';
        echo 
    '<input type="text" name="user">';
        echo 
    '<br>';
        echo 
    'Password: ';
        echo 
    '<input type="password" name="pass"><br />';
        echo 
    '<input type="submit" value="Submit">';
        echo 
    '</form>';
        echo 
    '</p>';
    require_once(
    "includes/footer.php");
    ?>
    Thanks and +rep to help
    Luke

  2. #2
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    What have you used to define $A_User and $A_Pass and you're looking for the values by using ''

  3. #3
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    it sets them by

    $A_user=md5("pass");
    And the same for pass.

  4. #4
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Why don't you just define them like:
    PHP Code:
    $_SESSION['id'] = "$name[id]";
    $_SESSION['password'] = "$name[password]"
    Because I'm 100% sure thats where your problem is.

  5. #5
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    where would i put this, here's other two included files

    PHP Code:
    <?php
    session_start
    (); // start up your PHP session! 
    require_once("***********"); // Gets the User + Pass MD5ed

    function authreq()
    {
        echo 
    '<h1>Authorization Required</h1>';
        echo 
    '<p>This server could not verify that you are authorized to access the document requested.<br />';
        echo 
    'Either you supplied the wrong credentials (e.g., bad password), or your browser doe';
        echo 
    'sn\'t understand how to supply the credentials required. <br /> <br /> <a href="ind';
        echo 
    'ex.php">Back</a></p>';
    return 
    0;
    }
    ?>
    PHP Code:
    <?php
    function clean($string) {
    $string htmlspecialchars($string);
    $string stripslashes($string);
    $string mysql_escape_string($string);
    $string htmlentities($string);
    $string str_replace("\""""$string);
    $string str_replace(">"""$string);
    $string str_replace("<"""$string);
    return 
    $string;


    function 
    encrypt($string) {
    $string md5($string);
    $string base64_encode($string);
    ****
    ****
    ****  
    This chanes it and compleatly randomifies it
    ****
    ****
    $string base64_encode($string);
    return 
    $string;
    }
    function 
    random() {
    **
    // This is the random ifier
    return $string;
    }
    ?>
    i did get a lot of elp on this, an drad alot of tutorials, so i'm not THAT pro on php yet

  6. #6
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Oops, obviously. Right make the login file on a seperate page so you can let them login, should work.
    Last edited by Excellent; 04-09-2008 at 09:05 PM.

  7. #7
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    ok, i'll do that and report after.

    Alsso, the forum keeps going down for me :S, i haven't been able to get on for 20 mins after ur last reply :|

  8. #8
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    ok, i made it, but it still didn't work

    heres latest files:

    INDEX
    PHP Code:
    <h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>
    <p>Please Login to the jcs.me.uk Control Panel<br />
    <form name="login" action="login.php" method="post">
    Username: <input type="text" name="user">
    <br>
    Password: <input type="password" name="pass"><br />
    <input type="submit" value="Submit">
    </form>
    </p>
    <?php
    require_once("includes/footer.php");
    ?>
    Login.php
    PHP Code:
    <?php
    require_once("includes/phpfunct.php");
    require_once(
    "includes/pass.php");
    //if (!isset($_POST['user'])) {
    //    authreq();              //THIS WAS EDITED OUT COZ IT WAS PERMENENTLY SETTING THE AUTH REQ.
    //} else {
    $user clean($_POST['user']);
    $pass clean($_POST['pass']);
    $newuser md5($user);
    $newpass md5($pass);

    $user random();
    // THIS DESTROYS THE DATA... VERY WELL :D
    $pass encrypt($user);
        if(
    $newuser == $A_user && $newpass == $A_pass)
        {
            
            
    $_SESSION['authuser'] = md5($newuser);
            
    $_SESSION['authpass'] = md5($newpass);
            
    $_SESSION['authcheck'] = 1;            /// I do like sessions don't i.
            
    header('Location: index.php');
        } else { 
            
    authreq();
        }
    //}
    require_once("includes/footer.php");
    ?>
    Main
    PHP Code:
    <?php
    require_once("includes/pass.php");
    require_once(
    "includes/phpfunct.php");
    echo 
    "<h2>Welcome to jcs.me.uk Administrator Control Panel.</h2>";
    if(
    $_SESSION['authuser'] == $A_user && $_SESSION['authpass'] == $A_pass)
    {
        echo 
    "<p><br /><a href=\"fileed.php\">File Editor for the /htdocs folder</a>";
        echo 
    "<br /><a href=\"fileedhtml.php\">File Editor for the /htdocs/html folder</a>";
        echo 
    "<br /><a href=\"fileedmulti.php\">File Editor Recursive mode</a>";
        echo 
    "<br />//TODO: Add some things to do other than logging out.";
        echo 
    "<br /><br /><a href='logout.php'>Logout</a></p>";
    }

    require_once(
    "includes/footer.php");
    ?>

  9. #9
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    wow, i shouldn't tripple post but i desperatley need this fixed

    so anyone

Posting Permissions

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