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

learn more… | top users | synonyms

-1
votes
0answers
18 views

PHP - Checkboxes multiple selections [on hold]

HI there straight to the point hopefully it's a easy question My PHP code "mailhandler.php" seems to be giving all my checkboxes on my HTML site to my email showing checked. I want the user to only ...
1
vote
1answer
32 views

Rewriting linked list function without a NULL variable

This is how my LinkedList class looks like in PHP. I am trying to figure out if I can rewrite my reverse_list_recursively() ...
2
votes
1answer
32 views

Printing to terminal in a color

Basically, I wish to have 3 printers to print in error state, success state or info state which means nothing but different colors. ...
1
vote
1answer
61 views

PHP/Phalcon RESTful API architecture

I'm building a RESTful API in PHP using the Phalcon framework. The API will consist of multiple modules (e.g. api.example.com/mail/users, api.example.com/web/users, etc). So I want to put all module ...
1
vote
1answer
21 views

Magento MySQL search based on phone number

I'm building a search for Magento. Magento API doesn't provide an easy way to look up a customer using a phone number so I created a custom solution. My MySQL/PHP OOP skills are limited. Did I miss ...
4
votes
1answer
106 views

Sudoku generator

I managed to create a Sudoku generator but I'll just go ahead and say that it generates 1 out of 500 tries on average. I'd say that's pretty inefficient and I'd like to ask you for advice on ...
0
votes
0answers
21 views

Script which generates time slots with hours and minutes with division [on hold]

So, this is a bit messy script, so I'm wanna say sorry If it may be hard to read. It takes 3 main arguments: starting time(hour), ending hour(hour) and integer which is used for hour division. eg: ...
-5
votes
0answers
37 views
2
votes
1answer
74 views

PHP Register Form - OOP

I'm trying to build my first object oriented system. I'm not sure that my register function below is the best way of approaching this within OOP. ...
2
votes
1answer
45 views

Road tax data parser

I'm making a data parser for road tax data (costs) which parses a JSON file with all weird variable names, which the customer gave me. The costs are different on each vehicle type. The costs at some ...
4
votes
0answers
54 views

Registration form with validation and error messages

I've been working on a registration form page in jQuery Mobile and I think I'm starting to get it fully complete. What I need feedback on is if I've forgotten anything in terms of accessibility, ...
1
vote
1answer
49 views

Button to follow / unfollow a user

As a beginner in coding, I have just written this code. The code should Add a form with a button to each user profile, it named Follow or Unfollow. It updates the user meta named "following" for the ...
1
vote
2answers
67 views

Is this a correct implementation/interpretation of the “Birthday Problem”?

I recently wanted to determine the probability of generating a colliding string, given a character pool size, string length and number of strings to generate. I was led to the Birthday Problem, and ...
1
vote
2answers
60 views

Safety of contact form

I have made slight edits to a simple PHP contact form that I have found online. Can you see anything else that I could do to ensure that I am protected from email injections and spam? I have used ...
0
votes
0answers
31 views

View for getting and displaying data

I have code that displays the data that it gets. However, because I could not think of a good way to do this I have ended up putting most of the back end in to the view. Just a quick note about the ...
1
vote
2answers
50 views

WordPress: multiple loops

I have two loops on my page - each with their own category. It works, but I don't know if this is the best practice as I'm pretty new to this stuff. ...
3
votes
2answers
64 views

Password generator

I am playing around with CCS/HTML/PHP and created a password generator: ...
0
votes
2answers
41 views

Remove parameters from string containing URL

Is this the best way to remove URL parameters from a string containing an URL? ...
2
votes
1answer
50 views

Optimizing pagination of HTML tables

I'd like to share my implementation to you to confirm if it's a correct way to solve my problem. I have a list of products which have an attributes table and a description table (both in html_encoded ...
1
vote
1answer
44 views

Are nested foreach loops to compare two multidimensional arrays efficient in PHP?

I've got the following PHP code, which is taking a search term, and checking if any of the search terms could be or could have a nickname. ...
-1
votes
0answers
20 views

Stylized HTML table with vertical scroll inside tbody [migrated]

today I experimented with HTML tables and populating them from a MySQL database. My code worked well for what I needed and as is the table looked something like this: ...
1
vote
1answer
47 views

PHP Factory Method Pattern Implementation

This is an attempt at the Factory Method Pattern It emulates the logical model and also the physical model Resources: http://en.wikipedia.org/wiki/Factory_method_pattern ...
1
vote
0answers
49 views
0
votes
1answer
63 views

Factory Pattern Implementation in PHP [closed]

I have read some articles regarding the factory pattern and decided to write some code as an exercise. This is my first attempt and am not 100% if I did it right. I've omitted some implementations for ...
4
votes
1answer
71 views

PHP & AJAX live chat - alternative ways

I am trying to implement a live chat for my websites visitors. Currently I am using the code that you can see below - a PHP script that processes in background and that is called by AJAX. I am not ...
2
votes
1answer
38 views

Get all the PDF files from FTP server in different folders

Well, quite a biggie with all the foreach's. It works, it gets me 981 results, but there must be a way to shorten this code. Right? ...
2
votes
1answer
40 views

Uploading images via MySQL in Blob

Is it safe to upload images via MySQL in Blob? I've constructed my code like the following: ...
0
votes
1answer
74 views

OOP PHP best practices

I've worked with PHP for a few years now and have a degree of understanding about classes / objects, but I've never written my own until now. In that vein then, I'm looking for a bit of confirmation ...
1
vote
0answers
29 views

PHP MIMEType class

There isn't a very reliable way (in my opinion) to get the mime type of a specific extension, regardless of the file actually being of that type or not. This type of thing usually is used when ...
2
votes
1answer
71 views

Securing a form with image uploads

I am using PDO prepared statements to store user entered input and store that input to the database. The code will store a text input and 5 uploaded images. Will this code protect from data SQL ...
2
votes
1answer
64 views

UnitTesting: Is this TestCase overkill?

Is this Test Case overkill? I am new to Unit Testing so I am learning and I'd love to hear your opinion about it. ...
1
vote
1answer
33 views

Handling errors when using PDO to connect to a database instead of MySQLi

What would be the preferred method for handling errors when using the PDO to connect to a MySQL database? I was using mysqli_error($this->pdo), but I heard this ...
2
votes
0answers
37 views

Dijkstra's algorithm in PHP

This is Dijkstra's algorithm in PHP. About the data structure, I use a 2-dimensional array "$_distArr[m][n]=length" to store it. Is there any improvement for this? $a & $b are the start and the ...
3
votes
1answer
126 views
+100

Data model in MVC for multiple providers

I have constructed an API service that dives into a storage engine and retrieve data. I have tried my best to apply the MVC modelling with services (repository) in mind where the controller (as it ...
2
votes
1answer
33 views

Uploading multiple images using PHP

I literally spend all day working on PHP and I think I figured it out, but I need some reviews in order to make my code secure & okay. I am asking you about functionality here. The code below ...
4
votes
2answers
101 views

Protect from people bruteforcing the PHPSESSID

The PHPSESSID is stored in the clients cookie so I don't consider it as secure. Someone might bruteforce it and perform some action (like a Facebook status post) whenever a session was successfully ...
3
votes
2answers
83 views

Programming MySQLi prepared statements

I'm programming code with MySQLi prepared statements. I'm a beginner and just want to ask to experts if my code is correct. ...
1
vote
1answer
28 views

Navigating calendar by week

I started actually learning a little programming last year, as opposed to just hacking away at libraries and found fragments. For a WordPress plugin I needed to navigate through weeks, which I ...
4
votes
2answers
138 views

Simple PHP Login Register Script with OOP

I am relatively new to programming and OOP in PHP. I tried to create a Simple Login Register Script using my basic knowledge of OOP. I'm sure my code can be better in a lot of way. I'm trying to code ...
2
votes
0answers
53 views

Simple encryption with PHP 5.5

I want to do simple encryption using PHP 5.5. By “simple” I mean I want to use native PHP functions. I have created this code that works, can it be improved? It's to encrypt/decrypt strings and binary ...
3
votes
1answer
66 views

PHP associative array with two properties

I'm moving a system over to PDO and since the queries are parameterized, I need to specify both the type and value of each parameter when preparing them. Right now I have a ...
3
votes
0answers
38 views

Instagram-like news feed display

I am writing an application that shows a news feed, much like Instagram. For this, I have a function in the model to select the feeds as shown in the code. For some reason, this runs quite slow and I ...
1
vote
1answer
58 views

Passing multiple JS arrays to PHP via data mapper

I'm making a project to calculate road-tax prices based on a vehicle's weight, type and vehicle's owner's province. For that I've received data in 9 different JavaScript files, all those files ...
1
vote
1answer
36 views

Object instantiation with multiple parameters

I'm trying to create a little block presenter for Laravel which displays blocks of content in certain positions. I have 2 classes, BlockFactory and ...
3
votes
3answers
134 views

Improvement of a regular expression pattern

I created this script to take informations "at-the-moment" of this site: Pictures of name channel Name of channel Pictures channel Times Title Type My script ...
3
votes
1answer
54 views

Making user login system secure with $_SESSION [closed]

I am hoping that someone can help me out here. I am creating a PHP web app that requires a user to login to view their data in the MySQL database. I just want to know if this is a good approach and ...
6
votes
2answers
53 views

Pastebin replica

Here is the class I'm using: ...
1
vote
0answers
38 views

AI for an online contest

I'm actually creating an AI for the online contest Vindinium. The fact is that's also an exam for my school because I'm going to have a note with that work. I created an AI based on ants pheromones ...
5
votes
1answer
123 views

Swift project using PHP web service

I was hoping for someone to review my current project, which was created in Swift and uses a PHP web service. I'm not worried about UI elements, as this is just a 'test' project, but I'm concerned ...
2
votes
0answers
61 views

Programming with PHP & jQuery

I'm programming a system and I want to know if this is the correct way or if there are a better way to do it. Container: I have more fields but I only added one to show you the container. ...