PHP is a widely-used, general-purpose server side scripting language that is especially suited for web development.
0
votes
2answers
21 views
How to optimize a function to get user quota stats?
I have the following function to collect quota information for the given user and return the information on a "ready to use" array:
/* Get User Quota Information
*
* Prepare and array with the ...
0
votes
1answer
46 views
how can I improve the check name file part
/**
* Upload has a limit of 10 mb
* @param string $dir $_SERVER['DOCUMENT_ROOT']
* @param string $path Path do you want to upload the file
* @param string $filetype ...
1
vote
1answer
31 views
Basic PHP MVC setup for form submissions
I'd like your thoughts on this basic implementation of MVC. The view outputs a form, and when the page is loaded, the controller checks for a form submission and then updates the model accordingly. ...
0
votes
2answers
64 views
Proper usage of OOP PHP
I am new to the OOP world I have been reading as much as I can about it and have never been more confused. I understand that its great for organizing code and making it more maintainable, etc. I have ...
2
votes
1answer
42 views
Optimize PHP and MySQL with PDO
I am updating some old reports that are using mysql_ statements and trying to use the MySQL PDO stuff. I was told that PDO is far better since I was running into runtime issues with some of my ...
0
votes
2answers
74 views
My simple CMS system - security and code obscurity?
I'm working on a simple CMS with the intent of making it as secure as possible (a personal challenge) and the code as clean as possible. I think I've a long way to go so I would appreciate any input, ...
0
votes
0answers
28 views
Zend Framework and Doctrine 2 - are my unit tests sufficient?
I'm quite new to Zend and unit testing in general. I have come up with a small application that uses Zend Framework 2 and Doctrine. It has only one model and controller and I want to run some unit ...
0
votes
1answer
72 views
PHP MVC: how to do $_POST the right way
I am not sure if I am doing right on how to handle $_POST data in MVC pattern. Below is my attempt. Am I doing it right?
// Dummy $_POST data,
$_POST = array(
"menu" => array(
...
1
vote
1answer
24 views
Created my first wordpress plugin template page, need comments
I managed to create my first wordpress plugin template page collecting various code snippets to make the page function.
Everything works fine, but I need hear comments from PHP & wordpress ...
2
votes
3answers
53 views
OOP Class properties automatically
One of my friend made a framework.
He made an abstract class, called NullObject (see below).
For his convenience, hid does this, so when he want to build an object from database, just inherit this ...
2
votes
2answers
73 views
PHP test isset and instantiate in one shot. Possible in PHP?
How to improve this kind of redundancy?
$nid = isset( $_GET['nid'] ) ? $_GET['nid'] : 0;
I want to avoid to repeat $_GET['nid']
Example of useful use case:
$nid = isset( ...
1
vote
1answer
51 views
Very simple login script review
I'm relatively new to PHP and have recently created a small website for friends and family to upload and share photos, protected by a very simple login system.
While I'm aware what I'm doing isn't ...
1
vote
0answers
87 views
How is my PHP code?
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
0answers
27 views
Correct use of my JOIN and arrays to fetch the data?
After learning a lot about programming, I've decided to write some code pertaining to scripting and use of different functions. I've come to a point where I'd like others to verify my code for ...
2
votes
1answer
56 views
How to put XML results in the MVC pattern?
I have been writing PHP programs in the MVC pattern for quite some time. But I am not sure if I am doing it right.
For instance, I have this PHP file that prints a result in XML, and I put this file ...