PHP echo $ip; won't work?

Berk

berkibap#4233
Developer
Oct 17, 2015
863
190
When you are saying it's Habbo related in your own thread, then post it in the right section.
Hey,
this is abit habshit related,sorry if posted in wrong section.

So before, the housekeeping was working well, then we've changed our tLD which is fucked up the housekeeping.

On footer, there is something like :
Your IP () is being logged for security reasons
between ()'s ,your ip should be there.
Either post login wasn't working. when i post and print_r($_POST); , it shows what i've posted but it doesn't auth me. It was working well before i said.

So the index.php
PHP:
<?php

    require_once("global.php");

    if(isset($_POST['login']))
    {
        $user_name    = $_POST['username'];
        $password    = md5($_POST['password']);
       
        if($user_name !== NULL && $password !== NULL)
        {
            if($auth->authenticate($user_name,$password))
            {
                header("Location: index.php");
            }
                else
            {
                $login_failed = true;
            }
        }
            else
        {
            $login_failed = true;
        }
    }

    if(isset($_GET['logout'])) {
        mysql_query("DELETE FROM `cms_sessions` WHERE `session_id` = '".$_SESSION['hk_session']."'");
        unset($_SESSION['hk_user']);
        unset($_SESSION['hk_session']);
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php echo SITE_NAME; ?>: Housekeeping</title>
    <!-- CSS -->
        <link rel="stylesheet" href="images/stylesheets/bootstrap.css?<?php echo cacheGenerator(); ?>">
        <link rel="stylesheet" href="images/stylesheets/whmcs.css?<?php echo cacheGenerator(); ?>">
    <!-- JS -->
        <script type="text/javascript" src="images/javascripts/jquery.js?<?php echo cacheGenerator(); ?>"></script>
        <script type="text/javascript" src="images/javascripts/whmcs.js?<?php echo cacheGenerator(); ?>"></script>
        <script type="text/javascript" src="images/ckeditor/ckeditor.js?<?php echo cacheGenerator(); ?>"></script>
        <script type="text/javascript" src="images/javascripts/global_jsfunctions.js?<?php echo cacheGenerator(); ?>"></script>
        <script type="text/javascript" src="images/javascripts/global_javascript.js?<?php echo cacheGenerator(); ?>"></script>
    <!-- END -->
</head>
<body>
    <div id="whmcsheader">
        <div class="whmcscontainer">
            <div id="whmcstxtlogo"><a href="index.php"><?php echo SITE_NAME; ?></a></div>
            <div id="whmcsimglogo"><img src="logo.png" alt="<?php echo SITE_NAME; ?>" /></div>
        </div>
    </div>
    <?php
        if(isset($_SESSION['hk_user']) && isset($_SESSION['hk_session']))
        {
    ?>
    <div class="topbar">
        <div class="fill">
            <div class="whmcscontainer">
                <ul>
                    <li><a href="index.php">Home</a></li>
                </ul>
                <?php
                    $getNavigation    = mysql_query("SELECT * FROM `housekeeping_panel_catagories` WHERE `enabled` = '1'");
                    if(mysql_num_rows($getNavigation) == 0)
                    {
                        echo("<ul><li class='menu'><a href='#' menu='menu'></a></li></ul>");
                    }
                        else
                    {
                        while($navi = mysql_fetch_array($getNavigation))
                        {
                            $title         = $navi['title'];
                            $naviperm    = $navi['permission'];
                            $naviid        = $navi['id'];
                            if($auth->permission($naviperm))
                            {
                                echo("<ul><li class='menu'><a href='#' class='menu'>".$title."</a><ul class='menu-dropdown'>");
                                $getPages    = mysql_query("SELECT * FROM `housekeeping_panel_pages` WHERE `cat_id` = '".$naviid."'");
                                if(mysql_num_rows($getPages) == 0)
                                {
                                    echo("<li><a href='#'></a></li>");
                                }
                                    else
                                {
                                    while($page = mysql_fetch_array($getPages))
                                    {
                                        $pagename    = $page['title'];
                                        $pagelink    = $page['page'];
                                        $pageperm    = $page['permission'];
                                        if($auth->permission($pageperm))
                                        {
                                            echo("<li><a href='".$pagelink."'>".$pagename."</a></li>");
                                        }
                                    }
                                }
                                echo("</ul></li></ul>");
                        }
                    }
                }
                ?>
                  <ul class="nav secondary-nav">
                    <li class="menu">
                          <a href="#" class="menu"><?php echo $_LANG['global']['hello']; ?>, <?php echo $_SESSION['hk_user']; ?>!</a>
                          <ul class="menu-dropdown">
                            <li><a href="?logout">Logout</a></li>
                            <li><a href="http://habrock.pw">Return to <?php echo SITE_NAME; ?></a></li>
                          </ul>
                    </li>
                  </ul>
            </div>
          </div>
        </div>
        <?php
        }
        ?>
        <div class="whmcscontainer">
            <div class="contentpadded">
                <?php
                    if(!isset($_SESSION['hk_user']) || !isset($_SESSION['hk_session']))
                    {
                ?>
                <div class="halfwidthcontainer">
                    <div class="page-header">
                        <div class="styled_title"><h1>Housekeeping Login</h1></div>
                    </div>
                    <form method="post" class="form-stacked" name="login">
                        <?php print ($login_error == true) ? "failed" : ''; ?>
                        <div class="logincontainer">
                            <fieldset>
                                <div class="clearfix">
                                    <label for="username"><?php echo $_LANG['global']['user_name']; ?>:</label>
                                    <div class="input">
                                        <input class="xlarge" name="username" id="login-username" type="text" />
                                    </div>
                                </div>
                                <div class="clearfix">
                                    <label for="password"><?php echo $_LANG['global']['password']; ?>:</label>
                                    <div class="input">
                                        <input class="xlarge" name="password" id="login-password" type="password" />
                                    </div>
                                </div>
                                <div class="clearfix">
                                    <label for="pin">Staff Pin:</label>
                                    <div class="input">
                                        <input class="xlarge" name="pin" id="login-pin" type="password" />
                                    </div>
                                </div>
                                <center><input type='submit' name='login' class='btn primary' value='<?php echo $_LANG['global']['login']; ?>'></center>
                            </fieldset>
                        </form>
                    </div>
                    <center><img src="images/images/padlock.png">&nbsp;&nbsp;<?php echo $_LANG['global']['being_logged']; ?></center>
                    <div class="halfwidthcontainer">
                        <?php
                        }
                            else
                        {
                            /***
                            print "<pre>";
                            print "<b>Array(get)</b><br />";
                            print_r($_GET);
                            print "<b>Array(post)</b><br />";
                            print_r($_POST);
                            print "</pre>";
                            ***/

                            if(isset($_GET['do']))
                            {
                                $system    = $_GET['do'];
                                $page    = $_GET['page'];
                                if(file_exists('application/pages/'.$system.'/'.$page.'.php'))
                                {
                                    include('application/pages/'.$system.'/'.$page.'.php');
                                }
                                    else
                                {
                                    echo "not found";
                                    $nopage = 1;
                                }
                            }
                                else
                            {
                                $nopage    = 1;
                            }

                            if($nopage == 1)
                            {
                                echo("<div class='halfwidthcontainer'>");
                                include('application/pages/home.php');
                                echo("</div>");
                            }
                        }
                        ?>
                    </div>
                </div>
            </div>
        </div>
        <div class="footerdivider">
            <div class="fill"></div>
        </div>
        <div class="whmcscontainer">
            <div class="footer">
                <div id="copyright">&copy; <?php echo date("Y"); ?> <a href="https://jakeadams.pro">Jake Adams</a>&nbsp;&nbsp; All Rights Reserved.</div>
                <div class="clear"></div>
            </div>
        </div>
    </body>
</html>
auth class, authenticate function:
PHP:
public function authenticate($user_name,$password)
        {
            if($user_name == NULL || $password == NULL)
            {
                return false;
            }
                else
            {
                $user_name    = parent::filter($user_name);
                $password    = parent::password($password);
                $staff_pin = parent::filter($_POST['pin']);
                $find_user    = mysql_query("SELECT * FROM `users` WHERE `username` = '".$user_name."' AND `password` = '".$password."' AND `staff_pin` = '".$staff_pin."' LIMIT 1");
                if(mysql_num_rows($find_user) == 0)
                {
                    $this->log_Login($user_name,FALSE);
                    return false;
                }
                    else
                {
                    $user_name        = parent::user_Data($user_name,'username');
                    $rank_id        = parent::user_Data($user_name,'rank');
                    $allow_access    = mysql_query("SELECT * FROM `housekeeping_permissions` WHERE `rank_id` = '".$rank_id."' LIMIT 1");
                    $allow_access    = mysql_fetch_array($allow_access);
                    if($allow_access['hk.login'] == 1)
                    {
                        $this->log_Login($user_name,TRUE);
                        if($this->create_Session($user_name))
                        {
                            return true;
                        }
                            else
                        {
                            return false;
                        }
                    }
                        else
                    {
                        $this->log_Login($user_name,FALSE);
                        return false;
                    }
                }
            }
        }
the log_login just inserts data to housekeeping_logs.
There is a housekeeping_permissions table and i've checked it, i'm ranked 9 and i have hk.login access.
I couldn't fix it anyhow!
By the way, i am using Revcms Heavy edit's cms and hk which is anthonyy is posted.
 
Last edited:

Users who are viewing this thread

Top