PHP is a widely-used, general-purpose scripting language that is especially suited for web development.
-1
votes
1answer
96 views
PHP Simple Admin
I need to create a small app that can add options, save them into a database and retrieve info, which are painted in Panel and an Editor, and I've decided to do it manually, and trying to figure out ...
2
votes
1answer
48 views
Setter use for dependency injection, passing interface through too many layers
I have an Offers class which is basically a seller which has specific skills, such as law knowledge.
It needs a method isLawyer. ...
3
votes
1answer
27 views
Resizing and recoloring a logo using PHP GD Library
I have the following code, that works very well. However I'm about to launch it to 5000 users and will no doubt take a beating early on. I want to ensure that if there are any opportunities to ...
-4
votes
0answers
22 views
How do I make this PHP SQL Injection Proof? [on hold]
I've been told I need to go to this website instead for help on this so I'm not sure exactly. Firstly, I have very little experience in php scripting and alot of people have told me that this PHP ...
1
vote
0answers
21 views
0
votes
0answers
16 views
PHP Cache weather in a file
I'm using the darksky api to get weather data for a display board website.
The free version is limited to 1000 api calls per month.
I have a lot of devices (iPads) displaying this information in ...
3
votes
1answer
30 views
Adding multiple datasets to single table
I have a table1 in DB1 which is similar to the following
...
0
votes
3answers
43 views
Initializing connection to a MySQL database in PHP
I wanted to get some feedback on this way of initializing a connection to a MySQL database.
File includes/db.php:
...
0
votes
0answers
14 views
PHP IPC with geth Ethereum [closed]
I have setup geth Ether testnet. I want to communicate over IPC PHP with the client. Im on Ubuntu.
This is my current code:
...
1
vote
1answer
39 views
PHP subset of 2 arrays containing objects - compared only by 1 attribute
I'm looking for a fast way to get the subset of 2 arrays containing the same kind of objects using PHP functions.
I'm looking for the red part:
...
0
votes
0answers
22 views
OAuth2.0 Client framework
I'v developed a OAuth2.0 Client.
The initial goal was to make a simple client where people won't have to focus on it to much ,and where they can start coding their product immediately by just ...
1
vote
1answer
25 views
Elegant wp-query markup for repetitive post-type category loops
For WordPress sites, I always end up building custom post types. They usually have categories, but I don't use much of the 'archive' abilities. This site, for example, is for a film director and so it ...
0
votes
1answer
14 views
Displaying API results inside a WordPress page template
I've created a WordPress page template that calls an API using Httpful and formats the results. This is my first time using APIs on a page, so I'd like to know if this is the right direction to go in.
...
2
votes
3answers
38 views
PHP form that posts to Trello API and mailgun API
The following is the full code of a page that receives a POST request from another page (I don't believe it's too relevant what that other page is, but I'll post it if requested).
Assuming that a ...
2
votes
1answer
37 views
PHP 7.0 - 'INIController' - A set of classes for reading, parsing, and editing .ini files directly or in memory (Second version)
This is the second review of this particular project, after I've made changes based on feedback I received on my last post on code review, which you can take a look at here. Yes, I copy pasted some ...
2
votes
0answers
28 views
Code for a Person DTO, with tests
My needs are to manage DTO in a php5.3 application. I've written few lines of code in TDD with phpunit 6. The scenario I want to implement is a request with following fields:
name
surname
password
...
0
votes
1answer
31 views
Using hash_file for image recognition
My team is writing software to be able to grade a basic skills in word/excel/powerpoint test. We are trying to figure out the best way to verify that they included a correct image in their word doc. ...
1
vote
1answer
44 views
Move one element before another in an associated array
I have this task where I have an associated array in PHP and I want to manipulate the order of entries. Basically I want to be able to move entry Y before entry X.
So basically if I have the ...
-1
votes
1answer
40 views
Outputting link with URLs based on database entries [closed]
Is this output safe against XSS and the other attacks or no ?
...
-1
votes
1answer
50 views
Searching for topic categories using mysqli [closed]
Is this code safe from injection, xss and whole other attacks or no ?
The below code is for search box :
...
0
votes
1answer
51 views
Calculate future date based on business days (using Objects)
I realize there is already a review about this here, but it's using strings and stuff rather than date objects.
I'm trying to make a simple function to calculate days from a point in time and return ...
3
votes
1answer
91 views
MVC structured REST API in PHP
This approach might be wrong or right, if you have something to add please correct me since i want to learn!
The past few weeks I'v been trying to build a MVC structure REST API in PHP.And this is my ...
1
vote
2answers
47 views
PHP multiple photo upload for ad campaigns
I am creating the dashboard to create an ad campaign. The user needs to upload a campaign name, campaign title, and up to 3 images. These 3 images will have designated "slots" on the page so it makes ...
2
votes
1answer
53 views
Raw text positional parser PHP
it's my first time on code review.
So I'm parsing a raw text file with my parser and a defined template (basically an array) to create a formatted array out of it.
The idea is that each line can ...
3
votes
1answer
81 views
Validate iTunes links
I'm working on this code and I can't find a better way to improve this code, can anyone improve it more? My PHP is pretty bad, this is the best I could do.
The code checks if iTunes link exists in ...
3
votes
2answers
341 views
Login implementation security concerns
In many of my personal projects, I have a login system very similar to the one I am about to describe. I understand how difficult correctly implementing authorization systems can be. I do this as a ...
-1
votes
0answers
49 views
Run a sequence of statements only if previous sequence triggered no error
I've made myself a task of writing a micro service and I'm a fan of short methods.
I want to make the handleRequest method shorter. It's PHP7.
The method are the ...
1
vote
1answer
117 views
PHP MVC RESTful API
I'm new to the whole thing of MVC patterns. Although I have heard of it before, I have never used it, so I'm confused with it all. I know that this code is not right probably but I need some guidance.
...
0
votes
3answers
87 views
PHP database calls
I need help to speed up this code. It works, but is really slow (updates 2 items/second). Any tips on how to speed it up?
The script functions like this:
Break up an email to username and domain
If ...
-1
votes
0answers
45 views
Login with sign up MVC
I coded simple MVC login system with registration. The mvc contains folders controller, model and view. I try to handle the logic in model file. But I have a question about the view. What is about ...
3
votes
2answers
66 views
ASP.NET Password Hashing reimplemented in PHP
Live link to Code: https://github.com/sqlcollaborative/AlwaysEncryptedSample/blob/features/phpSampleApp/AlwaysEncryptedSample.PHP/src/Security/AspNetIdentity.php
Unit tests to prove it works: https://...
0
votes
1answer
56 views
Command Class & CommandCollection class
I have written Command Class & CommandCollection class.
Every command will have instance of ...
-1
votes
1answer
67 views
Detecting arrays with enough entries in common [closed]
I have made a function called testing. This function tests whether five numbers from each sub-array of $source are included in <...
-1
votes
1answer
40 views
Getting deceptive/malware content sites list with Google Safe Browsing v4 [closed]
First of all I am not a programmer. I am starting small project to kill time. I am using Google Safe Browsing API v4 in PHP to get the deceptive sites which contain malware. I searched on Google and ...
2
votes
1answer
59 views
Displaying a table using DataTables and AngularJS
I am using DataTables to format and display a table. I started the project using AngularJS with a PHP backend but I needed to inject some Vanilla JS and JQuery code in order to use DataTables.
Is ...
-4
votes
1answer
56 views
Is there a cleaner way to write all these foreach and arrays together? [closed]
I pull live data and plug it in to one array. The code below pulls from a local database which is then used to check against the live array data. If there is a match, number is not listed.
The code ...
0
votes
1answer
65 views
PHP/MySQL to delete data from 4 different tables at once
I have four mysql tables setup like the following:
...
2
votes
1answer
55 views
MVC controller and action that handles favorite items in a session-based list
I've written a Controller and a corresponding Action for a Symfony 2.8 project, that does the following:
handles a list of favorite items of a user
the ids of the favorites are stored in the session
...
-1
votes
1answer
20 views
Matching Needle & Haystack values using related Ontology values
I need to match values in Needle & Haystack arrays, using alternate Ontology values when relevant. This syntax works, however I would like a more efficient way to do this as I will be using it for ...
1
vote
1answer
57 views
DDD Domain Objects, Factories, and Presenters
Aloha,
I am working to understand some of the different pieces of domain driven design. In this particular case, I have a NameFactory that builds a Name domain object. I also have a NamePresenter ...
0
votes
0answers
37 views
PHP's strrpos in VBScript
One of my recent jobs was working in VBScript. Well, ASP.Net for which they had specified the VBScript language.
For whatever reason, I needed to use the strrpos ...
0
votes
2answers
35 views
Stateful User tracking
I have a class that takes a string or an integer, which stand for username or user id in the database. I am not comfortable with my constructor taking "a string or an integer" and want to modify it ...
2
votes
2answers
68 views
PHP Response Wrapper
I'm writing a routing system that may or may not be part of a public API later for a personal project. A main part of the routing system is a response object for the user to send headers, status code, ...
1
vote
1answer
32 views
Matching Needle & Haystack values using alternate Ontology values
I need to match values in Needle & Haystack arrays, using alternate Ontology values when relevant.
This syntax works, however I would like to know if there is a more efficient way to do this as ...
1
vote
1answer
41 views
Routing System request syntax
I'm working on writing a routing system for a PHP project. I'm trying to write it in a way that it can easily be expanded later on via plugins.
I have 2 ideas for how to go about doing it:
1:
<...
3
votes
3answers
69 views
Get most recent modified time of a folder recursively with PHP
I'm relatively new to php and any advice is appreciated.
I have written a code to the most recently updated time for a folder in php.
Can you please correct me if I am doing anything wrong.
And here ...
0
votes
2answers
81 views
PDO anonymous function inside a Factory
In this question here on S.O, the accepted answer suggests to use both anonymous function and factory pattern for dealing with PDO connection. I believe the anonymous function is used in case a ...
3
votes
2answers
104 views
Inserting users using PDO prepared statements
I made a small script to update fields in a database. I'm using PDO to connect to MySQL. All the business logic of PHP is in the top half of the file, and the form is at the bottom.
Here is the full ...
3
votes
1answer
57 views
Calling variable methods to handle ajax requests
I made a controller.php file to handle ajax requests, with $_POST parameters action and module
...
1
vote
1answer
61 views
PHP classes to model products, parts, and stock
I am creating some classes, but I don't know if this approach is very solid. First some basic information. I use code igniter as framework. I use $CI =& get_instance() since I need to load some ...