Tagged Questions

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

learn more… | top users | synonyms

0
votes
2answers
35 views

Is this system of text protection reliable?

I've got a text I don't want to be copied by users. To avoid that, I'm using this code: index.php ...
0
votes
1answer
23 views

Implementation of a URL router

I was wondering if you could provide some feedback on this Router class I built. Worth noting that it relies on an Apache rewrite rule that always redirects to this file, but passes the path into ...
0
votes
2answers
41 views
1
vote
2answers
45 views

Combining two arrays using nested foreach loops

I have the following arrays: ...
3
votes
0answers
29 views

PHP/PowerShell Active Directory Password Changer

I have written this Active Directory password changer script. Comments and testing is appreciated for things I may have overlooked, since this is my first AD Script. There are two parts: PHP and ...
2
votes
2answers
42 views

Social network message board website security

I have a script that contains functions from login in to posting status to friend request send and receive. Pretty much a social network script. Anyways i think my security is not up to date so if ...
3
votes
3answers
54 views

PHP Bilingual Error System Ideas

I am building a php based mobile website that must be in both Spanish and English. This is my first bilingual site so I've been having to re-think a lot of coding practices I currently use to ...
4
votes
2answers
1k views

Possible SQL injection vulnerability searching for a product by ID?

I want to be sure that this isn't vulnerable to SQL injection. If yes, then how can it be improved? ...
0
votes
2answers
49 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
5
votes
1answer
77 views

Building navigation structure for multiple users by adding values to multiple arrays at once

I have a multidimensional array with associative values... I want to add some information to multiple arrays at the same time. Doing $array1=$array2=array(... seems ...
1
vote
1answer
39 views

Concatenating 2 array variable names to create a new variable name

I'm developing a room booking system using PHP for a school project. I'm trying to create a variable name by concatenating values from two arrays together. here are the two arrays: ...
5
votes
0answers
64 views
+100

UIntArray class in PHP (part 2)

This question is the follow up of the question: UIntArray class in PHP @Brythan provided a really nice review and I have improved my class. I have addressed almost all the issues he pointed out ...
0
votes
1answer
45 views

Including a page specified in query string

This is how I include a page depending by name. Example URL: http://www.page.com/index.php?page=admin where ...
1
vote
2answers
41 views

Safety of globalizing config data

I have some framework in PHP/MySQL for developing web services. Finally my code works on two servers - production and developer. My idea is to create one code without differences, which will work ...
2
votes
0answers
29 views

Content management system for teaching PHP OOP to beginners

I created this basic content management system to teach object oriented PHP to beginners. However, I have concerns if I violate solid principles in App.php and Router.php. GitHub App.php: ...
2
votes
1answer
57 views

Is this the right way to handle Exceptions in PHP?

I'm using the function countLikes() to fetch URLs' Likes count from the Facebook API. ...
-1
votes
0answers
13 views

PHP or Jquery code to parse a string [closed]

i need to parse following string using php or jquery. ...
0
votes
2answers
29 views

Looking up the name and event for a ticket

This code is from my Kohana project. How can I make it more beautiful? Should I use try-catch instead? How could I avoid writing exit() twice? ...
1
vote
2answers
69 views

Removing stray brackets from in between shortcodes

I was wondering if someone could point me in the right direction for cleaning up this code. WordPress uses shortcodes in the form [shortcode] to add extended functionality to posts and pages. What ...
0
votes
1answer
42 views

Product page filter

I am still learning Laravel and I am in the process of creating a small shopping website. On the left hand side there are a series of filters that appear depending on what products have come back ...
1
vote
1answer
58 views

Light, custom CMS for a site

I'm working on a light, custom CMS for my site and I am trying to use Ajax calls for most of the server-side interaction. I am still pretty new to web development, so if I am breaking any conventions ...
1
vote
0answers
38 views

Parsing multipart/form-data in php for PUT requests

I have recently found that I needed to be able to parse multipart/form-data for PUT requests made to my REST API. This allows batch photo uploads, which has been a requested feature. As we all know, ...
0
votes
1answer
21 views

Detecting headers status takes too long

I have a table in my database with 35000 unique URLs. I use them to create my XML sitemaps for the site. I have setup crontab jobs to create automatically new URLs, delete non existing URLs and ...
0
votes
1answer
41 views

Image manipulation PHP class using PHP's Image Functions

I am working on an image manipulation class for a project to re-size uploaded slider images to 780 X 397 and uploaded avatar pictures to 220 X 220. I am wondering if this is a good way to construct ...
4
votes
2answers
80 views

Calculator using PHP with logging to MySQL database

I have made a calculator in PHP and I need some feedback in terms of security and performance or any other general improvements. You can download a zip file with all the contents from this link if ...
1
vote
0answers
55 views

Security of blog system

I just want to know if my PHP code is secure and if it's as clean as it can be. I'm trying to make a blog system and I want to make sure all my users information is safe and secure, although this is ...
4
votes
1answer
285 views

Handling views and templates

My guts tells me that this isn't the proper way to handle views / templates, so that's why I'm asking you what could be done better. Some background: This application I'm building now is for use in a ...
-1
votes
0answers
22 views

Why are both error fields showing in my forms? [closed]

I have two forms on a page, both with their own message handling. I use three $_GET variables to determine which form shows the message. The problem is that both ...
1
vote
0answers
29 views

Safely include requested pages without a whitelist

Is this pretty safe from breakout attempts? I'd rather not make a whitelist and check if the requested page is in the array since theres a ton of pages. And I wanna keep it clean. So I'm looking for a ...
0
votes
2answers
39 views

Input check class

...
2
votes
1answer
71 views

PDO PHP DB Class

I've been building a PDO PHP DB class and I just wonder if someone could give me some feedback (regarding security, how the code is written and how I can optimize it). This class is not finished ...
2
votes
2answers
48 views

Querying multiple tables to pull data to show to the user

I have a function that I use to display a relatively large amount of data to the user: ...
3
votes
1answer
109 views

PDO wrapper class for database

I have my PDO Wrapper class and would love to get some more tips/opinions about what you think. This is my first class and I basically put my time into making it as logical and standardized as ...
0
votes
0answers
79 views

Possible improvements script that receives, formats and data persists

The code snippet below, receives data from a form, formats and inserts into the database. This code snippet is located in a controller and the insertion is done in a 'repository' to manipulate data ...
1
vote
0answers
31 views

Why is entangling injectable with class that uses it a bad practice? [migrated]

I have had this argument for a while, because I have noticed some people prefer "readable" code over properly structured one. So in the example I am showing, basically I have this ...
4
votes
2answers
78 views

Find minutes with no data in database

I'm trying to show a table, for each ID, to see if there is data available. In this case, its measurements. If there's no data, that means the logger isn't doing its job properly. I currently have ...
3
votes
1answer
63 views

Enhance CSV file database import

I'm using the script below to import a large .csv file to my database. If the table is empty the process takes about 5 minutes to finish on a local machine. If I'm using the file to update existing ...
2
votes
1answer
79 views

Script for a multi-user webapp database connection

I have the following working script which I use for my database connection for a multi-user webapp. I use a different database for the login, this script is called only after the user is successfully ...
0
votes
1answer
49 views

Reduce/Optimize repetitive code

I have 3 repetitive sections in my code, how do I refactor them? The differences are only in SQL query and in the foreach loops. ...
2
votes
3answers
92 views

Just require a file, or check if_readable first?

I'm writing a simple front controller, index.php is the main file. In my index.php, first thing loaded is ...
9
votes
1answer
138 views

UIntArray class in PHP

I have seen UInts being natively supported in other languages. PHP allows you to install a third party extension, but I can't do that ATM, so I've decided to create ...
1
vote
2answers
69 views

Backing up an entire website with PHP

I'm attempting to backup lots of website using this php code. The script basically goes through the whole public_html directory and adds all the folders and files recursively and zips them. Here's ...
2
votes
1answer
86 views

Validating email addresses and phone numbers

I have following code and I need need help refactoring: Validation class for objects you may create: Email address URL Norwegian Mobile Number (must start with 4, 9 or 59 and be 8 digits long) ...
1
vote
0answers
50 views

Email ticket system

How better to refactor nested if-blocks? ...
4
votes
1answer
50 views

Passing data between themes and the page settings

I'm designing a small CMS with best practices I learned. I came to this conclusion when comes to including page content and themes to each page depending by user or whatever. But how could I make ...
3
votes
2answers
72 views

Auction function for a game

This is an auction function for a game where you can bid on houses on the website. You set a limit, and if posts limit below current bet or below your limit, it will raise the bid from current plus ...
8
votes
4answers
295 views

Simple PHP Validation Routine

I have created a simple validation routine in php and i'm wanting to make sure I am doing things efficiently.... ...
1
vote
1answer
41 views

When should I call set_exception_handler with this exception handler class?

This is a simplified version of ExceptionHandler.php: ...
3
votes
0answers
66 views

Laravel Testing: Is this testing too much of the inner workings?

So I'm using laravel for a project and have a InvoiceRepository and a InvoiceRepositoryTest and I have written the test first ...
3
votes
1answer
67 views

Getting a value from a database table dynamically

I am trying to create a forum using php in a MVC architecture. This is my database setup: Table: forum_categories ...