Skip to main content

Questions tagged [php5]

The fifth version of the PHP: Hypertext Preprocessor (PHP) scripting language. It features the Zend Engine 2, better object model support, and many other improvements over PHP 4.

4 votes
2 answers
209 views

Security of post submission, picture upload and post fetch

I am a newbie and have been following a tutorial I bought on Udemy. But I was told it is old and teaches bad code practices. I used this in some code from my old projects. Now I'd like to know how ...
user13477176's user avatar
-3 votes
3 answers
379 views

Registration code [closed]

I was following a tutorial for a social network. I want to know how secure this code is because I plan on launching it to the public web. ...
user13477176's user avatar
0 votes
1 answer
259 views

PHP - Importing columns from uploaded CSV file to SQL database (Laravel 5.7) [closed]

The goal is to upload the columns from the csv into the SQL Pro database. I am able to select the column names that have been uploaded from the csv file, the columns from the csv file are then ...
Victor Melvin's user avatar
1 vote
2 answers
753 views

Validate array elements in PHP

$elements is an array, which may contain 'x' or 'y' keys, I want to check if they exist, otherwise assign a 0. I'm looking for a clean way to validate it. I'm new ...
gogasca's user avatar
  • 599
3 votes
0 answers
48 views

Use a pattern for fields validation

I need to validate the fields of user sent by an API. All works fine but the only one problem is that I don't like the solution is not an OOP solution. In the controller I call the service created by ...
klsdskldsd's user avatar
1 vote
1 answer
89 views

Merging and summing multi-dimensional arrays

I've found myself today really struggling with this subject and I'm pretty sure that there must be a better way to do this. First of all my arrays have the same layout, I need to merge them and sum ...
ccb123g's user avatar
  • 11
3 votes
2 answers
2k views

Users management php class

After a little bit of troubleshoots, I've finished this simple users registration and login class. It uses PDO to connect to a mysql database, I've tried also to ...
user9741470's user avatar
1 vote
1 answer
117 views

Appending objects to an array based on a field

I am working with PHP5 (Laravel 5.1), and I couldn't optimize my function, which takes more 4 minutes turning, and fails in the end when I have a huge data (around 6500 rows, but working when i test ...
Gothiquo's user avatar
  • 127
0 votes
1 answer
36 views

Quiz setting users grade

I have made this code to determine the users grade for a quiz. However I've just been thinking that maybe I could shorten the code somehow? as its just a lot of if and elif statements. ...
user avatar
1 vote
1 answer
71 views

Git Autoupdater

At my office we have an internal monitoring tool we use on customer systems to monitor various vitals and notify us via Slack. Our Lead Dev and Chief Architect are very paranoid about Git, and ...
Mayube's user avatar
  • 181
0 votes
1 answer
53 views

PHP return validate method of if one error is found

My method counts the number of times an error occurs. I have a feeling my snippet isn't the best practice way of doing this. So when one of the validation methods fails I want to stop the method. <...
Miguel Stevens's user avatar
1 vote
2 answers
2k views

Sync Server Time with User's Timezone

I have a web application which is being used by users from different parts of the world. In order for users of the site, to be able to view the timestamps in their local time, I've a settings page set ...
asprin's user avatar
  • 175
2 votes
1 answer
127 views

Function to insert a tag into a database

I'm developing a MVC structured RESTful API project (thanks to the help of Mārtiņš Tereško for explaining it). Almost all of my functions look similar to this: ...
DaAmidza's user avatar
  • 259
1 vote
1 answer
170 views

Populate two arrays with two different SQL queries

I am using Joomla and connecting to an MSSQL database to store the resulting set(s) in arrays. I am utilizing this syntax, but there must be a more efficient way of coding this. ...
BellHopByDayAmetuerCoderByNigh's user avatar
4 votes
4 answers
9k views

Which is cleaner: a constructor with many parameters or many setters after construction? [closed]

I'm trying to work out which is cleaner, having a large constructor or having to use many setters on a new object before doing some work with it. Large constructor: ...
CJ Dennis's user avatar
  • 249

15 30 50 per page
1
2 3 4 5
16