Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7963203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:33:38+00:00 2026-06-04T05:33:38+00:00

I have the following log in script that is run when a user hits

  • 0

I have the following log in script that is run when a user hits the submit button on the login form on http://www.msheeksproductions.com. I have removed the DB login info for security reasons.

    <?php
error_reporting(E_ALL);
        $user = '***************';
        $pass = '***************';
        $host = '***************';
        $data = '***************';
$userN=$_POST['userN'];
$passW=$_POST['passW'];

mysql_connect($host, $user, $pass)or die("Could not connect");
mysql_select_db($data)or die("Database Not Found");

$query="SELECT userID FROM sec_login WHERE Username='$userN' AND Password='passW'";
$result=mysql_query($query) or die(mysql_error());

$user=mysql_num_rows($result);
if($user==1) {
    session_register("userN");
    header("location: ../index.php");
}
else {
echo("You have entered invalid login information.");
}
}
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

My issue is, if you land on the security.php page, nothing happens. The PHP script doesn’t seem to be being executed at all. I’m not sure if I have a syntax error somewhere, or if it’s a configuration issue with my hosting account. The server is using PHP 5.2. Does anyone know if there are known issues with Bluehost for these sorts of things? If there’s a coding error, then obviously I would love to know as well. I’m new to this, so I may not have done everything right.

Also, I am attempting to call the variable again in the index.php file, which seems to not return any data.

<?php $usr=$_SESSION['username']; 
echo "User Name Is: $usr"; ?>

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T05:33:39+00:00Added an answer on June 4, 2026 at 5:33 am

    Please consider the following:

    • Beware of SQL injection(Stopped by mysql_real_escape_string);
    • Beware of session fixation / hijacking;
    • Beware or brute force attacks;
    • Please check http://php.net/pdo for better error handling and query parameters….

      <?php
      error_reporting(E_ALL);
      ini_set('display_errors', 1);
      
      if ($_SERVER['REQUEST_METHOD'] == 'POST') {
          $user = '***************';
          $pass = '***************';
          $host = '***************';
          $data = '***************';
      
          mysql_connect($host, $user, $pass) or die("Could not connect");
          mysql_select_db($data) or die("Database Not Found");
      
          $result=mysql_query("SELECT COUNT(1) FROM sec_login WHERE Username='".mysql_real_escape_string($_POST['username'])."' AND Password='".mysql_real_escape_string($_POST['password'])."'") or die(mysql_error());
      
          if(mysql_result($result) == 1) {
              $_SESSION['username'] = $_POST['username'];
              header("location: ../index.php");
              exit;
          } else {
              $message = 'You have failed to provide valid credentials.';
          }
      } else {
          $message = '<form method="post">
                          <input type="text" name="username" value="username" />
                          <br />
                          <input type="password" name="password" value="password" />
                          <br />
                          <input type="submit" />
                      </form>';
      }
      ?>
      <!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">
          <head>
              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
              <title>Untitled Document</title>
          </head>
      
          <body>
              <?php echo $message; ?>
          </body>
      </html>
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following log entry that I am processing in PowerShell I'm trying
I have the following perl script that works locally given the input parameters. I
I have a script that will run on server daily to download data from
I wrote the following pre-commit script for SVN to validate that a user has
I have the following script that parses some | delimited field/value pairs. Sample data
I have a script, called test.py , that does the following: while (1): ....print
I have a bash script that checks some log files created by a cron
I did the following script in order to identify itunes songs that doesn't have
I'm using Jboss 7.1.1 and I have the following log definition: <subsystem xmlns=urn:jboss:domain:logging:1.1> <console-handler
I have the following code: Log.e(MainScreen, 1); ListAction listAction = new ListAction(this); Log.e(MainScreen, 2);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.