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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 69k
  • Answers 69k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer ORM World is powerfull and full featured one, I think… May 11, 2026 at 12:28 pm
  • added an answer int[] b = new int[3]; Array.Copy(a, 1, b, 0, 3);… May 11, 2026 at 12:28 pm
  • added an answer The property you are looking for is SiteMapNode.ParentNode SiteMapNode currentNode… May 11, 2026 at 12:28 pm

Related Questions

Below is a stored procedure to check if there is a duplicate entry in
I have a text file of URLs, about 14000. Below is a couple of
The loop below is callign a proc that does various 'things' If it should
I am creating a user login system similar to a client intranat. And when
I have a page that is trying to login a user. at the top
I have been learning how to create dynamic images and dynamic stylesheets using ASP.NET

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.