Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6217

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

3 votes

Improving my user class

In short : its an extremely bad piece of code. Here is a list or "whys": you are mixing data access with logic ( sql queries should be handled by different object ) you are using global state for D …
tereško's user avatar
  • 1,476
3 votes

Object-oriented command processor

Stop using underscore to indicate private/protected parts of a class. Do not put logic in the constructors It is pointless to have ... ? true : false; in isUsingCommand(). Use implode() in fullStrin …
tereško's user avatar
  • 1,476
1 vote

What is the best way to get the child class name for use in a parent class

First of all, none of so-called "mvc frameworks" in php actually implement MVC or any other MVC-inspired design pattern. … for more details on the subject: read GUI Architectures by Martin Fowler, to see how it might apply to PHP project, take a look at this answer. .. now the "review part" avoid the use of public attributes …
tereško's user avatar
  • 1,476
1 vote

Are these MySQL Abstraction Classes safe from SQL Injection? Can they be made safe?

Active record instances are not "models". They are anti-patterns which RoR likes call that way. And what you are implementing there is an active record. And no, those queries are not safe. They are w …
tereško's user avatar
  • 1,476
1 vote

PHP simple engine

good tutorial here. the switch statement should be replaced with: if ( in_array($row['position'], $modules) ) { $modules[ $row['position' ]][] = $row['source'] } do not use eval() do not put HTML, PHP
tereško's user avatar
  • 1,476
0 votes

Would be possible to refactor this PHP code more?

Why are you passing the Constraint instance to the function, it it is there only for you to extract $constraint->message from it? This use violates the LoD and you seem to be leaking the encapsulat …
tereško's user avatar
  • 1,476
0 votes

Determining what functions should be implemented in this user-authentication class

The reason why you were told, that isPasswordCorrect() should not be implemented in User class is because someone is pretty bad at explaining stuff. It's OK for User instance to validate the provided …
tereško's user avatar
  • 1,476
3 votes
Accepted

Preventing SQL injection without using prepared statements

never return from constructor avoid having new statements in the constructor on error, throw an exception instead of echo + exit % is used in MySQL's LIKE syntax you should refactor your DatabaseCon …
tereško's user avatar
  • 1,476
2 votes
Accepted

Query Builder for Mysql Extension

Sorry to say, but you are just making PDO worse there :( restricting only to using mysql your constructor is missing options, which means that: it's probably not utf-8 you can't user row count exc …
tereško's user avatar
  • 1,476
4 votes

PHP Template Engine

PHP itself already is a templating language, so my first thought would be - this is completely pointless. … You have replaces the PHP built in templating functionality with preg_*, which seems quite silly. These kind of templates will most likely conflict with JS libraries …
tereško's user avatar
  • 1,476
5 votes
Accepted

Is this correct implementation of MVC pattern for PHP website?

albumView.php Views are not glorified templates. They should be instances that acquire data from model layer and, based on that information, produce a response for the user. Views do not: initialize …
tereško's user avatar
  • 1,476
2 votes

Correct GenericDAO implementation?

Some recommendations: Instead of creating monolithic DAOs, you should split it in domain objects and data mappers. This way you would separate the entity-specific business logic from storage. Do not …
tereško's user avatar
  • 1,476
0 votes

Laravel controller to manage sent and received messages

stop using SQL builders in your "controllers" stop rendering templates in your "controllers" stop repeating authentication in each class method stop using static function calls and relaying on global …
tereško's user avatar
  • 1,476
25 votes

Heavily-criticized tax calculator

People who want to teach other should not write code like this. Not even slightest indication that you understand what Separation of Concerns is. The pattern that you are using is called Big Ball of …
tereško's user avatar
  • 1,476
3 votes

Web register form

php $form = $this->form; ?> <form action="<?php echo $form->get_destination(); ?>" method="post"> <ul> <li> <?php echo $form->render_field( 'email' ); ? … php echo $form->render_field( 'invitation_key' ); ?> </li> <li><?php echo $form->render_field( 'submit' ); ? …
tereško's user avatar
  • 1,476

15 30 50 per page