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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:24:29+00:00 2026-05-28T06:24:29+00:00

I have experiences with securing sql injections on MYSQL, but what should I be

  • 0

I have experiences with securing sql injections on MYSQL, but what should I be careful on MongoDB using php driver? In most of the pages I get data via GET/POST and searching/inserting the system. I search via UDID / other fields, and can insert any string value. Also I get user’s cookies via javascript.

  1. So when GET/POST, I’m adding to each variable htmlentities function?

  2. What would replace mysql_real_escape_string? Should I use it?

So, for example, when doing

$download = array( 'url' => $_GET['url'] );

$downloads->insert($download); 

Is this OK?

  1. Is there a way to check if a string is really a UID?

  2. Any think else I should be aware when using MongoDB and PHP? I do get my cookies using javascript, and searching in my DB using the cookies. What about that?

  • 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-05-28T06:24:30+00:00Added an answer on May 28, 2026 at 6:24 am

    So when GET/POST, I’m adding to each variable htmlentities function?

    No need to. You should however, use htmlentities when outputting user-generated data to a browser, to prevent XSS attacks.

    What would replace mysql_real_escape_string? Should I use it?

    You shouldn’t use mysql_real_escape_string as it’s for MySQL. Nothing replaces this on MongoDB, the driver takes care of escaping the data for you.

    Is there a way to check if a string is really a UID?

    The only way is to validate it is to query MongoDB with that string and check if it exists.

    You can however, validate if the format is correct:

    $id = '4f1b166d4931b15415000000';
    $a = new MongoId($id);
    var_dump($a->{'$id'} == $id); // true
    
    $id = 'foo';
    $a = new MongoId($id);
    var_dump($a->{'$id'} == $id); // false
    

    Any think else I should be aware when using MongoDB and PHP? I do get my cookies using javascript, and searching in my DB using the cookies. What about that?

    Not much. As for any web application, you are very discouraged from storing sensitive data in cookies, such as user identifiers, passwords, etc. as they can easily be tempered with and used to access parts of your application that should be restricted, or impersonate other users.

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

Sidebar

Related Questions

I have developed an application using php, mysql and xajax. I always used to
I have experiences with sencha chart which has touch faclity as iPad has.But Fusion
I'm creating a regular gallery in ASP.NET but I have little experiences with creation
Does anyone have any experiences from recent daily build of AnkhSVN? Please let me
I'm curious as to what type of experiences people have had with libgd. I
Have you guys had any experiences (positive or negative) by placing your source code/solution
I have a simple question and wish to hear others' experiences regarding which is
What good/bad experiences do you have with java jabber libraries?
I have an application that uses NHibernate as its ORM and sometimes it experiences
This question is for experiences programmers. Do you have a set process that you

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.