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

learn more… | top users | synonyms

0
votes
0answers
4 views

How to load this javascript without interval [on hold]

I have create a round clock but its load more how to solve this? my code: ...
-2
votes
0answers
33 views

Beta login api without passwords

In present day, people are asked more & more for new and more difficult passwords all over the web. To be honest, in my case, it is becoming a real struggle to remember all those passwords and I ...
3
votes
1answer
27 views

Autoloader class for PHP

I created a class that I plan on using to autoload my project classes (20-30 classes) maximum. I wonder if there is anything, anything at all, that I can improve on this class to improve it any ...
3
votes
0answers
31 views

MySQL connection using a static connection

I have been using a static class to connect and retrieve information from a MySQL database and also reading about how static works in php. I'm still not sure if the code is bad or not and why (besides ...
2
votes
1answer
28 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
37 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 ...
0
votes
0answers
42 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
28 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
30 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
43 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
35 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
332 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
37 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
36 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
15 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
45 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
54 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
114 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
76 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
50 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
33 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
46 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
95 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
78 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
39 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
45 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
46 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: ...