The fifth version of the PHP: Hypertext Preprocessor (PHP) scripting language. It features the Zend Engine 2, better object model support, and many other improvements over PHP 4.
1
vote
0answers
10 views
Application Class Security
Is my Application.php class secure for continuing development?
The Application.php acts as a registry for the whole application. I tried not to rewrite already working code that is being pulled from ...
7
votes
5answers
10k views
Database class using PDO
The point of this question
I'm actually using it while developing a simple application and it seems to cover all my needs. Also it uses PDO so that we don't really have to worry about SQL Injection. ...
7
votes
2answers
117 views
PHP isset over use? Good or bad?
First, I'm in no way an experienced PHP coder. This is my 5th time working with PHP, so if you see anything that can bee improve, please point them out for me.
I have the code checking for the ...
2
votes
1answer
186 views
Trying out my first User Registration script
I am trying to write my first script that checks users against a database (MySQL right now) and if they aren't in the database, registers them. I've tried my best to sanitize and validate the form ...
7
votes
2answers
87 views
How is my injection protection?
What do I need to do to prevent injections? In addition, if I have any statement/parameter errors, please tell me.
...
4
votes
2answers
61 views
Optimizing cron job for sending reminders
The following script is being run with a cron. It runs once a minute to see if there is a reminder that needs to be sent.
Should I make this run once every 30 minutes? The choices to send a reminder ...
5
votes
1answer
39 views
Secure Functions in a Database Class
I am trying to solve as many issues as possible with my Database Class and bind statements as far as possible without actually doing it in the front-end. The goal is to do all of the heaving lifting ...
6
votes
2answers
123 views
My database class extends MySQLi
The following is a small class I extended MySQLi with. I'm going to use this in my upcoming projects, but my main reason to do this class is learning, so I would like to submit this for your review, ...
2
votes
1answer
3k views
3
votes
2answers
893 views
PHP spell checker with suggestions for misspelled words
I built a simple PHP spellchecker and suggestions app that uses PHP's similar_text() and levenshtein() functions to compare words from a dictionary that is loaded into an array.
How it works is ...
11
votes
4answers
2k views
Looking at this tax calculator, would you say I'm an OK coder?
Looking at this tax calculator, would you say I'm an OK coder?
I just created this during a live screencast. The people who were on there were very critical of almost every line of code. They say I ...
1
vote
1answer
75 views
Codeigniter ActiveRecord Wrapper Model
Can someone help me refactor this to be more optimized? Performance seems to be very optimal, but I think more can be squeezed from it.
...
3
votes
1answer
59 views
advantage of using __call method
I have wrote simple class that allowing database selection and inserts.Could you please tell me does this a right way to use __call method with any useful advantage of it ?
...
3
votes
2answers
68 views
Secure row insertion using a position-based prepared statement
I have the following function to insert a new row into a table:
...
1
vote
1answer
336 views
Validating forms data
Here is a class that I made to validate forms data. I will really appreciate any criticism and hints.
...
1
vote
1answer
164 views
Loading module to a templated page
I am trying to create a web app (CMS) as part of my research project, and I use the code below to load modules into a page. Please review this code.
...
2
votes
1answer
73 views
Optimized solution for a rolling dice code puzzle
I was asked to provide the solution of this rolling dice problem in an interview. When I showed him my solution, he said that there is another way to find the solution. I am looking for answer in PHP ...
3
votes
3answers
80 views
Inline PHP IP access log
For a website, I've got some inline PHP, posted below. It's supposed to log traffic to the website, and it does its job fine. But at the end of the day, I'm not even close to a PHP developer, and ...
1
vote
0answers
415 views
Script taking too long for curl request
The below script takes the list of provided url's and scrapes the present links in each url and for each scraped link fb share, ...
2
votes
3answers
147 views
PHP spl_autoload_{x} class
Having spent years writing procedural PHP (albeit with a moderate understanding of OOP from Java) I took the plunge and have attempted to write an autload class for my PHP applications.
...
5
votes
0answers
55 views
Filtering queries based on the current user state
I have a Symfony2 project. I have an Entity Asset which can have relations with Category. I store a ...
4
votes
2answers
195 views
Initializing a variable with a function reference (PHP)
I'm working on an old PHP website, and NetBeans is complaining about an uninitialized variable. I'm seeing some code like this:
...
1
vote
1answer
53 views
Class that handles header and footer includes looks like a mess
I tried making a class that handles my header and footer of my site. It looks like a mess, because I like to preserve the indentations as is.
But I'm wondering if there maybe is an even cleaner or ...
1
vote
0answers
151 views
Combine and minimize all .js files in parent folder
I'd appreciate some feedback on my latest PHP script. It is supposed to work like this:
When obtained, it checks whether the cache is still up-to-date
IF YES, return the cache; IF NOT, reset the ...
1
vote
2answers
503 views
Securing an Image Upload Script
How well does this code limit security problems when uploading images to the server?
...
8
votes
1answer
175 views
PDO sign up function inserting data into multiple tables
This is a sign up function called on form submission. It firstly inserts key user data into the users table. If successful, secondary data is then inputted into ...
6
votes
2answers
387 views
Any way to improve the performance of this PHP class?
I have been developing this class, and was wondering if anyone had any thoughts on how I can improve the performance of it.
...
3
votes
1answer
492 views
Cookie Management Class
I wrote this class to make cookie management easier.
I know it makes use of serialize(), but I have no intention of storing very much data in the cookie, and it ...
1
vote
1answer
47 views
Optimising and consolidating multiple PHPMailer functions
So the two functions below both send emails via PHPMailer but both hold different messages (which use different data from the db). I was just wondering (as I plan to use PHPMailer more) a way to ...
3
votes
1answer
87 views
Receive array of data and access employee info fields
This method receives an array of data and does some stuff in a database. I need to get some reviews on it if possible.
...
6
votes
2answers
226 views
Some tips on a CodeIgniter Model I am building
Can I get some pointers/critique/comments on the following model? (p.s. performance seems great... tested all methods up to 10,000 records)
...
3
votes
3answers
650 views
Any simpler and more efficient way of writing this code?
I've noticed I've got quite a few repeated lines in my code.
...
3
votes
1answer
58 views
Return current URL
I was unable to find how to get current URL so here's what I've made. Brief tests didn't reveal anything bad. Your thoughts, educated opinions, suggestions, and comment on potential bugs or ...
1
vote
0answers
45 views
Split large import task into smaller subtasks
I have a large import task that runs as a cronjob and I want
to split that task in smaller subtasks. Each subtask should be handled by
an own class.
At the cronjob entry point I prepare the ...
5
votes
1answer
1k views
Using ZF2 Event manager to save a model
I have been reading about ZF2 EventManager for some time now and I wonder what you'd think about this approach.
...
10
votes
3answers
257 views
Listener/Observer Model in PHP
I've taken a look at the SPL Listener/Observer model but found that it doesn't work when using static methods. So I wrote my own but it's very simply. Can anyone suggest ways to make it more like the ...
1
vote
0answers
42 views
Modular dynamic based routing with wildcards
I've created this router for my framework and wanted to get some feedback on if it's the most efficient way to search the routes.
The main router
...
2
votes
1answer
89 views
“Property Container” design-pattern
I've tried to write my Property Container design-pattern implementation.
Could anybody, please, tell me, if this code is really what I intended to write (follows ...
3
votes
1answer
89 views
Arithmetic quiz using PHP5 and mySQLi
I would very much appreciate a general review of my PHP code which grabs information from a mySQL database and also inserts some information into the database.
Overview :
Users go to /main.php and ...
2
votes
2answers
62 views
Is there a better way to combine these arrays?
Is there a better way to do this kind of array combination with a PHP native function like array_combine? I'm trying to improve my skills, and at certain points I ...
1
vote
1answer
74 views
Is this a sensible form iteration pattern for a web form with an unknown number of fields?
I'm designing a small intranet-based time-tracking web app that accepts an unknown number of data "rows" which each consist of 7 form fields. Rows can by dynamically added by the browser.
Can I do ...
2
votes
1answer
58 views
How to deal with some of the dependencies?
I am very beginning in PHP and Design Patterns. I have been studying the beautiful book "Head first: Design pattern" and I have been working in some of the codes originally presented in Java in order ...
5
votes
2answers
164 views
Is this a good object oriented design for a file validator?
I'm working on a module that downloads a file saves it then validates if the file contents are valid.
For simplicity lets assume that the file consists of 3 segments: Header, Body & Footer.
Now ...
23
votes
7answers
2k views
is_numeric_array() is missing!
I found that in PHP (or I probably can't find it) a proper is_numeric_array($array) function is missing. So I created one. The problem is that I don't think it's ...
4
votes
2answers
70 views
Parsing record-jar format in PHP 5.3
Here is a simple function I wrote to parse record-jar data. I need it in a php5.3 application to validate bcp47 language tags. It converts the language subtag registry among other things, into a ...
3
votes
3answers
351 views
MySQL connection class
I am trying to learn OOP using PHP5 and I wrote a simple MySQL connection class. Please take a look and give me some feedback on better practices, critical errors, and any other feedback you can ...
1
vote
2answers
140 views
Class that runs a query
I have made this class that runs a query. I want to optimize my code and want to have some expert advice.
Here is the class:
...
3
votes
1answer
177 views
Performance of loading fields
I wrote a class with this function. Can I improve my code performance in the bottom of the function? I don't like the while loops!
...
0
votes
0answers
267 views
Script is extremely slow to display results
I have this PHP script below that requests data from the Twitter API and then displays it on the page according to the information that I have in my local database because I stored twitter usernames ...
2
votes
1answer
188 views
What to do about this horrendous code?
I'm an experienced developer myself but for a current project I am working on I have decided to hire some developers to develop a mobile app which requires some supporting web services (developed in ...