Current time: 05-02-2024, 09:36 AM Hello There, Guest! (LoginRegister)


Post Reply 
[HOWTO] Usar ID numerico + número random obligatorio al crear BD
Author Message
shiizpa Offline
Junior Member
*

Posts: 69
Joined: Mar 2009
Reputation: 2
Post: #1
[HOWTO] Usar ID numerico + número random obligatorio al crear BD
1. Checkbox Obligatorio
editamos sql_database_add.tpl
Code:
nano /var/www/ispcp/gui/themes/omega_original/client/sql_database_add.tpl

buscar
PHP Code:
<td width="200" class="content2"><!-- BDPmysql_prefix_yes -->
                                  <
input type="checkbox" name="use_dmn_id" {USE_DMN_ID}>
                                  <!-- 
EDPmysql_prefix_yes -->
                                  <!-- 
BDPmysql_prefix_no -->
                                  <
input type="hidden" name="use_dmn_id" value="on">
                                  <!-- 
EDPmysql_prefix_no -->
                                {
TR_USE_DMN_ID}</td

remplazar por
PHP Code:
<td width="200" class="content2">
        <
input type="checkbox" checked {USE_DMN_IDdisabled>{TR_USE_DMN_ID}
        <
input type="hidden" name="use_dmn_id" value="on">
    </
td

2. Agregar ID númerico + numero random al crear base de datos
editamos sql_database_add.php
Code:
nano /var/www/ispcp/gui/client/sql_database_add.php

buscar
PHP Code:
if (isset($_POST['id_pos']) && $_POST['id_pos'] === 'start') {
            
$db_name $dmn_id "_" clean_input($_POST['db_name']);
        } else if (isset(
$_POST['id_pos']) && $_POST['id_pos'] === 'end') {
            
$db_name clean_input($_POST['db_name']) . "_" $dmn_id;
        } 

y remplazar por
PHP Code:
if (isset($_POST['id_pos']) && $_POST['id_pos'] === 'start') {
            
$db_name $dmn_id rand(0,999) . "_" clean_input($_POST['db_name']); 
            
//ID número + aleatorio entre 0 y 999 al principio
        
} else if (isset($_POST['id_pos']) && $_POST['id_pos'] === 'end') {
            
$db_name clean_input($_POST['db_name']) . "_" $dmn_id rand(0,999);
            
//ID número + número aleatorio entre 0 y 999 al final
        


aqui un ejemplo del resultado cree 4 bases de datos llamadas prueba, 2 con el id antes y 2 con el id despues del nombre

click-->    
(This post was last modified: 04-16-2009 07:34 AM by shiizpa.)
04-16-2009 03:50 AM
Find all posts by this user Quote this message in a reply
Arturo Offline
Junior Member
*

Posts: 77
Joined: Dec 2008
Reputation: 0
Post: #2
RE: Howto Usar ID numerico + número random obligatorio al crear BD
mmm, gracias por la guia muy interesante.
Alomejor en un futuro lo integro Wink
04-16-2009 05:51 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)