Admin Interface

"; echo "

Create database table for classifieds

Create table '$table_ads'
Warning ! Old table '$table_ads' if exists will be deleted.

SQL for creating table '$table_ads'

Log Out from admin. interface "; echo $html_footer; exit; } function print_sql_tb() { global $html_header, $html_footer; echo $html_header; echo sql_create_tb(); echo $html_footer; exit; } function create_db() { global $host_name, $db_user,$db_password, $html_header, $html_footer, $db_name, $table_ads; mysql_connect("$host_name","$db_user","$db_password"); mysql_create_db("$db_name"); echo $html_header; echo "Database '$db_name' was created"; echo $html_footer; exit; } function create_tb() { global $host_name, $db_user,$db_password, $html_header, $html_footer, $db_name, $table_ads, $ads_fields; $sql_query1=sql_create_tb(); if (!(@mysql_connect("$host_name","$db_user","$db_password"))) {echo $html_header; echo "

Error in connecting to your MySQL server.
You need to set up correct values for variables
\$host_name, \$db_user, \$db_password in the config.php file
"; echo $html_footer; exit; } if (!(@mysql_select_db("$db_name"))) {echo $html_header; echo "
Error in connecting to your MySQL database '$db_name'.
You need to set up correct database name in variables \$db_name of
the config.php file or create the database with such a name.
"; echo $html_footer; exit; } $result1 = mysql_list_tables ($db_name); $i = 0; while ($i < mysql_num_rows ($result1)) { $tb_names1 = mysql_tablename ($result1, $i); if ($tb_names1==$table_ads){mysql_query("DROP TABLE $table_ads;"); } $i++; } if (!(mysql_query("$sql_query1"))){ echo $html_header; echo "
Error in creating MySQL table '$table_ads'.
Check errors in variable \$ads_fields (config.php file) for ads fields settings "; echo $html_footer; exit; } $message=" Table '$table_ads' was created

Now database '$db_name' contains the following tables:
"; $result = mysql_list_tables ($db_name); $i = 0; while ($i < mysql_num_rows ($result)) { $tb_names[$i] = mysql_tablename ($result, $i); $message=$message.$tb_names[$i].", "; $i++; } $message=$message."

"; admin_message1($message); exit; } function sql_create_tb() { global $ads_fields, $table_ads; $table_name=$table_ads; $db_t_fields['idnum']="integer"; $db_t_fields['time']="integer"; $db_t_fields['exptime']="integer"; $db_t_fields['catname']="text"; $db_t_fields['visible']="integer"; $db_t_fields['adphotos']="char(5)"; $db_t_fields['login']="text"; $db_t_fields['adrate']="integer"; foreach ($ads_fields as $key => $value) { $db_t_fields[$key]=$ads_fields[$key][6]; } $create_string=""; foreach ($db_t_fields as $db_key => $value) { $create_string=$create_string.$db_key." ".$db_t_fields[$db_key].", "; } $create_string=corr_sqlstring($create_string); $sql="create table $table_name ( $create_string ) "; return $sql; } function admin_message1($message) { global $cat_fields, $photos_count, $html_header, $html_footer, $id, $ct, $categories, $ad_second_width, $left_width_sp, $exp_period; echo $html_header; echo "

Categories:  

$message


"; echo $html_footer; exit; } function printpasswordform($inc_passw) { global $html_header, $html_footer; echo $html_header; echo "
Admin Interface

$inc_passw

Input admin password :

(Cookies must be set up. Admin password is specified in the config.php file. Default password: adm )


"; echo $html_footer; exit; } ?>