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 161113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:09:20+00:00 2026-05-11T11:09:20+00:00

Below is a page that handles a login script and I am wondering if

  • 0

Below is a page that handles a login script and I am wondering if I have put it any security holes. I have been reading articles on protecting from injections and others and wanted to make sure that my code is secure.

It is submitted via ajax and returns JSON based on the login being correct or not.

<?php ob_start(); session_start(); include ("config.inc.php"); include ("jsonEncode.php");  // ausername and apassword sent from form $ausername = ''; $apassword = ''; $ausername = mysql_real_escape_string(stripslashes($_GET['username'])); $apassword = mysql_real_escape_string(stripslashes($_GET['password']));  $sql    = "SELECT * FROM admin WHERE ausername='$ausername' AND apassword='$apassword' LIMIT 1"; $result = mysql_query($sql) or die(mysql_error());  $data   = mysql_fetch_array($result); $count  = mysql_num_rows($result);  if($count==1){     $_SESSION['ausername'] = $ausername;     $_SESSION['apassword'] = $apassword;     $_SESSION['admin_id']  = $data['a_id'];     $a_id = $data['a_id'];     $_SESSION['LastLogin'] = $data['last_login'];     $query = "UPDATE admin SET last_login = Now() WHERE `a_id`= $a_id";     mysql_query($query);     //echo $query;     $_SESSION['aloggedin'] = "1234";     // valid     $var = array('avalid' => 1, 'ausername' => $ausername, 'apassword' => $apassword);     print php_json_encode($var); }else{     // invalid     $var = array('avalid' => 0, 'ausername' => $ausername, 'apassword' => $apassword);     print php_json_encode($var); } ?> 
  • 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. 2026-05-11T11:09:20+00:00Added an answer on May 11, 2026 at 11:09 am

    You might want to use the POST method rather than GET with the login form, otherwise their password will appear in the URL and URLs aren’t very secure (they might get bookmarked or sent to another server as a referral URL, for example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page (below) that has a datagrid that lists item's returned from
I have to make a page that look like painting below, but: field 1
I have a html page that allows users to submit a file. Below is
I have this line below that shows a link to go the next page
in my application i have the playvideo page where video will play, below that
I have a page that is trying to login a user. at the top
i have strange issue of for login sucess and redirect to page. below is
I have the following script, but when i move to a page that don't
Below is a complete html page that shows the problem. The myDiv should be
I have a front controller that works. I wrote a login controller called AuthController.php.

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.