Tagged Questions
1
vote
2answers
30 views
MySQLi Code Review for methods and functions used
I made my first script of MySQLi. I have just learnt it from 3rd party website. So, I am not sure i am using functions which are not deprecated or outdated. I should start to practice good scripts to ...
2
votes
1answer
81 views
Could really use some feedback on this registration code in php
I was hoping someone could give me some feedback on my code. I am still new to php and I'm sure I have messed up somewhere. The code pasted is for a registration page where users will submit their ...
0
votes
1answer
47 views
Is declaring a property as `public` insecure?
I posted a question few weeks back, on making a PHP Login Script. Most of you guys told me not to use global variables and especially for something like MySQLi connection object as it may be insecure. ...
1
vote
2answers
84 views
Improve Speed of RPI Calculation
It currently takes about 10 minutes to process ~16k teams and ~81k games. I could soon have ~17k teams with ~160k, and multiple sports. I run this as a cron job overnight and store the results in a ...
1
vote
2answers
70 views
Prepared Statements Function
Hello, CR :)
I've finally finished my universal query preparation function. Sorry about my previous post, I wasn't aware of the rules before.
Anyway, here is a working function. Any suggestions to ...
0
votes
1answer
45 views
(Procedural)(Snippet) MySQL to MySQLi. Any advice?
This is what i had before (using the MySQL api)
$info_get = mysqli_query("SELECT * FROM `users` WHERE `uid`='".$_SESSION['uid']."'") or die(mysqli_error());
$info = mysql_fetch_assoc($info_get);
...
3
votes
2answers
135 views
Can this class be improved?
I have this class whose code I pasted in full. The CredentialsManager class is not shown here as all it does is return the DB connection variables. My question is if this class can be improved or if ...
3
votes
1answer
723 views
Better way of handling data returned from fetch_assoc() (mysqli)
So I connected to the db, pull the data using fetch_assoc() (fetch_all(NUMB) is not available on the machine we are working with else this would be less of an issue). So I get the returned data and ...
3
votes
1answer
548 views
mysqli wrapper class
I made the following class to wrap mysqli for PHP using prepared statements. It seems to work well, but I was hoping to get opinions (on overall structure, performance, usage, etc.). Thanks for the ...
3
votes
2answers
170 views
Best practices to protect a database from bad data
I'm just getting into SQL injection and data sanitization and seeking some advice on my script to get started. I have made this simple program which allows the user to enter their name into a form and ...
5
votes
1answer
310 views
MySQLi DB library - quality/security review?
This libray was written quite some time ago, and it has so far been used in all sorts of small-ish projects.
I'm about to base a more complex, security (Access Control) related, open-source project ...
1
vote
1answer
125 views
Extracting Multiple Associative arrays in PHP
public static function find_user_tracks($id)
{
global $mySQL;
$sql = "SELECT * FROM `tracks` WHERE account_id = {$id}";
$result_set = $mySQL->query($sql);
$ret = array();
...
3
votes
1answer
514 views
Creating a database class in PHP with MySQLi
I am creating a database class in PHP but I feel that there's something wrong with my code. Is there any suggestion to refactor this? I feel like there's something wrong and missing in this code.
...
2
votes
2answers
69 views
Inserting data in the database through POST
My code here is completely working, but I feel like I destroyed or didn't follow the DRY rule, what suggestions can you give to me for this code??
<?php require_once("./includes/Utilities.php") ...
2
votes
2answers
86 views
Username verification class
Everything in this code is completely working, but I still feel that this code needs to be refactored. any suggestions?
<?php
class Db_CheckUsername{
protected $_conn;
...