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

learn more… | top users | synonyms

0
votes
1answer
32 views

Use redundant data in database design when have multiple relation

In my web application users can submit their advertises and buy package for advertise (packages are used for priority of showing advertises) Database schema is like this: **Package: id, title, ...
-3
votes
0answers
27 views

How to fix text down much rows

hi i'm building a forum system. and if try to send a post with down rows it sees like == hello, my name is stav == and want it sees == hello, my name is stav preg: $subject = stripslashes($...
4
votes
4answers
7k views

The best possible way to implement Business Rules in PHP

I'm planning to write an e-commerce app using PHP & MySQL with lots & lots of custom rules. Say for example, I want to have a rule like "Give Customer X, a 10% a discount for Product Y if he ...
0
votes
2answers
50 views

Kind of Servlet (J2EE) for PHP?

I'm coming from a J2EE development environment, and by there, I used a Servlet context to hold all the website meta data (title, description ...) for the whole application (some kind of a session for ...
1
vote
0answers
41 views

What would you call this design pattern? MVC or PAC

I have been reading and researching about MVC, HMVC, MVP, MVVM and PAC design patterns when I came accross this article by larry garfield > MVC vs. PAC My Implementation: Think of a modular app ...
-2
votes
0answers
21 views

Emitting events from PHP [on hold]

I have a website with that many Offices are connected using Browser as Client. Now I am looking for some kind of idea that if we receive a news for specific office, can we send a message to Client as ...
1
vote
1answer
91 views

Functional Programming in PHP

Modern PHP is mostly written Object Oriented. Other than the fact that there is inertia towards the Object Oriented in the PHP community, is there anything about the language itself that would make it ...
0
votes
0answers
27 views

Design from API documentation to code

I have a full API documentation made of uris, request and response bodies ready to use. Uris are all externals, and I have to first visit an entry point that'll give me a token, and then use that ...
-2
votes
0answers
36 views

Private chat window in PHP chat [on hold]

I am currently building a chat as a personal project, and I have no idea how to solve this problem. I need the possibility to make a privat chat window, for private chats between users. However, ...
8
votes
1answer
187 views

Algorithm to generate Edges and Vertexes outwards from origin with max multiplicity of 3

I am creating a 2d game for a website where the universe can grow extremely large (basically infinitely large). Initially, the universe is composed of 6 stars that are an equal distance from the ...
1
vote
3answers
72 views

Return values for a delete function in php

I am writing a wrapper function for database calls, and I am confused about the best way to handle the error cases. The function has only one argument, the id of the object to be deleted. I've ...
1
vote
1answer
136 views

Can I add to a built-in function?

I want be to be able to re-write the code of an existing PHP function in an abstract manner. Here is an example: scandir() scans a directory for files and folders, and returns the relative paths '.' ...
3
votes
3answers
320 views

Is it good practice to use a single database connection?

The PHP codebase I'm working on has an utility class that returns a database connection. The implementation looks like this: class Database { private static $conn; private static $init = false; ...
0
votes
0answers
44 views

Dynamic Printing Options

I believe this is the correct community to post this question in, if not please point me to the correct one. Overview: Current web app gives users the ability to print labels from specific printers. ...
-1
votes
0answers
28 views

Shuffling of MCQ's in my examination portal

the screen shots attached are structure of database of my exam portal, one picture represents the question bank and second represents the test details.Test ID is acting as a primary and foreign key. ...
-1
votes
0answers
30 views

Principles for secure user login/authentication [on hold]

Backstory: In my from-scratch PHP/MySQL web development projects, I often start (and end) working on a secure user authentication. I'm self-taught and never certain that my site is adequately ...
1
vote
2answers
170 views

where to put which code in MVC model

I recently picked up learning PHP and MySQL and I am trying to build a small usersystem as a coding exercise. While learning to use classes and functions, I also stumbled upon the MVC model and would ...
0
votes
1answer
58 views

Manipulating DOM via script or rebuild website - which is better?

Let's assume you want to change what user sees on the website. There are two ways to do that: a) manipulate the DOM via JavaScript, but user has to download whole script, with possibility he may not ...
2
votes
1answer
41 views

Where should view-specific data/logic be defined in a PHP MVC application?

After many hours of research and thinking I have found an understanding, then coming to question it again, I am struggling to find something concrete which I can grasp and apply to my code in a ...
0
votes
0answers
54 views

How to search through an array of objects?

I am using an array of objects to store data to render a page. A few examples of data an object can contain: PHP filepath for an include CSS filepath for CSS files Meta data of the page Element ...
-1
votes
0answers
48 views

How to send an email attachment from form using codeigniter [on hold]

Can anyone help me about how to send an external file attachment directly from form type="file" through the mail using PHP Codeigniter.
-2
votes
0answers
54 views

How does one create a PHP page router controller?

I am making a PHP controller that should route pages on my website. It is my first attempt. Can someone revise this code and tell me if this makes sense or not. (never mind the logs array, I use it as ...
4
votes
2answers
611 views

Use a global variable, a singleton, or something else

Preface: I am working in PHP (Abandon hope all ye who enter here). Background: There exists a large set of global functions in PHP, a number of which are miscellaneous system calls, like sleep (and ...
2
votes
0answers
169 views

Symfony2 - Best aproach for a plugin system

Symfony2 is handling all its things in bundles in /app or in /vendor. This is fine, if you are handling and managing all by yourself or Ops that handle all needed things. But I haven't found a good ...
2
votes
2answers
97 views

Can a single Factory be used to create similar in purpose, but different in focus objects?

I am concerned about whether or not I am using FactoryMethod correctly. Background: I am refactoring legacy code and I have identified a pattern: there is a God Object that is created in memory,...
3
votes
1answer
273 views

Building dedicated codepad in PHP

I am author of growing framework, which is focused around User Interface building in PHP. Essential requirements for the up-coming website redesign is ability to run code examples. I am willing to ...
1
vote
1answer
111 views

Php-mysql injection

<?php error_reporting(E_ALL); //ini_set('display_errors', 1); $db_server = "localhost"; $db_name = "2"; $db_user = "root"; $db_passwd = ""; $connection = mysql_connect($db_server,$db_user,$...
0
votes
2answers
63 views

Reading the result of your command with the Command Pattern

I am currently looking into developing a new system utilizing hexagonal architecture and the commandpattern facilitated by a commandbus like tactician (it's a PHP system). Now I really like the idea ...
0
votes
1answer
265 views

Implementing SEO for a Zend Framework/PHP/Angular.js application

A team has implemented a web application using MySql, PHP with the Zend framework and Angular.js on the client side. I am in charge of implementing the SEO for this application. I understand I have ...
19
votes
12answers
7k views

How to write a command interpreter/parser?

Problem: Run commands in the form of a string. command example: /user/files/ list all; equivalent to: /user/files/ ls -la; another one: post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;" ...
0
votes
1answer
113 views

Using numeric arrays or associative arrays search and retrieve data ? [ file paths of a page]

I am building on a CMS where dependencies and files needed for a page get stored in the database. Because this can be very dynamic, I serialize these paths into one Database field into my pages table. ...
4
votes
3answers
1k views

How to deploy a single website to multiple physical servers?

Edit: I asked this question 3 or 4 years ago when I was new to web-development, the question looks a bit stupid to me today. I wanted to create a server setup of my own without relying on other ...
2
votes
2answers
201 views

Child class accessing its parent's method from Ancestor method

I find myself right now banging my head with the following issue (in PHP): I have an abstract base class, which has a non-abstract method, inherited and unchanged all over the inheritance chain (...
4
votes
1answer
464 views

How to bypass Oauth2 authentication when the client and resource owner is the same entity?

We are currently working on using an API provided by Mercado Libre which is a maket place for selling various goods. Their APIs use OAuth 2.0 for authentication. The problem is that OAuth 2.0 as ...
9
votes
7answers
3k views

Joomla or development from scratch? [closed]

As someone who has very little experience in it, I would like to know what makes you think that Joomla can fulfill all you requirements?. What makes you choose it over development from scratch (or ...
3
votes
2answers
255 views

Recommend an approach to decouple Product and Access code constructs, in order to simplify Product testing

I have some code that tightly couples Product specific code and Product-Access code. I am not sure how to untangle it. So for example, for testing Product, I have to mock up Access objects. And ...
0
votes
0answers
102 views

how to create triadic relations in laravel framework

I need to create triadic relation in laravel framework. Consider three models: Card, Notes, User. Card is related to notes and user, while they are related to each other. Now in models, when the ...
0
votes
4answers
483 views

Do i have to make all my website PHP with embedded HTML to make a good secure website?

I see all websites (THE big ones) make both PHP and HTML in same page .. Do I need to make all my website pages as PHP and embedded HTML inside it ? Can't I make the website all as HTML Pages and PHP ...
2
votes
2answers
857 views

multi-language system and security with php

I'm coding a new site. İt's like StackExchange, a social site and a blog. I try to create a multi-language site, however I can't decide how to do it. I have to use modules, so I must use OOP, while ...
0
votes
1answer
46 views

Laravel Eloquent - Filtering results and eager loaded results

So here is the use case: You have users and they have many addresses. Say you want to filter and eager load on addresses (say...only US addresses). In order to do so you have to filter the eager load ...
-1
votes
0answers
62 views

Is it better still use Java\Spring MVC or a lighter technology as PHP\Laravel for a new project?

I am a Java EE developer that obtained the Spring Core certification (related to Spring Framework). In the last year I have gained experience with this framework. I am also pretty confident in the ...
3
votes
4answers
218 views

Multiple many to many relations or one option table?

Let's say I have a database of persons who have some properties. For the sake of this problem let's say all of these properties relate as N-N. I can either create two tables for each property (one ...
0
votes
0answers
33 views

Strategies to manage approvals of orders together with a log

Backgound I need to develop a system that handles orders that needs to be approved by supervisors (or users with more privileges). A log have to be implemented to show who created the order and when, ...
0
votes
1answer
133 views

Question(s) about PHP PDO connections

Let's say I have a Db class [ db.php ] : <?php class Db { // class properties private $db_driver = ''; // dsn credentials private $db_dhost = ''; private $...
2
votes
0answers
76 views

Are there downsides to writing PDO/mysqli statements into my code directly vs using my own redirect wrapper methods?

TL;DR: To access DB functionality in my codebase I currently use a custom layer throughout the code. The layer needs an upgrade in order to begin accepting prepared statements, which it currently ...
1
vote
1answer
126 views

How to compute Pricing of Product & Options based on User Option Selection and Pricing per Option

I am building a service for pricing options of a product and for pricing the product itself when product has various options. Example User selects some X options out of Y options available, where X &...
0
votes
1answer
3k views

Reporting Solution in PHP / CodeIgniter - Server side logic vs client side

I'm building a report for an end user. They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size. So i was ...
1
vote
1answer
51 views

Accessing i18n objects from different scopes

I have been building a personal framework of mine which started off as a way to learn the MVC pattern and has progressed now into something that I like more than most frameworks out there (which is ...
0
votes
2answers
215 views

A few questions about model objects in a MVC

I have a few questions about how to implement models and what the results are of those implementations: When I only need a few variables set, isn't it memory consuming to create an entire object? E....
1
vote
1answer
75 views

How to display recent post on website and make own search engine ? With PHP

On OLX like Website , Anytime a user posts a new ad. It comes in top of the page. No search is involved in it. Which technology we can use to make such functions. Suppose X is visiting my website ...