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

learn more… | top users | synonyms

1
vote
0answers
12 views

Is this script safe? Could it support 1000 concurrent users?

This is what the code does: Check if the user's website exists and is active. After checking the user IP already exists and if the weather 24 hours have passed, if so it deletes the IP database. ...
3
votes
1answer
24 views

Eloquent methods to calculate the average rent of apartments

I am working on a Laravel 5.1 website where I am counting the average rent of apartments in a specific area. Besides of that I want to get the average rent by amount of rooms in the apartment. The ...
0
votes
0answers
19 views
0
votes
0answers
20 views

Converting CSV To MYSQL With PHP In My Custom Wordpress Plugin

I have a function which converts a file from CSV to MYSQL The file could be 5,000 rows long up to 90,000 rows long. Based on ...
0
votes
0answers
29 views

Rating normalization algorithm

I have a rating system where users can vote between 1-6. I'd like to normalize the votes a bit to better accommodate for extreme voting, where individuals tend to vote as high or as low as possible. ...
-4
votes
0answers
11 views

Cake PHP 3 Application [on hold]

I created an application using Cake php 3, inside this application resides my API controller and my normal application controller. How do i use httpclient to access the API get method from my normal ...
0
votes
1answer
72 views

Simple Gender Guesser

I have made a simple gender guesser for an app and thought that this simple bit of code may be useful to other developers. It takes in a string and returns an 'f' for Female and an 'f' Male depending ...
0
votes
1answer
30 views

Minimal CORS mail PHP

I have an PHP endpoint used to mail me feedback or error logs from my sites here: https://github.com/kaihendry/vanilla-php-feedback-form/blob/master/feedback/feedback.php ...
3
votes
1answer
73 views
+100

Parsing URL query and appending it at end of the other URL

I am trying to grab the URL query of the URL which is in the browser's address bar, then append it at the end of the other URL and echo it to the browser. So, if I visit my script at: ...
4
votes
2answers
111 views

Event timers database interaction layer

I've just started with the basics of OOP. At first it looked complicated, but once I just started with it, it seemed so easy and everything seems to work like a charm, and that's why I'm unsure if I'm ...
-1
votes
0answers
13 views

Date not formatting properly [on hold]

my date is not formatting properly. My date is display as 2016-02-08 2016-02-12 but I want it to display as February 22 February 26, which are the next bloack of days it will display a message. Here ...
-1
votes
0answers
8 views

PHP issue: sending multiple email signup confirmations on newsletter subscription [on hold]

I have the following function that based on checkbox value will add subscriber to corresponding newsletter list. The issue is that is sending one email confirmation per list subscribed, instead of ...
0
votes
1answer
35 views

File read/write methods

I'm using some simple files for caching and some basic user data. I was first just using file_put_contens and file_get_contents, ...
-2
votes
0answers
28 views

Would a latitude longitude coordinate make for a reliable id? [on hold]

Im building a multidimensional array of coordinates and looking to possibly group them by id if its reliable. http://maps.googleapis.com/maps/api/geocode/json?address=vancouver,ca ...
-3
votes
0answers
23 views

PHP how to combine multiple if-statements into one function [on hold]

Currently based on checkbox value,form will add subscribers to corresponding list. Issue: If I select more than one checkbox and submit form, only the first checkbox value is saved. How to merge in ...
2
votes
2answers
45 views

PHP crawler to collect comments on articles

I have code that parses through web pages finds commentaries and saves commentary info in DB. I have an array where all necessary pages are stored. I iterate through all these pages one by one and ...
0
votes
0answers
35 views

Image gallery with pagination using CSS, $_GET, and Bootstrap

I am relatively new to web development and I created an image gallery with pagination using the Twitter Bootstrap framework. Basically, I want to know if I approached creating an image gallery ...
2
votes
0answers
45 views

My Googl URL shortener PHP library

I knocked this together in a few hours as I was just simply bored. I was going to add a namespace to this but decided there was no point. This is also available on Github All feedback is appreciated! ...
1
vote
0answers
13 views

Script to migrate event, artist, and venue information from MongoDB to Drupal

At first I brute forced the migration to just get it finished. However, the procedural program mixed the events with the venues so I rewrote it, this time using classes which I'm just beginning to ...
0
votes
1answer
39 views

Symfony2 (2.7), Embedded Forms, Persist failure [on hold]

I am trying to implement Embedded Forms (Symfony2, 2.7), with a three layers situation: Job, Task and Tag entities, One2Many relationships. So, what I am trying is just to develop a very basic web ...
10
votes
3answers
911 views

Inserting OAuth data into a database

I am totally new to PHP. I just wrote a PHP script for google oauth to pull the data and insert into my database. I don't know if my code is vulnerable to SQL injection. Should I have used prepared ...
3
votes
2answers
31 views

SELECT from “vertical” table and display on “horizontal” table

I have this table in my db: table ---------- cityID value parameterID The table looks like this: ...
3
votes
2answers
61 views

Submitting an HTML form, adding submission to database and emailing the client and registrant

I have been asked to make a registration form that will add a users details to a database, create a registration code, then email the registrant and client the details including the registration code. ...
-1
votes
0answers
19 views

Multiple insert tables in pdo [closed]

I'm working on an project where i need to insert different values in more then one table. Inner join' is only available on a select prepare but i need it on a insert prepare pdo. ...
0
votes
1answer
34 views

SessionHandlerInterface Class

The following class is used for handling sessions: ...
1
vote
0answers
88 views

Does my code still break encapsulation and uses getters/setters instead of the TellDontAsk principle? [migrated]

I and one guy have been discussing potential solution of a problem on an unrelated board, regarding the typical getter/setter hate, ie. using getters/setters leads to procedural programming. I ...
1
vote
0answers
29 views

WordPress - meta description

Here's the code I'm planning to use to power meta description tags for a site in header.php in the template. Is anything missing / incorrect / could be done better? ...
0
votes
1answer
55 views

PHP Instant Message API

I am creating a chat API for Android developers, but it's slow -- the chat app is getting messages a little bit late. How can I improve the performance of my code? ...
1
vote
0answers
19 views

Proper PHP array walkthrough

I am working on a ticket reserving system right now. The users can reserve seats in a cinema for every movie. Whilst my code works, it is not the fastest. When a customer buys ticket (seat(s)) I check ...
1
vote
1answer
54 views

Method on Laravel model to find courses related to a course

I have a Laravel project that has courses. I want to take the related courses from one. Should I create the method in the model (the php class) or in the controller? Currently I have this code in ...
0
votes
1answer
48 views

Application container design

I'm putting together a simple application container for learning purposes, and I would like to hear how you see this code. The application is the main class that will contain services, configuration ...
0
votes
2answers
68 views

PHP Dependecy Injection Container

A few weeks ago, I asked for another DIC review, but didn't get any response (but only for one about my error handling). So I tried to rework my DIC without any outside insight on it, and the first ...
2
votes
2answers
87 views

Selecting data from MySQL using PHP

I have written this file in PHP using MySQL. However, I have a lot of code that looks like it could be simplified. Can someone suggest a way to make this more efficient? i.e. I want to follow the ...
0
votes
0answers
16 views

Filtering potentially malicious user-defined CSS property values using ScssPhp

I have a script that allows stylesheet customization on a per-property basis. For example, I expose the "background-image" property for people to enter their own SCSS values to be entered in the ...
1
vote
0answers
29 views

Use of HTML (view) in a constructor

I have this constructor (from a Service) where I'm setting a few variables, but two of them include HTML. Is there a best way to set those values, maybe by creating a method in the class to set them? ...
2
votes
1answer
55 views

Writing PHP PDO bindParameters

Is there a better way to write this? ...
1
vote
1answer
31 views

Keeping object consistence at its creation

Let's assume I have 2 objects Product and Volume. 1 Product must have at least 1 ...
2
votes
2answers
56 views

Function to combine arrays of associative arrays

I recently create a function to combine some arrays of associative arrays in a single array in response to a stackoverflow question, where you can found more details about this. The function works as ...
0
votes
1answer
56 views

HTML Pagination Generator

I have created a function that helps me generate pagination really easily but I am concerned about its performance mainly. The function accepts 2 parameters: A list of items (has meaning in the ...
0
votes
0answers
36 views

Refactoring smartrecruiters api

I'm currently implementing the smartrecruiters API. It's working but it's so slow. Here's my code snippet: ...
2
votes
1answer
39 views

Using a class to create a custom wrapper for including files

I am using PHP in order to create a custom wrapper for including files, for this I have written this class: ...
2
votes
0answers
41 views

Object-oriented WordPress plugin

Note: This plugin is / was never intended to be submitted to repo just for personal use but the questions still apply to general Plugin Development. This plugin listens for ...
-1
votes
1answer
52 views

Improving PHP Security of Login

One of my github issues is below. I am having some problems with my security, is there anything that I should or need to improve. Here is an example of code that I use, but throughout the script there ...
2
votes
1answer
91 views

Singleton Class for WordPress Plugin

I'm developing a WordPress plugin using the singleton pattern with the following requirements: There should ever exist one instance of the plugin Another instance of the object should never be ...
1
vote
0answers
31 views

Displaying hierarchical comments for movies

I have written a function which fetches all comments for a given movie. Since comments can be nested (e.g. someone replied to a comment) I am fetching them recursively (based on the parent comment ...
2
votes
0answers
38 views

Request handler based solely on reflections ver. 2

This question is connected to the previous one: Request handler based solely on reflections I have edited the code, taking tim's answer in regard, editing the Kernel class cohesion. ...
4
votes
1answer
117 views

Multiple-configurations class for practice and later use

I wrote an abstract Configuration class, then an ConnectionConfiguration class and then an ...
-2
votes
1answer
55 views

Adding tables and values to a database

I am having problems with my code because I am using a system called styleci. Can you please check it? How can I make it better and more secure? ...
1
vote
0answers
34 views

PHP class's errors in different languages

I have a data validation class, which I would like to return errors in many languages. I'm not writing the whole class, just the needed parts as my question only refers to that. ...
-1
votes
1answer
38 views

Laravel 5 controller to list appointments by date range and by label

I am starting to get into OOP using PHP and MVC. I just want to know if this code is good practice. Is this how I should be using my controller and model, in its simplest form? ...