PHP is a widely-used, general-purpose scripting language that is especially suited for web development.

learn more… | top users | synonyms

0
votes
0answers
2 views

Bot command logic for ordered turned playing list

This is the switch statement for an unfinished bot I'm making that maintains a user list and responds to these commands in an irc chat. For whatever reason, the list order gets scrambled when around 5 ...
-1
votes
0answers
15 views

CRUD class for database

I have a database class that connects to a Database and runs CRUD operations. I need a critique of how well this class adheres to SOLID principles.A class to run all database operations seems like '...
2
votes
2answers
26 views

Collect, filter and display archive logs on demand

Wrote a php site to gather/filter/search daily archived logs from the archive directory using bash cat and ...
2
votes
0answers
25 views

Document Merger using PhpDocX

I'm developing a document merger that utilizes an FTP site containing hundreds of documents. FTP Connection Function ...
1
vote
1answer
54 views

Create multi-dim array from cursor

I'm executing a cursor. I have cut off the code how the procedure is called and executed. This part is efficient. At last I have a small cursor. I'm calling the procedure, which returns this cursor ...
0
votes
0answers
25 views

Simple Event/Hook Router

i have been working on a legacy system and decided to open source the simple event/hook router system that i wrote as part of this work. would love some feedback in terms of suggestions, and - of ...
0
votes
0answers
27 views

DataBaseaction function connect insert update MySQL tables

This class will take just the table name and data array and will do the rest, update or insert. I know it's not perfect, but I could use some feedback. ...
1
vote
1answer
55 views

Class for database connections in PHP

I have made this class for database connections to my applications. It eases out the task of making connections to the database with knowing the credentials in advance and provides a way to execute ...
-3
votes
0answers
18 views

Circular reference, separation of concern, why to follow it? (php) [on hold]

my code was criticized. Here is a mail template system: ...
-4
votes
0answers
23 views

Why is it bad, if an entity can save itself? (separation of concerns) [on hold]

with a few ORM I can see that: $entity = new TableName(); $entity->setName('username'); $entity->setPassword('zxbvc'); ...
0
votes
0answers
27 views

Repository code in Laravel

I am practicing to code in the right way and make it testable. Please review this code and tell me anything bad practices of it. Entity: ...
2
votes
1answer
51 views

Function for inserting data into database

I have this function to ease out the task of inserting data into databases. I am not very sure if it is secure to use it this way. Any suggestions on improving it? ...
0
votes
0answers
38 views

Storing files in various formats

I'm very passionate about OOP and I created a system to store files in various formats. Any better approach is welcome! Base class: ...
1
vote
2answers
66 views

PHP OOP Repository overview

I already learned JAVA, a few design patterns (Controllers, etc.) and OOP. I'm trying too build some PHP scripts in OOP (a blog). I want to collect some articles from the DB and store in an array. I'm ...
0
votes
0answers
6 views

php driven web form to mysql db code not running [closed]

Would love any pointers, new to sql... ...
0
votes
0answers
23 views

Rewriting a form from classic ASP to PHP - not sure if I'm doing this right [closed]

Explanation for code review, questions I have I'm rewriting a Financial Aid loan application for the Financial Aid office at my college. It deals with sensitive information. My purpose for posting ...
-2
votes
1answer
43 views

Is it ok to change implementation of parent function with child data?

I was wondering is it OK to change implementation of parent class with child class data. I have situation of creating a child class (form) which extends the parent class (other form with same elements)...
3
votes
1answer
78 views

Suggestions for better oop designs with real example (file services)

I'm watching Uncle Bob to improve code maintainability and readability. I've built a system in which can upload various file formats. Bellow I've posted the pdf one. The below code works perfect but ...
-1
votes
0answers
8 views
0
votes
2answers
46 views

Database in Class for Reusability

Does this code fine for database reusability? ...
1
vote
3answers
55 views

Validator class for PHP

I've made this validation class in PHP that would take inputs, on initialization sanitize them and validate them specific to the type. It works fine, but I would like to know if there's some bad ...
-4
votes
0answers
45 views

Is this code more efficient? Is the complexity constant on the first one?

I wrote a code that modify an array. At first I pass the array normally and use the return value. Then I decided to pass array by reference ...
0
votes
1answer
56 views

Retrieving remote pages and parsing html

This is my code: ...
1
vote
0answers
30 views

Pattern observer

This is my dispath events code: ...
1
vote
1answer
43 views

Laravel generate category list from product results

I have product results with some filter, and the one is category. I'll get the category list from product results. the model category and products is one to many relationship. This is the search ...
2
votes
1answer
52 views

Shopping basket script in object-oriented PHP

I have made a shopping basket script that allows the user to add and remove items from the basket, and edit quantity of items that are in the basket. I am new to OOP, and I would like to get your ...
3
votes
2answers
43 views

Product search script Object Oriented PHP

I have made a search script in OO PHP that searches for products based on the inserted criteria, selects them and checks whether a sale is on, if it's in stock and other features. I am new to OOP so ...
4
votes
0answers
100 views

PHP daemon like behavior hack

I have a web application that gathers data from the user. Data is gathered via multiple asynchronous requests, so every time new data is retrieved it is immediately sent to the server because I can't ...
-4
votes
1answer
42 views

How i can do this in one query [closed]

How i can do this in one query ...
1
vote
1answer
26 views

Extracting site visit information from a REST API call, including addresses from a MySQL database

I'm building a web app that pulls data from a ticketing system via REST API. I'm currently able to pull all of the data I need just fine but the loading process is really slow. I'd love any feedback ...
5
votes
0answers
58 views

Phishing Project - Refactored Controller Class

Following the last review, I felt that my project was starting to get too complex to continue moving forward as such. So I created a new project and migrated pieces of it over to streamline it's ...
1
vote
1answer
38 views

Laravel controller to update appointment requests

My question/refactor is similar to what is found here: Laravel controller for form validation skinny However, I feel that the answer is for 5.0 and not 5.2. This question does not pertain only to one ...
1
vote
1answer
82 views

Dynamic Routing PHP MVC

I'm creating a simple MVC framework for a new version of my website I'm working on. Currently I have simple routing, such as /about-us etc ... I've just implemented 'my version' of dynamic routing. I ...
1
vote
1answer
32 views

Phishing Project - Refactor Using Models

After receiving some good feedback on the previous question, I've refactored my database and have begun to refactor the associated code. As a result of implementing models for all tables in the ...
1
vote
0answers
18 views

Loading xml data to shift array keys

I'm working on improving myself by teaching myself how to make classes to remove reppetitive pieces of code and create a class that does it for me. I have the following xml document. ...
0
votes
0answers
25 views

Library to query Edmunds' API

I'm attempting to create a library to query Edmunds' API. I'm not sure if the design is over-engineered and would like some feedback. Here is the code: The API class (takes and endpoint and ...
1
vote
1answer
32 views

index.php implementation

I'm writing a MVC app, I've put effort into writing index.php since it must be the entrance point (like main for C and Java) imho. I would like to ensure if someone who were to work on this file ...
0
votes
1answer
27 views

Is the format of this PDO mysql statement correct

I have been writing simple php programs, trying to adhere to the PSR standards, for writing code. However they do not seem to have any standards for writing mysql PDO statements in. For example I ...
1
vote
4answers
103 views

PHP MVC implementation without a framework

I've been using PHP for years and in every project I've ever done I've included the HTML, PHP, SQL etc ... in the same page. Upon looking through Github at large projects like WordPress and MediaWiki ...
2
votes
1answer
31 views

Eliminate redundancy from session authentication

I have a session authentication script and it works, but I can't find a way to eliminate the redundancy where the two database queries are. One checks if the cookie has a corresponding entry, and the ...
2
votes
1answer
42 views

Processing a string containing product variants

I have a variable containing a string in this format "Size-XS|Size-XL|Color-Red|Color-Green". When i process it the final result is "Variations: Size: XS, XL, Color: Green, Red. The code for this is ...
1
vote
2answers
52 views

PHP script that combines data from two CSV files to produce two new files

I've spent some time looking at various posts on Stack Overflow regarding PHP CSV file manipulation and have devised a script that combines data from two CSV files to create two new files. The aim of ...
2
votes
1answer
48 views

Phishing Project Refactoring to Use a User Object

Continuing on my quest to make sure that my application is developed strong, securely, and efficiently, I've updated my code as suggested in the previous question. To start, I've implemented a ...
2
votes
1answer
47 views

Get all company branches using stored procedure

Am creating an application for a transportation company that will store information about their drivers, the cars they drive and to what branches and districts they belong to. I have a branch table ...
0
votes
0answers
21 views

Decouple resource that only lists items owned by logged user

Both methods works just fine, but I would like people's opinion on whether I'm facing this the wrong way. JWTAuth returns an ...
2
votes
2answers
42 views

Filtering array by list of keys in PHP 5.5

I have an associative array with data (let's say language codes and descriptions) and a second array with allowed keys (lang codes). I want to filter the data array by these allowed keys. The ...
1
vote
3answers
59 views

Three PHP database queries to manage accounts

I have a database connection PHP file which has a lot of queries to the database. Here are 3 of the functions that I am using: ...
0
votes
1answer
41 views

Function that calls the database connection and query

I made a function that contains the database connection and query. Now I'm always calling this function every time I need to query a database. Is it good or is there another way better? Database ...
1
vote
0answers
19 views

Using Symfony forms without a database entity

I've been developing an application based on Symfony 3, and part of that application involves an import process where a user can upload csv files. One thing that I've never been too sure about with ...
1
vote
0answers
19 views

Api with security through a private and public key

I want to make users login into an app, the code on my server serves a "token". This is based on a salt that is saved for each user, the login date, expDate and the userId. That value is hashed by the ...