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

learn more… | top users | synonyms

3
votes
1answer
28 views

PHP, MySQL quiz application

I'm working on a quiz application for training purposes and I think I'm done with most of it. However, I'm not comfortable with what I've done: it seems to be complicated and unprofessional and I ...
2
votes
1answer
32 views

Zip code reduce function

My task is to write a function that would take an array of zip codes and spit out only the zip codes that do not qualify. A non-qualifying zip code will not exist in the database and does NOT have ...
0
votes
0answers
11 views

Class App\Http\Controllers\Requests\ArticleRequest does not exist Laravel5.3 [on hold]

Actually I'm very new of the php and Laravel5.3,and I have this problem when i want to set request of the form(Doing a simple blog page) ReflectionException in Route.php line 339: Class App\Http\...
0
votes
0answers
10 views

from json array to variable or mysql [on hold]

I have this script to display some value from a json file: ...
1
vote
0answers
12 views

Laravel 5.3 model for mapping pages to multilingual translations

I have a Many To Many Polymorphic Relation like this: ...
0
votes
1answer
75 views

contact.php file

This is my contact.php file which has only 2 functionalities: Response with the default page if it is requested by the get method Process the message posted by the ...
1
vote
2answers
87 views

My included in every script file

I wish I found this site 4 months ago when I started PHP, when I wanted the experts to check the engine and wheels before I take off. Right now I'm finishing my very first web application, and I will ...
0
votes
1answer
38 views

Searching in array by key => values

I need to write a function that searches the two-tier board according to certain parameters, which works, but I question whether there is a simpler, lighter way to perform this task. ...
0
votes
1answer
72 views

Calculating the difference between 2 arrays

I made this function to calculate the difference between 2 arrays and return it in a third array. I'm using this function as a part of stocktaking functionality I apply in my accounting system. ...
1
vote
0answers
48 views

Calculating the difference between two (incomplete) arrays

EDIT: a function to calculate the difference between 2 arrays I'm coding PHP for only 4 months, and I need your help to improve this code I have 2 arrays like this ...
-3
votes
0answers
15 views

Image resize does not work [closed]

This is my code for rename and upload image to dir folder image It's work good ...
2
votes
3answers
61 views

User Profile page - code quality , security & Performance feedback

once user login, we are displaying all the information of user in profile/account page. please check code quality , security & Performance. ...
0
votes
2answers
43 views

No getter/setter on model with many instance vars

I have been reading a lot of material on how to become better in OOP, DDD etc. While reading Object calisthenics and Getters/Setters. Evil. Period. I got confused. Let me explain it by example. I ...
-1
votes
0answers
34 views

Implementing low level class recurring interaction with app logic [closed]

What solution for printing errors to user would you chose from below examples and why you think its the best choice. Do you have better solution? 1.Using Error collector class and shutdown function ...
1
vote
1answer
20 views

A localization helper in codeigniter

I created a project to better understand CI3, while developing it I tried to introduce localization elements. When I tried to localize the view everything messed up. I made a helper to identify if the ...
4
votes
2answers
54 views

Basic PHP Cloud script

I would like to add basic Cloud system to my website project. I have my php login system already included. Every person must be logged in to view this site. There are several session variables like <...
0
votes
0answers
14 views

Pagination with ElasticSearch results

Technologies being used: PHP 5.6 Laravel Framework 5.3 (with Blade templating) ElasticSearch 2.4.1 Bootstrap (for CSS pagination classes) ...
4
votes
2answers
92 views

PHP OOP Login Script

I'm new to both PHP and OOP and would like some constructive feedback on a class I made. I have a "main account" login system already setup and working; when the user logs in they're presented with a ...
-4
votes
0answers
25 views

pdo query innerjoin optimization

i need help optimizing this PDO query i would like to know if there is a better approach for this code and would like to make it cleaner and faster. right now it takes about 2 seconds to load one ...
-1
votes
2answers
54 views

Method to assign handle to organization object in one of multiple ways

I have a method that's called thousands of times during one process. Before optimization, it called the database on every execution. After optimization, it only calls the database when required. ...
3
votes
1answer
68 views

Populating a form with filtered hierarchical place names

My server performs a query to get all country data with Eloquent relationships: ...
0
votes
0answers
33 views

Zend Framework 3 Ajax Form Validation - contact form

I would like to present to you my code vision of Ajax form validation in Zend Framework 3. I am a beginner in Zend Framework and jQuery too, so I don't know that my solution is good and acceptable. ...
0
votes
1answer
52 views

Secure logout PHP code with cookies

I have the following PHP logout script and I would like to know the loopholes present in it. How can I improve it? ...
3
votes
3answers
31 views

Summing durations associated with each MAC address in a MongoDB result

I have a script which get data from MongoDB in the form of array and show the result. The array has a number of records in the thousands. A sample array is as follows: ...
1
vote
1answer
29 views

Class for creating save sessions in PHP

Is the following class well-built and secure or am I missing something? Any improvement ideas welcome. ...
0
votes
2answers
46 views

PHP create JSON file from Twitter API

I've been reading more on PHP JSON and APIs I wanted to play around and pull a user's tweets so I wrote a function that requires the TwitterAPIExchange wrapper. The code: ...
0
votes
0answers
25 views

Tag that prints expressions for my template language

This is the PrintNode class from my template language Aegis. This class' purpose is to enable printing expressions (strings, variables, numbers, ...) in the language. eg: ...
1
vote
0answers
45 views

Secure login and authentication in PHP

This seems to work for me, but I want to make it more secure. I want to see how far I can go without pre-built packages/bundles, so please don't suggest any. How secure is this? What are some steps I ...
0
votes
1answer
23 views

Factory hierarchy for creating GoogleMap and its elements

The purpose of this code is to create a GoogleMap using PHP, add markers to it according to Place objects from database, add infoWindows for these markers. While ...
0
votes
0answers
38 views

Handling routing with jQuery + Laravel

Basically, it's a matter of code organization, trying to delegate as most responsibility as possible to the server and keeping JavaScript use to a minimum, mostly as "glue" code between the view and ...
2
votes
1answer
52 views

Encrypting a user's file with a key that isn't stored but only known by the user

I want to make some kind of file vault. I want to store encrypted files in a MySQL table, and the key to encrypt/decrypt them is never stored but only known to the user (that's the goal, anyway). The ...
0
votes
1answer
35 views

Protect against XSS with .htaccess file

My .htaccess redirects everything to my index.php, but I wonder if it's vulnerable to XSS attacks. Am I safe? .htaccess file ...
-1
votes
1answer
42 views

Simple PHP SSH2 Class

I've written a simple PHP SSH2 wrapper class. Please review the code and point out mistakes. ...
3
votes
1answer
45 views

Structuring basic client side / serverside email form

I've been more than likely doing this entirely wrong for quite awhile and would like to correct that. With the code review I would like to get critiqued on everything. This includes: JQuery syntax/...
0
votes
0answers
29 views

File attachment validation from contact form

I'm relatively new to PHP programming and working on the server side, and I have this HTML contact form allowing people to upload a .doc, .docx, or .pdf file with the intent of emailing this uploaded ...
4
votes
1answer
81 views

Testing a Pivotal API request client using lots of mocking

I have a class that is all about doing HTTP requests, and logging (in file system & database). It's only using 3 dependencies to do these things, so I'm fine with the code so far. Here it is for ...
1
vote
1answer
47 views

Ivory google map facade

I want to simplify this process of creating map, putting markers on it according to Place objects from my database, creating info windows. Using egeloen/ivory-...
2
votes
0answers
46 views

WordPress Settings Plugin security

I'm wanting to step into plugin development so I can eventually push to WordPress.org so I wanted to go through and really learn how to properly develop a Plugin's settings page. I went through ...
1
vote
6answers
44 views

Better way to write if/else conditions

I've got the following code where: $urlParams is the school year from 7 to 11 $Comms['Overall'] is the total amount of "...
4
votes
1answer
61 views

PHP secure server2server communication

I read a lot about security mechanisms used in different APIs. But I'm still wondering if my own implementation is secure or not since it seems that there will ever be a risk of something you forgot .....
1
vote
0answers
49 views

MVC architecture for a Slim application

(https://github.com/trvshrmn/slim) This is more of an entire project review... if this is 'off topic' I apologize. I attempted to make Slim into an mvc structure. I added a few controllers, views and ...
1
vote
3answers
54 views

Look for patterns in the keys of an array, to group them in a new array

I am working on a function that will take a an array of options. These options are retrived from a database, and could have other options inputted throughout the system. When adding my options, I am ...
1
vote
0answers
81 views

Extend the Laravel Eloquent model in order to easier implement CRUD REST for my routes

By extending the Model and using this inside my routefiles, I can easily call these functions inside the corresponding HTTP ...
0
votes
1answer
42 views

A PHP function that prints the url based on path

I'm trying to come up with a smart wordpress inspired PHP function that builds an url for my CMS. It has some different requirements that are almost all fulfilled so far. Must use correct domain Must ...
0
votes
1answer
51 views

Abstracting HTTP requests to keep it simple, flexible

The project is an API that will itself make HTTP requests to external webservices. Since this is PHP, we actually chose to use guzzlehttp. Now the library itself doesn't matter much, but I'm scared ...
1
vote
1answer
29 views

Prettifying PHP's Exception stacktraces

I have always disliked the way PHP printed stacktraces, coming from a Java world. So I decided to implement my own ExceptionFormatter, a class that will format ...
-1
votes
2answers
32 views

Wrapper Connection PDO PHP [closed]

This is my wrapper, how can i improve this? (With a Singleton too) ...
4
votes
4answers
77 views

Transposing a PHP associative array

The purpose of this code is to change each column to a row, and assign keys to each value for the new array according to the old array. I would like to know if there're other ways to optimize it. <...
0
votes
0answers
36 views

App for system that will load ad reports

I need object analysis for this problem. Since I am new to OOP and this is basically my first project, I want to know if I am doing it right. I think it should work as it is stated in assignment (...
0
votes
1answer
85 views

Instagram PHP Library

I've written a small PHP library to connect with an Instagram application. The repository is on GitHub Instagram-php. Here I am adding only main class code. I require a code review and thoughts on ...