Making sites is nice and fun but what if you don't want everybody too see something like an admin panel or maybe a special button. Well this tutorial helps you understand how to add a password to a php site in a simple manner. There are two techniques you can use. One is to use a database which allows you to have a group of users who may access the site. Another technique is to have pre defined variables that check if the values match the value of the variable. In this tutorial you will get to know the basics …

Member Avatar
Member Avatar
+5 forum 6

This is a continuation of our basic tutorial on MVC Framework. In this section, we will be creating the template files for both the TBS and the Smarty template engines. **The recap** In [part one](http://www.daniweb.com/web-development/php/tutorials/476695/part-one-php-mvc-framework-understanding-the-basics), we have created application controllers, models, and the one and only lone View class. Once again, please allow me to present few segments of those Classes here. **Main Controller** We will use this as our example. All of our application controllers have the method called index(). If we can recall from part one, we made the parent controller as an abstract class with an abstract …

Member Avatar
Member Avatar
+3 forum 9

Although objects collections have a place in the PHP world many years now , their use is now flourishing because more and more PHP programmers turn to OOP. This tutorial is a sequel of https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications (we will refer to it as “previous tutorial”) and https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications , in order to understand what we are doing I would strongly recommend to read those (and even better to make your own tests). Keeping objects of the same class in an array , in PHP isn't something new. We will do a brief explanation of what we will do using arrays , that most …

Member Avatar
Member Avatar
+2 forum 1

Hello, This tutorial is the next of “[A simple Data Layer for OOP PHP Applications](https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications)” so having read it and made your own tests is needed to understanding what we are doing. So far we have a Db object (child of PDO that standardize and simplifies its use) , a Db factory object (because our web app may need more than one DB object) and Data Workers (for working with data from DB) (there are in the tutorial mentioned above) . We are going to do it in such way that can be implemented without the use of any framework …

Member Avatar
Member Avatar
+4 forum 1

A simple Data Layer for OOP PHP Applications Hello, first of all to understand this tutorial would be best if you have some knowledges about OOP ( https://www.daniweb.com/programming/web-development/tutorials/437592/introduction-to-phps-object-orientation by priteas ) and DB usage (MySQL in this case) with PHP https://www.daniweb.com/programming/web-development/threads/499320/common-issues-with-mysql-and-php by diafol ). What we will try to achieve is a consistent usage of the DB (we will use MySQL but you can use what ever DB you like). We will not map query results in objects / lists of objects in this tutorial (there will be another one that will contain that) , but just retrieve the results …

Member Avatar
Member Avatar
+4 forum 1

## Contents ## Overview 1. Alternatives to Deprecated mysql_* Functions 2. SQL Injection: What to do with $_POST and $_GET variables 3. How to Insert Tablenames and Fieldnames Properly 4. What to do With Dynamic Values? 5. How to Use Aggregate Functions (COUNT, SUM, MIN etc) 6. How to Paginate and Create Page Number Links? 7. How do I Store Files: Filenames or BLOB? 8. Splitting the Big Table: Normalization 9. How to Get Data From More Than One Table 10. How to Store Menus and Submenus 11. Storing and Retrieving Authentication Data References and Further Reading _______________________________________________________________________________________________ ## Overview …

Member Avatar
Member Avatar
+6 forum 6

PHP is an object-oriented language, based (loosly) upon C++. It has classes, methods, member variables, and all that other good stuff. It runs on your web server, not in the client, but the HTML, JavaScript, and other stuff such as CSS blocks that it emits with its output commands are run on the client. The purpose of this tutorial is to explain why you don't want to mix your PHP and HTML, JavaScript, etc. One reason is if you do that, it becomes pretty much impossible to debug. Another is that is it inefficient. 1. Use classes and methods to …

Member Avatar
Member Avatar
+3 forum 14

Recently I've stumbled on a nice tool that I really quite like, so I thought I'd share it: Personally, I love the power behind PHP. I find it a very simple to use yet possesses the techniques seen in the more complex desktop applications such as Perl/Python/C/C++/C# etc. PHP has always been restricted to server-side web applications, and unlike the others, cannot run as a desktop application – until now. I would like to share an awesome tool I’ve been using recently… [PHP Nightrain](http://www.naetech.com/php-nightrain) is a cool bit of kit: it fully supports popular frameworks such as Laravel and CakePHP, …

Member Avatar
Member Avatar
+7 forum 5

This tutorial is intended for people who are looking for alternative to PHP template engines like smarty, twig, dwoo, TBS, and others. Not all developers are willing to take the extra efforts needed to learn the template engine syntax. Some are just left behind thinking that PHP is a template engine itself and there is no need for another template engine. Regardless of what you think about PHP, it has been proven that PHP can be written in procedural, OOP, CLI interface, and spaghetti style .In this particular tutorial, I will be demonstrating how to use PHP effectively as a …

Member Avatar
Member Avatar
+7 forum 3

# SEO URL Redirection Basics: TUTORIAL # First you can see/get/use some code here. <?php /** * Redirect the visitor to another URL using a proper status code. * * @param string $URL * @param int $StatusCode * @copyright Claude "CodeAngry" Adrian * @license http://www.wtfpl.net/ */ function RedirectURL($URL = null, $StatusCode = 302){ // Validate arguments if(empty($URL)){ $URL = $_SERVER['REQUEST_URI']; } if(!is_string($URL) or !strlen($URL = trim($URL))){ throw new \InvalidArgumentException('$URL must be a non-empty trimmed string.'); } if(empty($StatusCode)){ $StatusCode = 302; } if(!is_numeric($StatusCode) or (intval(($StatusCode = intval($StatusCode)) / 100) != 3)){ throw new \InvalidArgumentException('$StatusCode must be a 3## HTTP status.'); } …

Member Avatar
Member Avatar
+0 forum 2

**Part One**: Learning the Basic Patterns **Disclaimer**: please pardon my spellogrammatico errors. I am not really a rough draft person. I type and write codes the split seconds as they crossed my mind, otherwise I will get extremely lazy and then will eventually hibernate like a tardigrade. I hope I do not add more confusion to this subject matter. Today is the last day of my very short Spring Break and I pretty much did not do anything productive for days, except for learning the new programming language called hack from facebook. I thought it would be something that I …

Member Avatar
Member Avatar
+3 forum 1

# What is OAuth and why do I want to use it? If you want to write an application that caters to existing members of a service, and you want your application to be able to access private areas of your end-users' profiles, or modify their accounts on their behalf, then you need OAuth. OAuth allows your application to automatically detect which member is using it without the member having to share anything about themselves. Additionally, it allows your application to authenticate itself to a service API with the member credentials of an end-user who is using it, without the …

Member Avatar
Member Avatar
+4 forum 8

**Clearing up php retrieval of form variables** the basics on how to best submit and retrieve form values in php focusing on checkboxes because they seem to be the most diffucult to understand. When posting form data to another page your naming convention makes all the difference in the world in your ease of access and clarity. Your Options simple syntax `name="simple_syntax"` array syntax `name="array_syntax[]"` multi-dimensional arrays `name="multi-dimensional_array_syntax[][]"` **simple syntax** <form name="av" method="post" action="<?php print $_SERVER['PHP_SELF']; ?>"> <p>Simple checkbox <input type="checkbox" name="simple_checkbox_1" value="simple_checkbox_1"/> <input type="checkbox" name="simple_checkbox_2" value="simple_checkbox_2"/> <input type="checkbox" name="simple_checkbox_3" value="simple_checkbox_3"/></p> </form> assuming each checkbox was checked your $_POST should …

Member Avatar
Member Avatar
+6 forum 6

First things first, the story about this article. Recently I've created an Wordpress Plugin [WordPress - WP - Keywords To Tooltip | CodeCanyon](http://codecanyon.net/item/wp-keywords-to-tooltip/6513598) After a few days, somebody asked me if it's working with Wordpress Multi Site, initially scared, I didn't expect it to be so easy, I've achieved the transition and make it compatible in under an hour. Why ? Because all the code written was OOP, so it was a piece of cake to modify where needed public function _activationHook() { global $wpdb; $query = file_get_contents($this->scriptBasePath . 'model/install.sql'); $query = str_replace($this->database->_table_prefix , $wpdb->base_prefix . $this->database->_table_prefix, $query); $queries = …

Member Avatar
Member Avatar
+2 forum 3

PHP is a nice language with features a wide range of automated features for memory but when it comes to mass processing for things like calculating pi or processing a database that's a couple dozen Gigabytes then you may run into a few troubles if things aren't done correctly. This of course only happens depending on what operating system you have and what updates you have done along with settings you have set but those pieces of information are a bit puzzling as some web servers have this problem while others don’t. So this feature I'm going to talk about …

Member Avatar
Member Avatar
+4 forum 2

I googled and googled to try and find a comprehensive wiki/tut on how to share htdocs across a dual platform. My base install is Windows 7 64bit, and recently (6wks ago) set up a dual boot. One thing pained me for a while of not being able to use the current edited files from one system to the other. So for anyone that is looking to do this, I finally sussed it and have it working :). Assumptions: 1. You have XAMPP installed on Windws platform 2. You have XAMPP installed on Linux platform 3. You know how to access …

Member Avatar
Member Avatar
+5 forum 2

## Introduction ## In this introduction I will try to explain basic object orientation (focused on PHP). It is by no means meant to be a complete guide. There are a lot of concepts I am avoiding for simplicity’s sake. I will try to give a theoretical explanation first, and later on provide some code examples. ## What is it? ## Object orientation is a way of reflecting objects in the real world. If you have a problem that can be described by interacting objects, there’s a good chance an object oriented approach will help you. It is by no …

Member Avatar
Member Avatar
+12 forum 5

In php/html/javascript there are two different ways you may redirect a user to another page however there are a few things to consider before choosing with method to use. As you should know by now php has the ability to send html and javascript to the web browser and php can contribute to html and javascript functionality by generating scripts on the fly. So first I shall demonstrate php's ability to generate scripts on the fly. [B]#method 1[/B] [CODE=php] <?php $page='http://www.google.com/'; // $page=''; //will disable redirect // some massave code above here ?> <head> <title>A test page</title> <?php if (strlen($page)>0) …

Member Avatar
Member Avatar
+4 forum 10

Hey guys, I just wanted to let everyone know that functions can be used very constructively and there are more to them then most think. Okay this example function is actually pulled from a class of mine so it would probably make more sense in my class but it should make sense anyway. Right we should all know how to make functions, for those of you that don't I'm going to explain the process. First off, a function will contain a method or a block of code that we may want to call several times further along in our script. …

Member Avatar
Member Avatar
+7 forum 5

Programming in PHP is fun and easy. It is a very powerful scripting language that takes simple HTML and turns it into a fully-interactive experience for the web user. Let's get started! Note: These tutorials assume that you have a working web server that's capable of displaying PHP code and that you have PHP installed on that web server system or that you're using a server that is equipped and ready. You can run PHP on Windows. You can even use PHP with IIS (The Windows Web Server) so you don't necessarily need Unix/Linux and Apache. [B]PHP Reference[/B] Your best …

Member Avatar
Member Avatar
-8 forum 48

The End.