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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:37:37+00:00 2026-06-15T15:37:37+00:00

I have just finished writing my own php registration script from scratch and since

  • 0

I have just finished writing my own php registration script from scratch and since I am new to this I wanted to ask if the method I’m using is safe from sql injections?

This is an example how I exchange data with my sql database:

public function StoreUser($name, $email, $password, $devid) {

    $mysqli = new mysqli("host", "user", "pass", "data");
    if ($mysqli->connect_errno) {
        echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
    }

    $unique_id = uniqid('', true);
    $hash = $this->hashSSHA($password);

    $add_user = $mysqli->prepare("INSERT INTO `users` SET `unique_id`=?, `name`=?, `email`=?, `encrypted_password`=?, `salt`=?, `devid`=?, `created_at`=?");
    $add_user->bind_param("sssssss",$unique_id,$name,$email,$hash["encrypted"],$hash["salt"],$devid,date("H:i:s"));
    if ($add_user->execute()) {
        $add_user->close();
        $mysqli->close();
        return true;
    } 
    else {
        $add_user->close();
        $mysqli->close();
        return false;
    }

}
  • 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-15T15:37:38+00:00Added an answer on June 15, 2026 at 3:37 pm

    Using proper SQL placeholders is an important first step towards making your application secure. In this case you shouldn’t have to worry about any SQL injection bugs, the escaping should be done for you if you’re disciplined about using placeholders for any and all user-supplied data, but there could be other issues.

    Remember that just as you escape things for a SQL statement, you should likewise be diligent about escaping user-supplied data before displaying it as HTML or you could end up with all kinds of issues, the worst of which is XSS.

    In any case, PDO makes it a lot easier to do the escaping. mysqli is usually used only if PDO is not available.

    There is no singular magic bullet, but there are a number of things you can do to prevent your application from being abused, or just suffering embarrassing bugs. This can be difficult to do if you’re writing your own low-level database interfacing code instead of using a framework, though. You’ll spend a lot of time re-inventing the wheel.

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

Sidebar

Related Questions

I have just finished creating an API where the requests from the API are
I have just finished creating an entire login and register systsem in PHP, but
I have just written some code, which as i was writing i thought, this
I have just finished writing the core section of a project I am working
I have just finished writing my c# console application, and I am contemplating embedding
i have a question about sockets/clients.... I just finished writing a client server program
I'm new to python and just finished the django tutorial. I have a django
I just finished writing a small script to combine a lot of png pictures
I have just finished ridding my project of leaks, but there are still thousands
All, I have a basic Windows 7 Phone application and I have just finished

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.