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

learn more… | top users | synonyms

2
votes
1answer
16 views

php/html template for checkout

Basically I am in argument with my colleague, I say this template (view) has to be fully refactored and all instances of duplicate code has to be removed. He disagrees and don't want me to touch it. ...
3
votes
2answers
21 views

“Remember me” automatic login

I've implemented a "remember me" automatic login if no session has been set, but a remember me cookie is on their computer. I'm concerned about security and I'm not the best. I'm relatively new to OOP ...
-1
votes
0answers
22 views

Proper class user.php

I'm learning to program with PHP, so I ask your help to check if my class user.php is ok. ...
1
vote
2answers
21 views

Correct syntax and improvement account.php file

I wanted to ask your opinion about my code created for acccount.php page for editing the data of each logged-in user. I wanted to have more of an opinion on your right syntax, though maybe it could ...
4
votes
1answer
27 views

PDO connector class

I have created a DB connector class with PDO. Do I need to add, delete or edit anything in this code? ...
2
votes
2answers
35 views

Validating user credentials and logging into a Symfony site

I have the following code in a Symfony site that validates a user's credentials and logs them in via the Session class: ...
1
vote
1answer
34 views

Merging two multidimensional associative arrays

I just wrote a function that will loop through two multidimensional associative arrays and merge them together based on the key names and their values. While I'm satisfied that this function works, I ...
3
votes
2answers
319 views

Web dashboard using many REST API requests

I have created REST API in codeigniter. REST sever created in codeigniter 3.0 and REST client created codeigniter 2.x.x. I have wrote simple code for login. After login client created dashboard ...
5
votes
1answer
44 views

Multilanguage class that detects and sets language

I have been learning object oriented programming for quite a while. I understand many concepts about it but I quickly realized that I made a big mistake just reading theory and not doing any actual ...
0
votes
1answer
26 views

Toggle-able checkbox custom post meta

I have created a basic checkbox custom meta box in order to set a post as "featured". ...
-1
votes
0answers
36 views

Laravel 5 package structure

I'm new with laravel and created my first package, which is a simple cms system. The package is nearly finish and I want to know if I followed the right conventions. What did I wrong (in the code or ...
2
votes
2answers
35 views

PHP Dynamic QueryBuilder function - Security

This function is a working function, which builds a number of queries depending on the values of $_POST. ...
1
vote
1answer
29 views

Class to create dynamic php + mysql queries (safely)

I've started to learn PHP classes, interfaces, extends and things related to those. Before this i've worked only with functions and it started to be quite a mess with hundreads of separate functions. ...
-1
votes
1answer
14 views

Adding loop inside diffrent class Div [closed]

I was wondering how to put loops in separate div's , Ive tried to make like code below but getting error. ...
2
votes
1answer
47 views

OOP shortening class

This is not so much a question about execution as it is a question about improving code. I am a 2nd year student, we started to touch on OOP recently and I am finally getting the hold of it....sort ...
3
votes
1answer
44 views

Displaying a 0-7 ratings graph

I store ratings in a table called ratings. The table has these columns: id | user_id | value | ip | showcase_id value is ...
3
votes
1answer
47 views

City and District class examples for teaching OOP in PHP

I wrote these two classes for teaching OOP in PHP. Do you think it's breaking some good practices or SOLID principles? ...
3
votes
2answers
53 views

Read a config file into an array

I just wanted to know if this looks like a good way of reading a config file. Is this code good? Is it clean and easy to follow? ...
2
votes
1answer
43 views

Simple calculator in PHP utilizing MVC

I have been struggling with understanding Model, View, Service, Controller architecture and wrote some code. Is my Model class the Model part of MVC (did I define ...
0
votes
1answer
113 views

CRAP index (56) in Web Scraper Engine

I am working on a Web Scraper for the first time using Test Driven Development, however I have caught myself into a huge CRAP (Change Risk Anti-Patterns) index (56) and I can not seem to find a ...
1
vote
3answers
33 views

Navigation script and template

Overview: I'm using the following page template and scripts for navigation. I use a single page that loads menus and context content, and then use ajax or GET variable to load main-div's content, by ...
3
votes
3answers
73 views

XML parser using PHP

It is just one of the files. I have also tried to write some tests using PHPUnit. Please give me some suggestions to improve my coding-writing skills. The below is the test file for the above file: ...
3
votes
1answer
55 views

Possibility of SQL Injection

I am requesting a review of a portion of a 600 lines of code. This portion of the code process a filter that is farther down the page. It takes in the parameters and formats them into a query. Now I ...
2
votes
2answers
42 views

splitting multiple joined words, port from perl to PHP

Though i have never worked on perl, not even once. I have ported the perl code into PHP and it seems like giving a correct result. But as I am going to use it on production server. I want this code ...
4
votes
1answer
495 views

Persistent login (“remember me” cookie) using PHP

The code below is a attempt to create a persistent login cookie. I am an amateur and not professional so this is the first attempt to have secure remember me cookie. Now I want you guys to review two ...
-6
votes
1answer
49 views

I my code is vulnerable to sql injection Its hardly coded? [closed]

Is my code is vulnerable to sql Injection.It is hardly coded ...
1
vote
2answers
56 views

Basic template engine

I wanted to know how I can improve it. I mainly want to look at speed and performance, but if there are any improvements please give a suggestion. ...
1
vote
1answer
31 views

OPP Sign In/Out procedure in PHP

As a self-taught student of Web-Development and Web Technologies, I created a simple sign in/out form in PHP, just for practice purposes and some fun! I read the O'reilly's book about PHP and I found ...
3
votes
1answer
45 views

PHP Configuration class

Created this little config class, any room for improvements? Think I have done an alright job but would like to know if any improovements could be made? ...
4
votes
1answer
94 views

PHP Route class

I was trying to keep it SRP. I'm new into PHP OOP and I'm wondering how I can make it better. Route.php ...
2
votes
1answer
76 views

Beginner PHP calculator

I've spent the last few evenings learning PHP, CSS and HTML through Codecademy and now on Team Treehouse. My goal is to progress with PHP over the next year or two and perhaps obtain Zend cert. ...
8
votes
1answer
38 views

A Dockerfile for Composer (a dependency manager for PHP)

I recently built a Docker image for Composer. I'd love to get a review of the image, the Bash based wrapper script, its recommended use, and the repository structure. Here's the Dockerfile for the ...
3
votes
1answer
37 views

Using a separate class in Symfony to handle a list of entities with controller injection

In my Symfony (v2.7.9) project I have a set of entities which share some view functionality i.e being displayed in a table with some of their values as columns. Following the separation of concerns ...
4
votes
2answers
43 views

Better way for securing direct access to php files

I don't know if this method uses a lot of time to process, or if it is bad but I wanted to know if there is any better way of actually doing this? I have a few class files that I want to stop users ...
1
vote
2answers
44 views

Small PHP CMS base

I am a bit worried about this small PHP base as it has been running a bit slow. Can anyone notice anything majorly wrong with it? root/Index.php: ...
2
votes
1answer
25 views

XHTML input for PHPmailer

I have used PHPmailer to send email to users upon registering to the site. Now, everything works as should, however, I find myself doing painstaking work adding the HTML elements in. Here's an ...
1
vote
2answers
41 views

Rendering drop-down boxes for country and region

In PHP how can I follow the DRY (don't repeat yourself) principle in this piece of code? The 2 classes in question share an awful lot of code. ...
1
vote
1answer
37 views

Product inventory database

I just finished writing a program which working with a database. Throughout the process when working with people to get past some of the hurdles I faced I was ridiculed for my SQL statements. I have ...
1
vote
1answer
38 views

Form submit and data display

This is my first PHP project - just to write to something to learn from. I made a page with form to send some quote to server and display some quotes from db. I'm just starting with PHP so point out ...
3
votes
1answer
45 views

Prepared PHP statement to fetch posts for some category

I am slowly learning PHP and have been using prepared statements. I have a simple category.php page, which takes a category tag to display posts from that category, such as ...
3
votes
1answer
54 views

Success page + data entry for a store page

The purpose of this code is to log the inputs of a form (which is a menu for a shop) to the database to be kept as records as well as printed out as a receipt at the store. I have been learning how ...
3
votes
1answer
58 views

Checking if a student ID is present in the database

What I need to do is fetch the XML link using curl then get a student ID and check if the ID is present in the database. If yes, then I need to get other details from another database table. My code ...
0
votes
1answer
40 views

I'm not sure if my query is safe or I need an extra step to sanitize data

I'm not sure if my query needs extra steps to sanitize data to prevent SQL injection. If I use $wpdb->get_results($query), do I need to ...
1
vote
1answer
62 views

Home page (index.php) of a website for finding products

My code is basically the home page (index.php) of a website for finding products. It accesses a database table to get a list of all countries and then populates a ...
-2
votes
1answer
78 views

Database and user classes for my personal CMS

I have written my own CMS for learning, and have included all of my core files below. This is my first time playing with OOP and prepared statements, so I imagine there may be alot of changing. There ...
3
votes
1answer
90 views

Validating a model that requires database access

Let's say I have this User model: ...
1
vote
1answer
58 views

Making a lot of requests with MySQL while trying to keep good performace

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
48 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
50 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 ...
1
vote
1answer
36 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. ...