Jump to content

need help with login


darkfreaks

Recommended Posts

hey guys my login has abit of javascript im not sure what it does but when you click the link to login it pops up a graphic login and i dont like it is there anyway i could get rid of it?

 

 

<?php
/*
File: Login.php
File Size: 6KB
Purpose:
To allow users to login or logout
*/
session_start();
require("inc/db.php");
require("class/security.php");
require("class/main.php");
$mn = new main;
$sec = new sec;

if (isset($_GET['logout'])){
    if ($_GET['logout'] == 1){
        if(isset($_SESSION['username'])){
            $name = $_SESSION['username'];
        }else{
            $name = "";
        }
        $query = "DELETE FROM `useronline` WHERE `username`='$name'";
        $results = mysql_query($query)or die('Query Failed: ' . mysql_error());
        session_destroy();
        unset($_SESSION['username']);
        unset($_SESSION['level']);
        unset($_SESSION['password']);
        unset($name);
    }
}

if(isset($_POST['adminlog'])){
    $user = $sec->prep(strtolower($_POST['name']));
    $pass = $sec->prep($_POST['pass']);
    $query = "SELECT * FROM `user_table` WHERE `user_name`='$user'";
    $resultss = mysql_query($query)or die('Query Failed: ' . mysql_error());
    $num_rows = mysql_num_rows($resultss);
    if($num_rows > 0){
        $row = mysql_fetch_array($resultss);
        $user2 = $row['user_name'];
        $pass2 = $row['user_pass'];
        if($user == $user2){
            if(md5($pass . $salt) == $pass2){
                $_SESSION['level'] = $row['user_level'];
                $_SESSION['username'] = $row['user_name'];
                $ttime = time();
                $ip = $_SERVER['REMOTE_ADDR'];
                $query = "UPDATE `user_table` SET `user_ip`='$ip',`last_login`='$ttime' WHERE `user_name`='$user'";
                $results = mysql_query($query)or die('Query Failed: ' . mysql_error());
                $query = "UPDATE`useronline` SET `username`='$user',`logged`='1' WHERE `ip`='$ip'";
                $results = mysql_query($query)or die('Query Failed: ' . mysql_error());
                echo "<script language=\"javascript\">
<!--

location.replace(\"index.php\");

-->
</script>";
            }else{
                echo "<script language=\"javascript\">
<!--

location.replace(\"index.php\");

-->
</script>";
            }
        }else{
            echo "<script language=\"javascript\">
<!--

location.replace(\"index.php\");

-->
</script>";
        }
    }else{
        echo "<script language=\"javascript\">
<!--

location.replace(\"index.php\");

-->
</script>";
    }
}

$session = $_SESSION['level'];
if(SITE_ON == 1 || SITE_ON == "1" || $session > 2){
    if (isset($_POST['login'])){
        $user = strtolower($_POST['user_name']);
        $query = "SELECT * FROM `activate` WHERE `name`='$user'";
        $resultss = mysql_query($query)or die('Query Failed: ' . mysql_error());
        $num_rows = mysql_num_rows($resultss);
        if ($num_rows == "0"){
            $pass = $_POST['user_password'];
            $opass = $pass;
            $pass = md5($pass . $salt);
            $query = "SELECT * FROM `user_table` WHERE `user_name`='$user'";
            $result = mysql_query($query)or die('a Query Failed: ' . mysql_error());
            $row = mysql_fetch_array($result);
            $premend = $row['premium_end'];
            $usnam = strtolower($row['user_name']);
            if ($row['user_pass'] == $pass && $usnam == $user){
                $_SESSION['level'] = $row['user_level'];
                if ($row['user_level'] == 2){
                    $date = date("mdY");
                    if ($date >= $premend){
                        $query = "UPDATE `user_table` SET `premium_end`='', `premium_on`='0', `user_level`='1' WHERE`user_name`='$user'";
                        $result = mysql_query($query)or die('a Query Failed: ' . mysql_error());
                        $_SESSION['level'] == 1;
                    }
                }
                if ($_SESSION['level'] == "0"){
                    echo "<script language=\"javascript\">
<!--

location.replace(\"error.php?err=act_ban&mj=0\");

-->
</script>";
                    $_SESSION['level'] = "";
                    exit;
                }

                $_SESSION['username'] = $user;
                $_SESSION['password'] = $opass;
                $ttime = time();
                $ip = $_SERVER['REMOTE_ADDR'];
                $query = "UPDATE `user_table` SET `user_ip`='$ip',`last_login`='$ttime' WHERE `user_name`='$user'";
                $results = mysql_query($query)or die('Query Failed: ' . mysql_error());
                $query = "UPDATE`useronline` SET `username`='$user',`logged`='1' WHERE `ip`='$ip'";
                $results = mysql_query($query)or die('Query Failed: ' . mysql_error());

                echo "<script language=\"javascript\">
<!--

location.replace(\"index.php\");

-->
</script>";
            }else if ($row['user_pass'] !== $pass){
                header("Location: error.php?err=pass_wrng&mj=0");
            }else if ($row['user_name'] !== $user){
                header("Location: error.php?err=no_user&mj=0");
            }
        }else{
            header("Location: error.php?err=act_act&mj=0");
        }
    }

    if(isset($_GET['loggedin'])){
        $_GET['loggedin'] = $_GET['loggedin'];
    }else{
        $_GET['loggedin'] = "";
    }
    if ($_GET['loggedin'] !== 1 && $_SESSION['username'] == ""){
        $mn->header($hdd, $sess_name);
        if ($_GET['logout'] == 1){
            echo "<h3>You have successfully logged out,  You may login again below</h3>";
        }else if ($_GET['logout'] == 2){
            echo "<h3>You have successfully registered,  please check your email to verify your account.</h3>";
        }
        echo "
  <form name=\"login_form\" action=\"login.php?logout=0\" method=\"post\">
  <table align=\"center\" border=\"2\" cellpadding=\"0\" cellspacing=\"0\" width=\"150\">";
        echo "<tbody><tr><td><center><font color=\"white\"><b>Site Login</b></font></center>";
        echo "</td></tr><tr align=\"center\" bgcolor=\"#bb55dd\">";
        echo "<td><font color=\"black\">";
        echo "<b>Username</b><br />";
        echo "<input name=\"user_name\" size=\"12\" maxlength=\"30\" type=\"text\">";
        echo "<br /><b>Password</b><br />";
        echo "<input name=\"user_password\" size=\"12\" maxlength=\"30\" type=\"password\">";
        echo "<br /><input name=\"login\" value=\"Login\" type=\"submit\">";
        echo "<br /></font></td></tr><tr align=\"center\">";
        echo "<td><a href=\"register.php\"><b>New Users Sign Up</b></a><br />";
        echo "</td></tr><tr></tr></tbody></table></form>";
        echo "<hr><b>If you are having troubles staying logged in</b>:<br />";
        echo "Try deleting your cookies and then making sure that cookies are enabled.<br />";
        echo "If that still does not work and you are using internet explorer, we recommend using";
        echo "<a href=\"http://mozilla.org/\">Firefox</a>.  It is much better than internet explorer and we've never";
        echo "had any problems with it.  <a href=\"http://mozilla.org/\">Download Firefox Here</a>";
        echo "<br />If you continue to have problems logging in after following these instructions, please contact us";
        echo "<a href=\"bug_report.php\">here</a><br />";
        echo "If you lost your password, enter your email address in the form below.<hr>";
        echo "<b>Lost Password?</b><br />";
        echo "<form name=\"lost_password\" action=\"forgot.php\" method=\"post\">";
        echo "Enter email address:<input name=\"user_email\" size=\"50\" maxlength=\"70\" type=\"text\">";
        echo "<br \><input name=\"submit\" value=\"submit\" type=\"submit\"></form>";
        echo "<p></p>";
        $mn->footer();
    }else if ($_GET['loggedin'] == 1 && $_SESSION['username'] !== ""){
        $mn->header($hdd, $sess_name);
        $mn->lb(3);
        echo "<div id=\"loggedin\">";
        echo "You are now logged in as " . $_SESSION['username'] . "<br /><br />";
        echo "<a href=\"user.php?user=" . $_SESSION['username'] . "\">View Profile</a><br />";
        echo "<a href=\"edituser.php\">Edit Profile</a><br />";
        echo "<a href=\"inbox.php\">View Inbox</a><br />";
        echo "</div>";
        $mn->footer();
    }
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.