Jump to content

Ice IT Support

Moderators
  • Posts

    1,643
  • Joined

  • Last visited

  • Days Won

    38

Posts posted by Ice IT Support

  1. Nice work, congratulations! Perhaps labeling the file action icons in the file manager would help contribute to ease of use? Also when attempting to delete a directory, PHP gave me an error (sorry, I didn't save the error so I can't post it) and the directory was never deleted. Again, nice work!

  2. mikenyc's script with the database came up with multiple errors when I tried using the script. The repaired version is below:

    <?php
    // Connect to mySQL database
    $con = mysql_connect("localhost","username","password");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    
    mysql_select_db("your_database", $con);
    
    // Take username and pass from the form LOG IN FIELD
    $username = $_POST['username'];
    $password = $_POST['password'];
    
    // Check if the form hasn't been submitted
    if (!isset($_POST['submit'])) {
    
    // Display the form
    echo "<form method='post' action='login.php'>";
    echo "<p>Please authorize to view site.</p>";
    echo "Username: <input type='text' name='username'><br>";
    echo "Password: <input type='password' name='password'><br>";
    echo "<input type='submit' name='submit' value='login'>";
    echo "</form>";
    
    // Check if the form has been submitted
    }else{
    
    //Compare users from database
    $query = mysql_query("SELECT User, Password FROM Users WHERE Username = '$username' AND Password = '$password'"); 
    
    if (mysql_num_rows($query)){
    
    // If yes, start the session
    session_start();
    
    // Then create the session
    $_SESSION['username'] = $username;
    
    // Redirect to the site homepage
    header("location:index.php");
    
    // If not
    }else{
    
    // Die and show the error message
    die('Login details mismatched');
    
    // End of statement
    }
    
    // End of statement
    }
    
    ?>
    

  3. I don't think Johnny is the only cause. I just saw a very interesting scenario on the server monitor. At approx. 1:15AM PST Saturday the 23rd (of July), all elements were bright green with the exception of Helionet/Heliohost.org. (I would provide a screenshot, but I am using my iPhone and it does not have this feature). Something else must be causing Cody to be sluggish. Like I said before, the firewall might be disabled like it was with Stevie.

  4. *all passwords in this post have been replaced with a "*"

     

    I have been using a PHP script Byron gave me a while back (below) to password protect a directory. (original script @ http://byrondallas.heliohost.org/temp/password.txt)

    <?php
    session_start();
    // maximum number of seconds user can remain idle without having to re-login (use a value of zero for no timout):
    $max_session_time = 30;
    // type of alert to give on incorrect password. This can be a file name or email address:
    $alert = "";
    
    // acceptable passwords (there are no limit to the amount):
    $cmp_pass = Array();
    $cmp_pass[] = md5("*"); 
    $cmp_pass[] = md5("*");
    
    // maximum number of bad logins before user locked out (use a value of zero for no hammering protection):
    $max_attempts = 3;
    
    // end user definable variables
    
    // save session expiry time for later comparision
    $session_expires = $_SESSION['mpass_session_expires'];
    // have to do this otherwise max_attempts is actually one less than what you specify.
    $max_attempts++;
    if(!empty($_POST['mpass_pass']))
    {
    // store md5'ed password
    $_SESSION['mpass_pass'] = md5($_POST['mpass_pass']);
    }
    if(empty($_SESSION['mpass_attempts']))
    {
    $_SESSION['mpass_attempts'] = 0;
    }
    // if the session has expired, or the password is incorrect, show login page:
    if(($max_session_time>0 && !empty($session_expires) && mktime()>$session_expires) || empty($_SESSION['mpass_pass']) || !in_array($_SESSION['mpass_pass'],$cmp_pass))
    {
    if(!empty($alert) && !in_array($_SESSION['mpass_pass'],$cmp_pass))
    {
    // user has submitted incorrect password
    // generate alert:
    $_SESSION['mpass_attempts']++;
    $alert_str = $_SERVER['REMOTE_ADDR']." entered ".htmlspecialchars($_POST['mpass_pass'])." on page ".$_SERVER['PHP_SELF']." on ".date("l dS of F Y h:i:s A")."\r\n";
    if(stristr($alert,"@")!==false)
    {
    // email alert
    @mail($alert,"Bad Login on ".$_SERVER['PHP_SELF'],$alert_str,"From: ".$alert);
    }
    else
    {
    // textfile alert
    $handle = @fopen($alert,'a');
    if($handle)
    {
    fwrite($handle,$alert_str);
    fclose($handle);
    }
    }
    }
    // if hammering protection is enabled, lock user out if they've reached the maximum
    if($max_attempts>1 && $_SESSION['mpass_attempts']>=$max_attempts)
    {
    exit("Too many login failures.");
    }
    // clear session expiry time
    $_SESSION['mpass_session_expires'] = "";
    ?>
    <html>
    <head>
    <title>Enter Password</title>
    </head>
    <body>
    <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
    <h4>Password Protected</h4>
    <input type="password" name="mpass_pass">
    <input type="submit" value="login">
    </form>
    </body>
    </html>
    <?php
    // and exit
    exit();
    }
    // if they've got this far, they've entered the correct password:
    // reset attempts
    $_SESSION['mpass_attempts'] = 0;
    // update session expiry time
    $_SESSION['mpass_session_expires'] = mktime()+$max_session_time;
    ?>

    and on my index page I have a list of links.

    <ul>
    <?php
    if($_SESSION['mpass_pass'] = md5("*"))
    {
    echo "<li><a href='/Administrator'>Administrator Control Panel</a>";
    }
    ?>
    <li><a href="/Roundcube">Webmail access</a>
    <li><a href="staffsites.php">StaffSites</a>
    <li><a href="directory.php">Staff email directory</a>
    <li><a href="customer-selection.php">Payments and invoicing</a>
    </ul>

    I want to log in using password "*" and have the "Administrator Control Panel" link appear in the list and when I log in with any other password I don't want the "Administrator Control Panel" link appear. I tried using the code in bold, but the link appears regardless of what password I use. What do I need to do/what code do I need to use to fix this issue?

  5. Is there a way to lessen the effects of Johnny's outages on Cody even if they are on the same physical server?

    because the new server was set up as two virtual servers (Johnny & Cody), shouldn't there be a way to set a CPU usage limit per server? (i.e. if Johnny uses up his share of the CPU, Cody still has some to work with)
  6. Couldn't it be that when Johnny gets overload, Cody is affected to?

    That's what I originally thought, but because the new server was set up as two virtual servers (Johnny & Cody), shouldn't there be a way to set a CPU usage limit per server? (i.e. if Johnny uses up his share of the CPU, Cody still has some to work with)

    I've set up a new virtual server (Cody) on Charlie
  7. Hi,

    I have an iPod app that I use to access my cPanel and it connects using stevie.heliohost.org:2082. Do you know if the app login gets logged as a normal login/resets the suspension clock? Thanks!

     

    P.S. the app name is Control Panel v2.2 by OKD Limited (www.cpapp.com)

     

    I do not intend to sell or advertise this app nor am I affiliated with the app in any way

  8. Geoff: There is a limit, but if it was being reached then PHP would just die and return a 500 error instead of timing out.

    I often get a lot of 500 errors when trying to load my PHP pages (approx. 8-10PM PST). Then I have to wait a few minutes before refreshing the page or it gives me the error again. So some limit must be being reached. But the server load has been weird. Before the power failure, Stevie's server load usually stayed around 2-3 or would jump up to 14+. Now it usually hangs around 6.

×
×
  • Create New...