Find Jobs
Hire Freelancers

Refactor our CRM

$8-15 USD / hour

Fermé
Publié il y a plus de 9 ans

$8-15 USD / hour

We are looking for a few good PHP coders, who are well versed in best practices to help us refactor our CRM. The CRM is presently in-flight and deployed to several facilities, but as a product is has grown organically over the years. This is the first phase of many and anyone brought in at this phase will be on our shortlist for the future phases. Phase 1 consists of analyzing and refactoring any code that may be insecure. Automated tools have identified roughly 10,000 lines of code that suffer from various issues such as injection vulnerabilites, leaky constructs, failure to release resources, susceptibility to buffer overflows etc. The total impact of this refactor is expected to touch upon approximately 25,000 lines of code. Your expected workload is an average of 1,000 lines per day. This will be verified by our git repository. The length of this phase depends on how many applications we bring on, however the delivery date on this phase is December 1st, 2014. The existing product is written in PHP5 and uses mysql as a back-end. Therefore we are looking for people with moderate skills in PHP5 & SQL. During Phase 3 we will be moving off from MySQL and onto something else, which will likely be PostgreSQL. In order to make that move as easy as possible, this phase of the project will remove all calls to mysql & replace them with PDO equivalent constructs. For the most part this will be boiler plate and repetitive. You will be part of a team that may comprise as many as 10 other developers. You will need to be able to focus and pay close attention to detail and communicate effectively. There is an IRC channel you can log into with any questions and for general concerns. You can pick your own hours so long as you maintain at least the minimum 1,000 lines per 8hr shift. The best performers will be invited to Phase 2 which launches the first week of December and includes much more interesting work. So consider this our applicant screening process. The product originated in latin america, the source code is in Spanish. You should be able to communicate effectively in both languages, but at a minimum you should be able to speak & write in english fluently, while being able to read spanish at least at an intermediate level. If you apply to this position in broken english you will be ignored, unless you are from a spanish speaking country. As part of the application process we ask each person to evaluate and refactor a small section of code. Given the following code... function firmaIDByUsuario($usuario) { $conexion = abrirconexion(); $consulta = "SELECT usr_id_usuario FROM usuarios WHERE usr_usuario = '$usuario' AND usr_status = 0" ; $resultado = mysql_query($consulta) or die ('No se pudo ejecutar la consulta'.$consulta); if (mysql_num_rows($resultado)>0) { $registro = mysql_fetch_assoc($resultado); return $registro['usr_id_usuario']; } mysql_free_result($resultado); } Please explain to me the various mistakes that the original author made. Assuming you were a part of the team that had to refactor this section of code, how would you rewrite it so that no longer suffers from any of the same problems that the existing code does while not introducing any new issues? Things to consider... Is this code following best practices already? Why or why not? Is this code exploitable? Why or why not? If it were exploitable, what were the nature of the exploits you've uncoveed? Does this code leak resources? Why or why not? Assuming that abrirconexion were modified to return a properly opened connection to the database via a PDO connection object, and a cerrarconexion function were created that would close the resulting connection object when called, how would you modify this code to use PDO prepared statements instead of mysql_query? Please submit your reply privately. Anyone not submitting a detailed explanation via document submission will be ignored.
N° de projet : 6692731

Concernant le projet

15 propositions
Projet à distance
Actif à il y a 9 ans

Cherchez-vous à gagner de l'argent ?

Avantages de faire une offre sur Freelancer

Fixez votre budget et vos délais
Soyez payé pour votre travail
Surlignez votre proposition
Il est gratuit de s'inscrire et de faire des offres sur des travaux
15 freelances proposent en moyenne $17 USD/heure pour ce travail
Avatar de l'utilisateur
Let's discuss over freelancer Personal Message Box for the proper estimation of cost and time. I am myself doing programming so you will directly work with one person and that's me. No mediators. No managers. No subcontractors. see my recent work for the technical expertise along with reviews & feedback on my profile page.
$20 USD en 30 jours
5,0 (161 commentaires)
9,3
9,3
Avatar de l'utilisateur
Hello! With 99% completion rate, 720 successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 average rating, can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... you can never go wrong choosing me :) I look forward to your reply. Thanks. Kind Regards, Rajesh Soni
$42 USD en 40 jours
5,0 (915 commentaires)
8,5
8,5
Avatar de l'utilisateur
Hello ! The code is not following best practices because of the following a) Function name was not following naming conventions. b) It was using mysql functions, most of the mysql functions are depreciated, we can use mysqli to achieve the same thing. c) We can use object oriented programming approach so that we can deal with the problem as real time problem. d) Function named abrirconexion was called in the program but its body is not present so we can't tell what precisely that function was doing. e)The query fired was vulnerable to sql injections, one should have used prepared statements or stored procedures or parametrized query. /*** Method to open connection */ function abrirConexion() { $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'hrhk'; $dbname = 'concrete5.6.3.1'; @$db = new mysqli($dbhost, $dbuser, $dbpass, $dbname); return $db; } /*** Method to close connection */ function cerrarConexion() { $db = abrirConexion(); $db->close(); } /*** Method to fetch the record **/ function fetchResult() { $name = 'Product1'; $ondisp = 1; $db = abrirConexion(); // obtaining connection object $dbh = $db->prepare('SELECT pID FROM product WHERE productname = ? AND ondisplay=?'); $dbh->bind_param('ss', $name, $ondisp); $dbh->execute(); $result = $dbh->fetch(); cerrarConexion(); //Method calling to close the connection return $result; } //calling fetchResult method to fetch record and show them $res = fetchResult(); echo $res; Regards, Rahul Vohra Daffodil Software Ltd
$15 USD en 45 jours
4,2 (16 commentaires)
7,7
7,7
Avatar de l'utilisateur
A proposal has not yet been provided
$12 USD en 3 jours
4,9 (27 commentaires)
6,2
6,2
Avatar de l'utilisateur
I CAN'T SEND YOU PM. Is this code following best practices already? Why or why not? This code is not following best practices: 1. There is no validation for input values; 2. You should use ORM; 3. Even if you don't, you should not create a new DB connection everytime you want to get some data. Is this code exploitable? Why or why not? If it were exploitable, what were the nature of the exploits you've uncoveed? Yes because there is no validation for input values. ex.: You can get something like this $usuario = "user'; DROP DATABASE;" Does this code leak resources? Why or why not? mysql_free_result($resultado); — this line won't work because it called after this one return $registro['usr_id_usuario']; Assuming that abrirconexion were modified to return a properly opened connection to the database via a PDO connection object, and a cerrarconexion function were created that would close the resulting connection object when called, how would you modify this code to use PDO prepared statements instead of mysql_query? The task is a quete abstract, it would be much better to udnerstand a bigger picture. This is how it could be implemented with PDA $conexion = abrirconexion(); $consulta = "SELECT usr_id_usuario FROM usuarios WHERE usr_usuario = '$usuario' AND usr_status = 0" ; $stmt = $conexion->prepare($consulta); $stmt->execute(); if ($registro = $stmt->fetch(PDO::FETCH_OBJ)) return $registro->usr_id_usuario;
$15 USD en 40 jours
4,9 (18 commentaires)
5,5
5,5
Avatar de l'utilisateur
checked this requirement,and i think we can easily handle this requirement,i will tell you something about my team, Have a team of 34 professionals,with more then 11 year of experiecen,worked in php/mysql,LARAVEL-4,Symfony-2,Cakephp 1.2,1.3,2.x,html,html-5,bootstrap, we can start this project as soon as possible.
$8 USD en 40 jours
5,0 (2 commentaires)
1,7
1,7

À propos du client

Drapeau de UNITED STATES
United States
0,0
0
Membre depuis nov. 5, 2014

Vérification du client

Merci ! Nous vous avons envoyé un lien par e-mail afin de réclamer votre crédit gratuit.
Une erreur a eu lieu lors de l'envoi de votre e-mail. Veuillez réessayer.
Utilisateurs enregistrés Total des travaux publiés
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Chargement de l'aperçu
Permission donnée pour la géolocalisation.
Votre session de connexion a expiré et vous avez été déconnecté. Veuillez vous connecter à nouveau.