• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Znote protected.php

Jfrye

Mapper, trying to learn scripting
Joined
Jan 8, 2009
Messages
365
Solutions
5
Reaction score
86
Location
Mexico Missouri
Latest Znote.

I had a windows failure, and sometime in the process, this file got messed up. I Have remade the file to suit my website looks, but I dont know how the file is supposed to be finished.

Code:
<?php
require_once 'engine/init.php';
// To direct users here, add: protect_page(); Here before loading header.
include 'layout/overall/header.php';

if (user_logged_in() === true) {
  
?>

<table width="100%" border="0" cellspacing="1" cellpadding="4">
    <tbody>
        <tr>
            <td bgcolor="#800000">
                <b><font color="eee8dc"><center>Action Required</font></b>
            </td>
        </tr>
        <tr>
            <td bgcolor="#eee8dc">
                <b><font color="black">You are not authorized to access this page.</font></b>
        </tr>
    </tbody>  
</table>



<?php
}
else if (!empty($_POST)) {
    if ($config['log_ip']) {
        znote_visitor_insert_detailed_data(5);
    }
    $username = $_POST['username'];
    $password = $_POST['password'];
    //data_dump($_POST, false, "POST");
    if (empty($username) || empty($password)) {
        $errors[] = 'You need to enter a username and password.';
    } else if (strlen($username) > 32 || strlen($password) > 64) {
            $errors[] = 'Username or password is too long.';
    } else if (user_exist($username) === false) {
        $errors[] = 'Failed to authorize your account, are the details correct, have you <a href=\'register.php\'>register</a>ed?';
    } /*else if (user_activated($username) === false) {
        $errors[] = 'You havent activated your account! Please check your email. <br>Note it may appear in your junk/spam box.';
    } */else if (!Token::isValid($_POST['token'])) {
        Token::debug($_POST['token']);
        $errors[] = 'Token is invalid.';
    } else {
      
        // Starting loging
        if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $login = user_login($username, $password);
        else if ($config['TFSVersion'] == 'TFS_03') $login = user_login_03($username, $password);
        else $login = false;
        if ($login === false) {
            $errors[] = 'Username and password combination is wrong.';
        } else {
            // Check if user have access to login
            $status = false;
            if ($config['mailserver']['register']) {
                $authenticate = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='$login' AND `active`='1' LIMIT 1;");
                if ($authenticate !== false) {
                    $status = true;
                } else {
                    $errors[] = "Your account is not activated. An email should have been sent to you when you registered. Please find it and click the activation link to activate your account.";
                }
            } else $status = true;
          
            if ($status) {
                setSession('user_id', $login);
          
                // if IP is not set (etc acc created before Znote AAC was in use)
                $znote_data = user_znote_account_data($login);
                if ($znote_data['ip'] == 0) {
                    $update_data = array(
                    'ip' => ip2long(getIP()),
                    );
                    user_update_znote_account($update_data);
                }
              
                // Send them to myaccount.php
                $redir = !empty($_GET['redir']) && $_GET['redir'] !== "" &&  $_GET['redir'] !== null  ? $_GET['redir'] : 'myaccount.php';
                header('Location: '. $redir);
                echo 'Location: '. $redir;
                exit();
            }
        }
    }
}
else{
?>


<table width="100%" border="0" cellspacing="1" cellpadding="4">
    <tbody>
        <tr>
            <td bgcolor="#800000">
                <b><font color="eee8dc" size="4"><center>Action Required</font></b>
            </td>
        </tr>
        <tr>
            <td bgcolor="#eee8dc">
                <font color="red" size="3"><center>You are <b>not</b> logged in.</font><font color="black" size="3"> Please login to continue.</font>
        </tr>
            <tr>
            <td bgcolor="#eee8dc">
                <font color="black" size="3"><center>If you do <b>not</b> have an account, you can Register </font><a href="register.php"><font size="3" color="blue">here.</font>
        </tr>


        <tr bgcolor="#eee8dc">
        <td>
        <form method="post">
        <table width="100%" border="0" cellspacing="1" cellpadding="4">
            <tbody>
                <tr>
                    <td>
                        <b><font color="black" size="3"><center>Account Name:</b>
                    </td>
                    <td>
                        <input type="password" size="35" maxlength="30" name="username" class="loginfield" placeholder=""/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b><font color="black" size="3"><center>Password:</b>
                    </td>
                    <td>
                        <input type="password" name="password" class="loginfield_pass" placeholder=""/>
                    </td>
                </tbody>
            </table>
            <table>
                <t
Well it didnt copy in the code, but in notepad ++ it just says NUL NUL NUL NUL, like 100 times. I beleive I had a submit button where the next table started, but even after that, Im not the greatest at php so I dont even know what else was below that table. IF ANYONE CAN HELP, that is greatly appreciated. My file looks way different than the protected.php found on znote github.
 
Back
Top