The MySQLi extension, or as it is sometimes known, the MySQL Improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The MySQLi extension is included with PHP versions 5 and later.
4
votes
1answer
44 views
Database connection wrapper class
I am trying to create a PHP / MySQLi wrapper class that uses prepared statements, the goal of the class is to create a connection to the Database, then INSERT / ...
0
votes
0answers
17 views
Skip sending for all that return no results but still send to others [closed]
PHP below checks person's preferences in the database then pulls relevant jobs that match their preferences from another database table. It then compiles it into an email...
I can't get it to stop ...
2
votes
1answer
57 views
Secured Database Insert
I've been working on a safe inserting method for a while, and I think I've found a pretty secure way to do this. Would you CRitters mind taking a look at it and maybe give me some tips to improve my ...
5
votes
1answer
122 views
Website user password verification
I have a login web page where a user enters their email and password and I need to check if:
the entered email exists in the DB and
the entered password matches the hashed one from the db.
The ...
8
votes
1answer
62 views
Basic registration page and database insertion
Please review my registration code and suggest what changes I should make to improve security. I'm new to PHP and this is my first project.
Also I have no Idea how to make a "forget password page" as ...
4
votes
3answers
196 views
Preparing and executing MySQL SELECT query from parameters
I am trying to make a function for Select statements. It will give result based from the parameters passed. I tried using it and it gives the results I am expecting.
I know that it is still ...
5
votes
1answer
68 views
MySQLi library for handling MySQLi interactions
I wrote this class recently to better structure and handle MySQLi related interactions with PHP and would love to get some feedback.
...
4
votes
2answers
74 views
Dropdown form that shows data from 2 different tables
I am very new to this and am using php and MySQLi to create a form which will create a record in a third table. This works fine but I can't help but think that there is a way to do it with a single ...
2
votes
1answer
44 views
Placing navigation items into an array
I am looking for better ways to write this code. At the moment it grabs a list of all navigation items and places them into an array (using PDO).
However, as you can see, it is using two ...
4
votes
2answers
69 views
Shopping cart login and coupon code validation
I am figuring out how I could make the following query more secure:
I have already used mysqli_real_escape_string but I doubt that adds much to security.
I have ...
3
votes
2answers
63 views
Single MySQLI query to check for admin privileges
I have this script on top of all pages to check if user is admin otherwise we kick him. The problem is that I don't know if I am using double resources with a double query and results. Can I make this ...
2
votes
3answers
207 views
A very secure procedural MySQLI login script against injections
I know there are other ways to create a login script like Object Oriented, Prepared Statements and PDO, but how about those old MySQL PHP users like me trying to change from old style to the new ways? ...
8
votes
3answers
286 views
A PHP User System
This PHP User System was built with MySQLi and I also used Composer. I'm planning to improve this, and add more stuff and release it as a sort of a module for Composer.
User.php (Controller File in ...
6
votes
4answers
354 views
Create a 2D array from SQL table
I am a beginner to PHP programming. I wanted to make a 2D array that would store the values of a table into the array. Below is the Frankenstein code I created (every time I wanted to achieve a task ...
7
votes
3answers
838 views
A Simple, One-Page PHP Admin Login (with prepared SQL statements)
First off, I want mention that this code works well. This is more of a request for suggestions...
We're attempting to program a one-page, recursive, token-based admin shell that is safe from ...
1
vote
1answer
29 views
PHP form to database fit for purpose
This code is intended to take input from a form and append it to a database table. The same data is sent to a separate function for subsequent mailing to the respondent. I'm self-taught and it works ...
-1
votes
2answers
61 views
MySQL query in nested loop to get scores and averages for students
I am trying to get the scores and average for all assignments for records in a MYSQL database. The code below works but seems to take quite a bit of time to run because of the nested while loop. Any ...
0
votes
1answer
78 views
Combine Mysql limit query
Is it possible to combine these queries into one query? I am trying to see and average all scores but also count and average just the last three based on the same grouping.
This is the main query:
...
7
votes
2answers
732 views
Preventing SQL injection by converting all characters to their ASCII values
Scenario
In order to prevent SQL injection, I'm converting every character of a string to be inserted in the database into its ASCII value before performing the query; in order to read the value of ...
3
votes
1answer
93 views
A User class for visitors to register and log in to a site
I'm just looking for some feedback on my User class. The class is designed to handle users being able to register, login, and logout of the site. I'll be using it in conjunction with a forum I'm also ...
0
votes
1answer
62 views
API POST to save a new item in a Database via PHP & MYSQLI
Is this correct MYSQLI implementation?
IS it safe from injection?
IS the object cleanup done properly?
...
2
votes
0answers
38 views
Custom 503 page for MySQLi connection error
I redirect all my requests to index.php via htaccess and the code below is in my index.php.
I want to ask if my code is properly set for a custom 503 page for an unsuccessful MySQLi connection trial.
...
3
votes
0answers
199 views
Web service for Android clients to store images
I wrote this code for Android server interaction. The way I built the client was an onSharePreference of strings includes photo encoded to a base64 ...
5
votes
2answers
2k views
Prepared Statements / MySQLi / PHP Registration/Login Form
I'm just looking for some feedback here. I'm fairly new to MySQLi & PHP, but I've been working at it for a bit now, and reading up on how to make secure login forms, avoid SQL injection etc. I'm a ...
3
votes
2answers
175 views
Programming MySQLi prepared statements
I'm programming code with MySQLi prepared statements. I'm a beginner and just want to ask to experts if my code is correct.
...
4
votes
2answers
2k views
Simple PHP Login Register Script with OOP
I am relatively new to programming and OOP in PHP. I tried to create a Simple Login Register Script using my basic knowledge of OOP. I'm sure my code can be better in a lot of way. I'm trying to code ...
3
votes
1answer
94 views
Inserting data into database
I started learning PHP and MySQL, was using MySQL_ functions. Then I learned they are deprecated, had to choose between PDO and MySQL. I chose MySQL and started using it.
As I learn OOP PHP, I ...
5
votes
1answer
155 views
Security of login and register system
I need some help with my register and log in functions. I'm not sure if I have understood bcrypt correctly either. I'm doubting the security of it, what do you ...
0
votes
2answers
98 views
3
votes
1answer
86 views
Calling a MySQL procedure with an arbitrary parameter on a GoDaddy website
I'm deploying a PHP project, and I always try to use prepared statements, but unfortunately, GoDaddy does not have the mod mysqlnd which I use it for the function ...
2
votes
1answer
158 views
Script for a multi-user webapp database connection
I have the following working script which I use for my database connection for a multi-user webapp. I use a different database for the login, this script is called only after the user is successfully ...
1
vote
1answer
159 views
Database update script
Previous question:
Database input script
I'd like this new question reviewed.
...
3
votes
1answer
97 views
3
votes
1answer
203 views
Secure INSERTs with Mysqli
Is this code well protected, and if not, could you tell me how it might be exploited and how to secure it? I'm using mysqli.
...
4
votes
1answer
168 views
PHP MySQL Database class
This is a PHP database class. Yes, I know it's using the MySQL functions, which are deprecated, but I shall be updating it to MySQLi soon. Can you please review this code and give any comment on any ...
5
votes
2answers
394 views
Custom MySQLI Class
I have created this MySQLI Class. I wanted to know if this class is secure enough to be used on the production websites or more improvements can be done to this class.
...
4
votes
1answer
139 views
More maintainable API for wysihtml5 widget
For an HTML calendar with jQuery, I put in event listeners to enable jQuery drag-and-drop that reads and writes to persistence using HTTP get and post with JSON structures.
Now I'd like to make the ...
2
votes
1answer
90 views
Class to get user information
I've just begun creating a class to get User information, and I'd like for it to be improved.
The global variable $oConni is the database connection.
...
3
votes
2answers
306 views
PHP framework building: MySQL Connection and query class
I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
-1
votes
1answer
241 views
Correct functions for cleaning and inserting data into database [closed]
Initializing variables:
...
3
votes
1answer
383 views
PHP MySQLi database wrapper
I am developing a mysqli database wrapper. I've made an effort to make this as fast as possible and easy to use.
However, now I want to start adding callbacks (for ...
5
votes
2answers
102 views
Average of averages
I need to get the average of multiple averages calculated basing on data contained on a sql database.
To do that, I'm using this code:
...
5
votes
1answer
377 views
Doing a roll back with multiple MySQLI prepared statement
This is my code for doing a roll back with multiple MySQLI prepared statement.
I want to know if anything is wrong with the code.
...
1
vote
2answers
105 views
Does this code avoid SQL injection?
I have the following PHP code but I'm unsure, based on the many things I've read, whether or not this is actually safe from an SQL injection attack.
...
5
votes
2answers
535 views
Database Handler Class
I've written this DB Handler class. Please review it and suggest any code edits or point out mistakes and security loop holes. Please also suggest a better way to handle things, if there is a security ...
2
votes
3answers
390 views
Check if URL contains different strings
The code it self is pretty self explanatory, however i do not think it is very efficient at all. Is there a better way to do this?
Its basically so i can track spam sites and save the sites into my ...
4
votes
2answers
661 views
PHP and MySQLi login script - is it secure / am I doing something wrong?
Below is the code for my login page. I haven't really used MySQL (especially OOP) before, so I'd like to know if I'm doing something inherently wrong. The code is working as expected, but I don't ...
8
votes
4answers
5k views
PHP OOP Login Class
This is a login class I made for my personal website.
What I don't care about, is how secure this login class is, because I know it's not. But it keeps out the rare unwanted guests because I do not ...
7
votes
3answers
1k views
MySQL update with PHP; MySQLi prepared statement in loop
I'm going to develop an Android application that performs simple MySQL operations by invoking server-sided PHP scripts. PHP-MySQL communication is done by MySQLi extension. Each operation that I'd ...
10
votes
2answers
630 views
SQL injection safety check
I was wondering if my code is safe for sql injection.
This code just checks if the username exists in my db or not.
...