Phppgads 2.0.7 > PhpPgAds 2.0.7 / Admin / Settings Db.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Phppgads 2.0.7

Download:
phppgads-2.0.7.zip

Category:
Ad Management

Archive Content:

PhpPgAds 2.0.7

PhpPgAds 2.0.7 > Admin

PhpPgAds 2.0.7 > Admin > Report Plugins

PhpPgAds 2.0.7 > Admin

PhpPgAds 2.0.7 > Admin > Images

PhpPgAds 2.0.7 > Admin > Images > Ltr

PhpPgAds 2.0.7 > Admin > Images

PhpPgAds 2.0.7 > Admin > Images > Flags

PhpPgAds 2.0.7 > Admin > Images

PhpPgAds 2.0.7 > Admin > Images > Rtl

PhpPgAds 2.0.7 > Admin > Images

PhpPgAds 2.0.7 > Admin

PhpPgAds 2.0.7 > Admin > Templates

PhpPgAds 2.0.7

PhpPgAds 2.0.7 > Cache

PhpPgAds 2.0.7 > Client

PhpPgAds 2.0.7 > Language

PhpPgAds 2.0.7 > Language > Brazilian Portuguese

PhpPgAds 2.0.7 > Language > Chinese Big5

PhpPgAds 2.0.7 > Language > Chinese Gb2312

PhpPgAds 2.0.7 > Language > Dutch

PhpPgAds 2.0.7 > Language > English

PhpPgAds 2.0.7 > Language > English Us

PhpPgAds 2.0.7 > Language > French

PhpPgAds 2.0.7 > Language > German

PhpPgAds 2.0.7 > Language > Hebrew

PhpPgAds 2.0.7 > Language > Hungarian

PhpPgAds 2.0.7 > Language > Indonesian

PhpPgAds 2.0.7 > Language > Italian

PhpPgAds 2.0.7 > Language > Korean

PhpPgAds 2.0.7 > Language > Polish

PhpPgAds 2.0.7 > Language > Portuguese

PhpPgAds 2.0.7 > Language > Russian Cp1251

PhpPgAds 2.0.7 > Language > Russian Koi8r

PhpPgAds 2.0.7 > Language > Spanish

PhpPgAds 2.0.7 > Language > Turkish

PhpPgAds 2.0.7 > Libraries

PhpPgAds 2.0.7 > Libraries > Defaults

PhpPgAds 2.0.7 > Libraries

PhpPgAds 2.0.7 > Libraries > Layerstyles

PhpPgAds 2.0.7 > Libraries > Layerstyles > Cursor

PhpPgAds 2.0.7 > Libraries > Layerstyles > Floater

PhpPgAds 2.0.7 > Libraries > Layerstyles > Geocities

PhpPgAds 2.0.7 > Libraries > Layerstyles > Geocities > Images

PhpPgAds 2.0.7 > Libraries > Layerstyles > Geocities

PhpPgAds 2.0.7 > Libraries > Layerstyles > Simple

PhpPgAds 2.0.7 > Libraries > Layerstyles > Simple > Images

PhpPgAds 2.0.7 > Libraries > Layerstyles > Simple

PhpPgAds 2.0.7 > Libraries

PhpPgAds 2.0.7 > Libraries > Deliverycache

PhpPgAds 2.0.7 > Libraries > Geotargeting

PhpPgAds 2.0.7 > Libraries > Resources

PhpPgAds 2.0.7 > Maintenance

PhpPgAds 2.0.7 > Misc

PhpPgAds 2.0.7 > Misc > Documentation

PhpPgAds 2.0.7 > Misc

PhpPgAds 2.0.7 > Misc > Fakecron

PhpPgAds 2.0.7 > Misc > Revisions

PhpPgAds 2.0.7 > Misc > Samples

PhpPgAds 2.0.7 > Misc > Samples > Xmlrpc

PhpPgAds 2.0.7 > Misc > Samples > Xmlrpc > Php

Settings Db.php:


<?php // $Revision: 2.1.2.5 $

/************************************************************************/
/* phpPgAds                                                             */
/* ========                                                             */
/*                                                                      */
/* Copyright (c) 2001 by the phpPgAds developers                        */
/* http://www.greatbridge.org/project/phppgads/                         */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/



// Include required files
include ("lib-settings.inc.php");


// Register input variables
phpAds_registerGlobal ('save_settings',  'dblocal',  'dbhost',  'dbport',  'dbuser',  'dbpassword',  'dbname',  
                       
'persistent_connections',  'insert_delayed',  
                       
'compatibility_mode',  'auto_clean_tables_vacuum');


// Security check
phpAds_checkAccess(phpAds_Admin);


$errormessage = array();
$sql = array();

if (isset(
$save_settings) && $save_settings != '')
{
    if (isset(
$dbpassword) && ereg('^\*+$',  $dbpassword))
        
$dbpassword $phpAds_config['dbpassword'];
    
    if ((isset(
$dblocal) || (isset($dbhost) && isset($dbport))) && isset($dbuser) && isset($dbpassword) && isset($dbname))
    {
        
phpAds_dbClose();
        
        unset(
$phpAds_db_link);
        
        
$phpAds_config['dblocal'] = isset($dblocal) ? true false;
        
$phpAds_config['dbhost'] = $phpAds_config['dblocal'] ? 'localhost' $dbhost;
        
$phpAds_config['dbport'] = $phpAds_config['dblocal'] ? 5432 $dbport;
        
$phpAds_config['dbuser'] = $dbuser;
        
$phpAds_config['dbpassword'] = $dbpassword;
        
$phpAds_config['dbname'] = $dbname;
        
$phpAds_config['persistent_connections'] = isset($persistent_connections) ? true false;
        
$phpAds_config['auto_clean_tables_vacuum'] = isset($auto_clean_tables_vacuum) ? true false;
        
        if (!
phpAds_dbConnect(true))
            
$errormessage[0][] = $strCantConnectToDb;
        else
        {
            
phpAds_SettingsWriteAdd('dblocal',  isset($dblocal));
            
phpAds_SettingsWriteAdd('dbhost',  $phpAds_config['dbhost']);
            
phpAds_SettingsWriteAdd('dbport',  $phpAds_config['dbport']);
            
phpAds_SettingsWriteAdd('dbuser',  $dbuser);
            
phpAds_SettingsWriteAdd('dbpassword',  $dbpassword);
            
phpAds_SettingsWriteAdd('dbname',  $dbname);
            
            
phpAds_SettingsWriteAdd('persistent_connections',  isset($persistent_connections));
        }
    }
    
    
//phpAds_SettingsWriteAdd('insert_delayed',  isset($insert_delayed));
    //phpAds_SettingsWriteAdd('compatibility_mode',  isset($compatibility_mode));
    
phpAds_SettingsWriteAdd('auto_clean_tables_vacuum',  isset($auto_clean_tables_vacuum));
    
    
    if (!
count($errormessage))
    {
        if (
phpAds_SettingsWriteFlush())
        {
            
header("Location: settings-invocation.php");
            exit;
        }
    }
}



/*********************************************************/
/* HTML framework                                        */
/*********************************************************/

phpAds_PrepareHelp();
phpAds_PageHeader("5.1");
phpAds_ShowSections(array("5.1",  "5.3",  "5.4",  "5.2"));
phpAds_SettingsSelection("db");



// Fix dblocal settings
if (!$phpAds_config['dblocal'] && !$phpAds_config['dbhost'])
{
    
$phpAds_config['dblocal'] = true;
    
$phpAds_config['dbhost'] = 'localhost';
}



/*********************************************************/
/* Cache settings fields and get help HTML Code          */
/*********************************************************/

$settings = array (

array (
    
'text'       => $strDatabaseServer,
    
'items'      => array (
        array (
            
'type'       => 'checkbox',  
            
'name'       => 'dblocal',
            
'text'       => $strDbLocal,
            
'req'      => true
        
),
        array (
            
'type'    => 'break'
        
),
        array (
            
'type'       => 'text',  
            
'name'       => 'dbhost',
            
'text'       => $strDbHost,
            
'req'     => false,
            
'depends' => 'dblocal==false'
        
),
        array (
            
'type'    => 'break'
        
),
        array (
            
'type'       => 'text',  
            
'name'       => 'dbport',
            
'text'       => $strDbPort,
            
'req'     => false,
            
'depends' => 'dblocal==false'
        
),
        array (
            
'type'    => 'break'
        
),
        array (
            
'type'       => 'text',  
            
'name'       => 'dbuser',
            
'text'       => $strDbUser,
            
'req'      => true
        
),
        array (
            
'type'    => 'break'
        
),
        array (
            
'type'       => 'password',  
            
'name'       => 'dbpassword',
            
'text'       => $strDbPassword,
            
'req'      => true
        
),
        array (
            
'type'    => 'break'
        
),
        array (
            
'type'       => 'text',  
            
'name'       => 'dbname',
            
'text'       => $strDbName,
            
'req'      => $phpAds_productname == 'phpAdsNew'
        
)
    )
),
array (
    
'text'       => $strDatabaseOptimalisations,
    
'items'      => array (
        array (
            
'type'    => 'checkbox',
            
'name'    => 'persistent_connections',
            
'text'      => $strPersistentConnections
        
),
        array (
            
'type'    => 'checkbox',
            
'name'    => 'insert_delayed',
            
'text'      => $strInsertDelayed,
            
'visible' => $phpAds_productname == 'phpAdsNew'
        
),
        array (
            
'type'    => 'checkbox',
            
'name'    => 'compatibility_mode',
            
'text'      => $strCompatibilityMode,
            
'visible' => $phpAds_productname == 'phpAdsNew'
        
),
        array (
            
'type'    => 'checkbox',
            
'name'    => 'auto_clean_tables_vacuum',
            
'text'      => $strAutoCleanVacuum,
            
'visible' => $phpAds_productname == 'phpPgAds'
        
)
    )
));



/*********************************************************/
/* Main code                                             */
/*********************************************************/

phpAds_ShowSettings($settings,  $errormessage);



/*********************************************************/
/* HTML framework                                        */
/*********************************************************/

phpAds_PageFooter();

?>



Other Ad Management Scripts:

WebMaster Resources Home

©RingsWorld.com