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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:55:22+00:00 2026-06-04T04:55:22+00:00

This is similar to a question I asked a while ago, however this didn’t

  • 0

This is similar to a question I asked a while ago, however this didn’t seem to attract any answers so I’ll try again.

I have a booking system which you log into, and your username is stored in a cookie named $_COOKIE['ID_my_site']. I have a script which runs after a user has booked their flight which stores all the details into a table (named OABS_customers), which works fine, however the one row which doesn’t work is the username row, which adds $_COOKIE['ID_my_site'] into the row.

The table’s structure is the following:

Name         Type(Length)    Null     Default

name         varchar(60)     No       noname
address1     varchar(60)     No       noaddress
address2     varchar(60)     No       noaddress2
county       varchar(60)     No       nocounty
postcode     varchar(32)     No       nopostcode
customer     tinyint(4)      No       
seats        varchar(11)     No       0
number       tinyint(4)      No       0
class        varchar(11)     No       noclass
username     varchar(60)     No       nousername

So like I said, everything works fine but the username column, which just comes up with the default value of nousername. This is the code I am using;

$query = "INSERT INTO OABS_customers (username) VALUES ('$user')";

where $user = $_COOKIE['ID_my_site'] (defined before the above script).

If anyone could help out with this issue I would greatly appreciate it.

  • 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-04T04:55:24+00:00Added an answer on June 4, 2026 at 4:55 am

    Never put unescaped, user generated strings into SQL queries. The cookies could be altered by some evil user and this leads to an SQL injection. Use mysql_real_escape_string($user) to escape the string.

    Make sure that $_COOKIE['ID_my_site'] is not empty

    mysql_query("INSERT INTO OABS_customers (username) VALUES ('". mysql_real_escape_string($user) ."')");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I know I asked a similar question a while ago, but this
This is similar to a question that has already been asked. However, I am
I asked a similar question here a while back but all the answers were
I know I asked a similar question to this not long ago, but I'm
While this question asked something similar too, I'm interested in this from another angle.
I previously asked a similar question on this topic a while back and got
A while ago I asked this question: using xslt stylesheet to convert xhtml blank
Asked a similar question a while ago and tried to build off of my
I have asked a similar question before and while the answers I got were
Similar to what I asked in this question a while back about getting the

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.