Location: PHPKode > projects > OxyNews > oxynews/install4.php
	OxyNews, a PHP news management program
    Copyright (C) 2002  OxyTeam
    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, or 
    (at your option) any later version. 

    This program is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
    GNU General Public License for more details. 

    You should have received a copy of the GNU General Public License 
    along with this program; if not, write to the Free Software 
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
// www.php-arena.com
// www.oxynews.net
// www.oxyscripts.com
//* This is install.php 
##Include Files 
include ("oxynews_config.php"); 

if (empty($comment_tab)) {
$comment_tab = "oxynews_comment";
if (empty($users_tab)) {
$users_tab = "oxynews_users";
if (empty($style_tab)) {
$style_tab = "oxynews_style";
if (empty($news_tab)) {
$news_tab = "oxynews_news";

$sql_add_field_own_id = "ALTER TABLE `".$comment_tab."` ADD `own_id` INT(11) DEFAULT '0' NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;";
$sql_update_field_email = "ALTER TABLE ".$users_tab." CHANGE `email` `email` VARCHAR(100) DEFAULT NULL;";

$sql_update_field_style = "ALTER TABLE `".$style_tab."` CHANGE `style` `style` ENUM('easy','advanced') DEFAULT 'easy' NOT NULL;";

$sql_add_field_to_oxynews_style = "ALTER TABLE `".$style_tab."` ADD `head_style` ENUM('stand','advanced') DEFAULT 'stand' NOT NULL AFTER `adv_bot`, ADD `head_adv_top` TEXT NOT NULL AFTER `head_style`, ADD `head_adv_hl` TEXT NOT NULL AFTER `head_adv_top`, ADD `head_adv_bot` TEXT NOT NULL AFTER `head_adv_hl`, ADD `head_adv_len` SMALLINT(2) DEFAULT '20' NOT NULL AFTER `head_adv_top`";

$sql_update_entry_in_style = "UPDATE ".$style_tab." SET head_adv_len='20', head_style='STAND', head_adv_top='<table align=\"center\">', head_adv_hl='  <tr>\r\n    <td><font size=\"1\"><number>-|<headline></font></td>\r\n  </tr>', head_adv_bot='</table>' WHERE id=1;";

$logs_sql = "CREATE TABLE $phpUserLogin_mysql_table_logips (
  id int(11) NOT NULL auto_increment,
  ip varchar(80) NOT NULL default '0',
  num_uses int(11) NOT NULL default '0',
  num_logins int(11) NOT NULL default '0',
  last_username varchar(20) default NULL,
  user_info varchar(100) default NULL,
  date date NOT NULL default '0000-00-00',
  time time NOT NULL default '00:00:00',
  PRIMARY KEY  (id),
  UNIQUE KEY ip (ip),
  KEY date (date),
  KEY time (time)
) ;";

$logs_sql_2 = "CREATE TABLE $phpUserLogin_mysql_table_loguse (
  id int(11) NOT NULL auto_increment,
  ip_id int(11) NOT NULL default '0',
  type enum('login','wrong','nouser','nopass','noboth','look_info','look_login','look_password','request_nouser','request_wrong','request_right','logout','error_logout') NOT NULL default 'look_login',
  used_username varchar(20) default NULL,
  date date NOT NULL default '0000-00-00',
  time time NOT NULL default '00:00:00',
  exists_user enum('TRUE','FALSE','NOTSET') NOT NULL default 'NOTSET',
  login enum('TRUE','FALSE','LOGOUT') NOT NULL default 'FALSE',
  PRIMARY KEY  (id),
  KEY date (date),
  KEY time (time)
) ;";

<title>OxyNews: Update Script - v0.3.5-SE to v0.4</title>
<font face="Arial" size="2">OxyNews: Update Script - v0.3.5-SE to v0.4<p>

if ($startupdate) {

## Adding field

oxynews_mysql_query($sql_add_field_own_id, "Adding Field: own_id");

## Updating field

oxynews_mysql_query($sql_update_field_email, "Updating Field: email");

## Updating field

oxynews_mysql_query($sql_update_field_style, "Updating Field: style");

## Updating field

oxynews_mysql_query($sql_add_field_to_oxynews_style, "Adding Fields to style table");

## Adding info

oxynews_mysql_query($sql_update_entry_in_style, "Adding headlines style info");

## Adding 1. log table

oxynews_mysql_query($logs_sql, "Adding 1. log table");

## Adding 2. log table

oxynews_mysql_query($logs_sql_2, "Adding 2. log table");

echo "<B>OxyNews Update Script Complete.</B><br>
If any of the complete signs are red, then find the bug that made the script fail, remove it, and then run the script again. (Remember that those actions that worked now, will fail next time you run this script, well most of them will)";

} else {

This script will update OxyNews v0.3.5-SE to v0.4<p>
<form action="install4.php" metode="post">
If you have changed what the tables was named when you installed OxyNews<br>
then enter the new names here, of just leave empty to use the scripts default names<br>
Comment table: <input type="text" name="comment_tab" size="15"> -> oxynews_comment<br>
Users table: <input type="text" name="users_tab" size="15"> -> oxynews_users<br>
Style table: <input type="text" name="style_tab" size="15"> -> oxynews_style<br>
News table: <input type="text" name="news_tab" size="15"> -> oxynews_news<br>
<input type="submit" value="Run the update script" name="startupdate">

Return current item: OxyNews