Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Alfred Pellemans  >  clsINI  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples for using the class clsINI
Class: clsINI
Edit INI configuration file using a Web interface
Author: By
Last change: adding add-form
Date: 2009-09-30 11:36
Size: 1,157 bytes
 

Contents

Class file image Download
<?php
/**
    File: parameters.php
    Description: 
    example of interaction with clsparameters.php
    
***/


$ini_file "parameters.ini";

include_once (
"clsini.php");

if (isset(
$_POST['action'])) $actie $_POST['action'];

echo 
"<p>Example INI tool</p>";


switch (
$actie) {
    case 
"save" :
        
$objINI->edit($_POST);
        
$objINI->save();
        echo 
"INI-file updated.<br>";
        break;
    case 
"add":
        
$section $_POST['section'];
        
$name $_POST['name'];
        
$value $_POST['value'];
        
set_ini_parameter($name$value$section); // example to store a new parameter
        
echo "Parameter added.<br>";
        break;
}
echo 
"example of retrieveing parameters all through your project : max_number_files_tmpdir = "get_ini_parameter("max_number_files_tmpdir")."<br><br><br>";

echo 
$objINI->editform();
echo 
$objINI->addform();

echo 
"<hr>Display content of inifile <br><pre>";
$s readfile ($ini_file); // display content of ini_file.

echo "</pre>";
echo 
"<hr>Check content of inifile using regular php-command (parse_ini_file())<br><pre>";
print_r(parse_ini_file ($ini_file)); // display content of ini_file.
echo "</pre>";



?>