Anonymous,

Please Login or Register
Download Nuke Evolution Xtreme today for a CMS you can enjoy using and sharing with your friends!
[ Download Now ]
Forum Index  ·  Search  ·  Usergroups  ·  Edit your profile  ·  Members  ·  Login, Check Messages
Arcade  ·  Ranks  ·  Staff  ·  Statistics  ·  Board Rules  ·  Forum FAQ  ·  Log in

Search for at
Evolution-Xtreme Advanced Search


+  
Latest Site News   Next 5 >>  
 Forum   Author   Replies   Last Post 
File Repository 1.0.0 Released Announcements! Lonestar 0 Tue Apr 26, 2016 6:44 am
Lonestar View latest post
Image Repository Released Announcements! Lonestar 1 Mon Oct 27, 2014 7:39 pm
Lonestar View latest post
So what happened to us? Announcements! SgtLegend 0 Tue May 06, 2014 12:32 am
SgtLegend View latest post
[PROGRESS] Nuke Evolution Xtreme 2.0.9e Announcements! SgtLegend 2 Sun May 27, 2012 6:25 pm
SgtLegend View latest post
European Cookie Law Announcements! SgtLegend 0 Sat May 26, 2012 7:33 am
SgtLegend View latest post
   
Recent Topics   Next 15 >>  
 Forum   Author   Replies   Last Post 
Evo staff looking for some volunteers. Community Announcements coRpSE 20 Thu Jul 02, 2015 9:19 am
Depresjon2 View latest post
Evo Xtreme 2.0.9D Updated for PHP 5.6 General Support coRpSE 121 Thu Mar 23, 2017 3:57 pm
casterdon View latest post
[ MOD ] - Honeypot V2.2 AntiBot Module Security coRpSE 106 Tue Nov 22, 2016 11:30 am
coRpSE View latest post
Possible new Admin area layout Comments and Suggestions Lonestar 18 Wed Sep 14, 2016 11:37 am
Blackou View latest post
jQuery update General Support Lonestar 2 Wed May 11, 2016 4:49 pm
Charles64 View latest post
Deutsche Sprachdatei - german language files German DT50R 7 Thu Jan 28, 2016 7:04 am
DT50R View latest post
[FIX] Correct Cookie Settings (Invalid Session Error) Quick fixes killigan 110 Fri Mar 20, 2015 1:06 pm
Macdaddy View latest post
login as admin strange error General Support Worfwarrior 8 Sun May 21, 2017 12:42 pm
Worfwarrior View latest post
Does Anyone Have a Media Player Mod? Modules goosse 0 Mon May 01, 2017 9:17 am
goosse View latest post
head and body help General Support hercountrybuck 8 Tue Apr 04, 2017 2:08 pm
Sp0rAdiC View latest post
babstats nuke evo PHP 5.6 Modules pd35 4 Mon Mar 27, 2017 5:45 pm
Ragonese View latest post
Looking for coRpSE? He is gone till May. General Chat coRpSE 4 Sun Mar 26, 2017 6:50 pm
coRpSE View latest post
Think I got hit with malware somehow General Support bobdude 10 Sun Mar 26, 2017 6:44 pm
coRpSE View latest post
error log Bugs Redcougarxr7 31 Tue Mar 21, 2017 8:46 pm
coRpSE View latest post
I seem to be locked out of my website Smile General Support storm 4 Sat Mar 11, 2017 12:29 pm
coRpSE View latest post

DB Importation Error Code

 
Post new topic    Reply to topic    printer-friendly view   Thank Post    Evolution-Xtreme Forum Index -> Install -> Site Upgrade
View previous topic :: View next topic  
Author Message
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Wed Apr 13, 2011 2:03 pm Post subject: No icon DB Importation Error Code Reply with quote

 Hello,  am  attempting  to  create  a  proper  error  message  for  DB  admin  module.  For  the  Import  SQL  File  function,  an  error  message  will  be  generated  when  no  file  is  specified,  but  it  is  placed  atop  the  table  that  is  generated  when  importation  is  successful.  Have  placed  the  error  statement  in  between  the  break  as  sampled  below...
 
                                                 
PHP:                
    case 'RestoreDB':
        include_once(
NUKE_BASE_DIR.'header.php');
        
GraphicAdmin();
OpenTable();
        echo 
"<center><font class=\"title\"><b><a href=\"$admin_file.php?op=database\">" _DATABASE_ADMIN_HEADER "</a></b></font></center>";
        
CloseTable();
        echo 
"<br />";
        require_once(
NUKE_CLASSES_DIR.'class.database.php');
        
$cache->clear();
        
OpenTable();
        echo 
'<center><span><strong>'._DATABASE.': '.$dbname.'</strong></span><br /><br />';
        if (!
DB::query_file($_FILES['sqlfile'], $error)) { echo($error); }
        echo 
'<br /><br />'.sprintf(_IMPORTSUCCESS$_FILES['sqlfile']['name']);
        
CloseTable();
        include_once(
NUKE_BASE_DIR.'footer.php');
        break;

    case 
'backup':
    case 
'database':
        include_once(
NUKE_BASE_DIR.'header.php'); 
               

 This  will  insert  the  error  message  nicely  between  the  two  lines  but  looks  bad  with  successful  importation.  Would  need  an  if  else  type  statement,  but  do  not  know  how  to  do.  Any  assistance  would  be  appreciated.  Thanks!
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Wed Apr 13, 2011 2:19 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 ...and  here  is  DB  error  function  from  includes/classes/class.database.php
 
                                                 
PHP:                
   function query_file($file, &$error$replace_prefix=false)
    {
        
$error false;
        if (!
is_array($file)) {
            
$tmp['name'] = $tmp['tmp_name'] = $file;
            
$tmp['type'] = preg_match("/.gz$/is",$file) ? 'application/x-gzip' 'text/plain';
            
$file $tmp;
        }
        if (empty(
$file['tmp_name']) || empty($file['name'])) echo('ERROR no file specified!');
        
// Most servers identify a .gz as x-tar
//        if (preg_match("/^(text/[a-zA-Z]+)|(application/(x-)?gzip(-compressed)?)|(application/octet-stream)$/is", $file['type'])) {
        
if (preg_match("/^(text/[a-zA-Z]+)|(application/(x-)?(gzip|tar)(-compressed)?)|(application/octet-stream)$/is"$file['type'])) {
            
$filedata '';
            
$open 'gzopen';
            
$eof 'gzeof';
            
$read 'gzgets';
            
$close 'gzclose';
            if (!
GZIPSUPPORT) {
                if (
preg_match("/.gz$/is",$file['name'])) {
                    
$error "Can't decompress file";
                    return 
false;
                }
                
$open 'fopen';
                
$eof 'feof';
                
$read 'fread';
                
$close 'fclose';
            }
            
$rc $open($file['tmp_name'], 'rb');
            if (
$rc) {
                while (!
$eof($rc)) $filedata .= $read($rc100000);
                
$close($rc);
            } else {
                
$error 'Couldn't open '.$file['tmp_name'].' for processing';
            }
        } else {
            $error = "Invalid filename: $file[type] $file[name]";
        }
        if ($error) { return false; }
        $filedata = DB::remove_remarks($filedata);
        $queries = DB::split_sql_file($filedata, ";n");
        if (count($queries) <1> $newprefix) {
                    if ($oldprefix != $newprefix) {
                        $query = preg_replace("/$oldprefix/", $newprefix, $query);
                    }
                }
            }
            if (SQL_LAYER == '
mysql' || SQL_LAYER == 'mysqli' && ereg('^CREATE TABLE ', $query) && !eregi('ENGINE=MyISAM', $query))
            {
                $query .= ' 
ENGINE=MyISAM';
            }
            $db->sql_query($query);
        }
        return true;
    } 
               
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
killigan
Xtreme Developer
Xtreme Developer
DFG Developer
DFG Developer



Gender: Gender:Male
Joined: Oct 08, 2008
Posts: 2442

Reputation: 35012.3
votes: 6
usa.png


Status: Offline
PostPosted: Wed Apr 13, 2011 8:38 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 Are  you  trying  to  use  the  Database  mod  in  evo?  If  so,  it  doesn't  really  work.  It  actually  corrupts  the  database  if  you  backup  with  it  and  I  am  not  so  sure  on  the  import.  I  know  that  we  are  taking  it  out  of  xtreme  except  for  the  optimize  function.
Back to top
View user's profile Send private message Visit poster's website Visit member's Facebook: 154164544594519
Sponsor
webstorm.jpg
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 10:24 am Post subject: No icon Re: DB Importation Error Code Reply with quote

 Importation  works  flawless.  Have  tested  backup  and  do  not  believe  the  module  is  corrupting  the  mysql  output,  but  rather  the  case  of  improper  db  structure.  For  instance,  "nuke_nsnst_tracked_ips"  will  come  up  with  an  error  of  "#1170  -  BLOB/TEXT  column  'user_agent'  used  in  key  specification  without  a  key  length".
 
 What  is  more  relevant  is,  how  to  write  the  "if  else"  that  I  requested.  I  could  go  to  non-nuke  related  php  coding  forums,  but  then  I  would  have  to  explain  the  CMS  I  am  using.  Thanks  for  the  reply,  killigan  -  as  always,  support  second-to-none!  Cool  
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
killigan
Xtreme Developer
Xtreme Developer
DFG Developer
DFG Developer



Gender: Gender:Male
Joined: Oct 08, 2008
Posts: 2442

Reputation: 35012.3
votes: 6
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 11:13 am Post subject: No icon Re: DB Importation Error Code Reply with quote

 I  haven't  had  a  change  to  really  get  into  the  code  and  since  I  don't  have  the  entire  code  your  writing  I  can't  really  check  everything.  However,  if  you  just  want  to  echo  the  error  if  it  exists  else  echo  success  then  you  can  try  this.
 
 
                                                 
PHP:                
   case 'RestoreDB':
        include_once(
NUKE_BASE_DIR.'header.php');
        
GraphicAdmin();
OpenTable();
        echo 
"<center><font class=\"title\"><b><a href=\"$admin_file.php?op=database\">" _DATABASE_ADMIN_HEADER "</a></b></font></center>";
        
CloseTable();
        echo 
"<br />";
        require_once(
NUKE_CLASSES_DIR.'class.database.php');
        
$cache->clear();
        
OpenTable();
        echo 
'<center><span><strong>'._DATABASE.': '.$dbname.'</strong></span><br /><br />';
        if (!
DB::query_file($_FILES['sqlfile'], $error)) { 
        echo(
$error); 
        }else{
        echo 
'<br /><br />'.sprintf(_IMPORTSUCCESS$_FILES['sqlfile']['name']);
        }
        
CloseTable();
        include_once(
NUKE_BASE_DIR.'footer.php');
        break;

    case 
'backup':
    case 
'database':
        include_once(
NUKE_BASE_DIR.'header.php'); 
               
Back to top
View user's profile Send private message Visit poster's website Visit member's Facebook: 154164544594519
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 1:13 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 Thank  you,  very  much!  Working  and  very  clean  -  now  I  remember  why  I  like  to  give  you  my  money   Wink  
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sponsor
webstorm.jpg
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 1:25 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 With  regards  to  the  backup  function,  have  not  tested  on  large  database  yet.  But,  so  far  testing  has  shown  more  how  the  backup  routine  can  point  out  fundamental  errors  in  table  structure.  For  example,  the  "nsnst_tracked_ips"  table  is  coded  as  such...
 
                                                 
Code:                

 CREATE  TABLE  nuke_nsnst_tracked_ips  (
     tid  int(10)  NOT  NULL  auto_increment,
     ip_addr  varchar(15)  NOT  NULL,
     ip_long  int(10)  unsigned  DEFAULT  '0'  NOT  NULL,
     user_id  int(11)  DEFAULT  '1'  NOT  NULL,
     username  varchar(60)  NOT  NULL,
     user_agent  text  NOT  NULL,
     refered_from  text  NOT  NULL,
     date  int(20)  DEFAULT  '0'  NOT  NULL,
     page  text  NOT  NULL,
     x_forward_for  varchar(32)  NOT  NULL,
     client_ip  varchar(32)  NOT  NULL,
     remote_addr  varchar(32)  NOT  NULL,
     remote_port  varchar(11)  NOT  NULL,
     request_method  varchar(10)  NOT  NULL,
     c2c  varchar(2)  DEFAULT  '00'  NOT  NULL,
     PRIMARY  KEY  (tid),
     KEY  ip_addr  (ip_addr),
     KEY  ip_long  (ip_long),
     KEY  user_id  (user_id),
     KEY  username  (username),
     KEY  `user_agent`  (`user_agent`(255)),
     KEY  `refered_from`  (`refered_from`(255)),
     KEY  `date`  (`date`),
     KEY  `page`  (`page`(255)),
     KEY  c2c  (c2c)
 );
                 

 Proper  table  structure  would  dictate  that  "user_agent",  "refered_from"  and  "page"  be  removed  from  "KEY"  and  changed  to  "varchar(255)"  from  "text".  The  proper  table  structure  is  as  follows...
 
                                                 
Code:                

 CREATE  TABLE  `nuke_nsnst_tracked_ips`  (
   `tid`  int(10)  NOT  NULL  auto_increment,
   `ip_addr`  varchar(15)  NOT  NULL  default  '',
   `ip_long`  int(10)  unsigned  NOT  NULL  default  '0',
   `user_id`  int(11)  NOT  NULL  default  '1',
   `username`  varchar(60)  NOT  NULL  default  '',
   `user_agent`  varchar(255)  NOT  NULL,
   `refered_from`  varchar(255)  NOT  NULL,
   `date`  int(20)  NOT  NULL  default  '0',
   `page`  varchar(255)  NOT  NULL,
   `x_forward_for`  varchar(32)  NOT  NULL  default  '',
   `client_ip`  varchar(32)  NOT  NULL  default  '',
   `remote_addr`  varchar(32)  NOT  NULL  default  '',
   `remote_port`  varchar(11)  NOT  NULL  default  '',
   `request_method`  varchar(10)  NOT  NULL  default  '',
   `c2c`  varchar(2)  NOT  NULL  default  '00',
   PRIMARY  KEY   (`tid`),
   KEY  `ip_addr`  (`ip_addr`),
   KEY  `ip_long`  (`ip_long`),
   KEY  `user_id`  (`user_id`),
   KEY  `username`  (`username`),
   KEY  `date`  (`date`),
   KEY  `c2c`  (`c2c`)
 )  ENGINE=MyISAM   DEFAULT  CHARSET=utf8  AUTO_INCREMENT=28076  ;
                 

 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
killigan
Xtreme Developer
Xtreme Developer
DFG Developer
DFG Developer



Gender: Gender:Male
Joined: Oct 08, 2008
Posts: 2442

Reputation: 35012.3
votes: 6
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 1:38 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 Well,  the  Keys  your  removing  are  just  indexes  which  speed   up  the  table.  You  can  delete  them  all  if  you  wanted  to.  
 
 As  for  changing  page  to  varchar  255  you  might  want  to  see  what  is  actually  put  in  the  row.  Well,  it  is  the  url  of  the  page  the  user  is  on.  So,  if  the  url  has  more  than  255  characters  then  everything  over  255  will  be  dropped.  This  will  do  nothing  other  than  give  you  bad  links  if  you  tried  to  check  the  urls.  
 
 You  can't  go  over  255  with  varchar  but  you  can  with  text.  Which  is  probably  why  text  was  used  and  not  varchar.  
 
 On  another  note,  I  don't  think  you  can  change  all  the  tables  and  alter  the  ones  that  use  text  just  so  the  backup  works.  The  ones  that  use  text  now  are  because  it  is  needed.
Back to top
View user's profile Send private message Visit poster's website Visit member's Facebook: 154164544594519
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 2:02 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 But,  as  structured  in  KEYS,  is  not  the  restriction  of  255  been  imposed?
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sponsor
phpstorm.jpg
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 2:42 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 Functionality  has  not  been  impeded  due  changes  made.  The  DB  is  being  populated.  You  do  bring  up  a  valid  concern  though.  Maybe  I  will  just  remove  the  three  keys  then.  The  performance  hit  should  be  negligible,  ya  think?
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
killigan
Xtreme Developer
Xtreme Developer
DFG Developer
DFG Developer



Gender: Gender:Male
Joined: Oct 08, 2008
Posts: 2442

Reputation: 35012.3
votes: 6
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 5:39 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 The  performance  probably  won't  be  affected  at  all.  Although  I  personally  suggest  everyone  turn  off  tracked  ips.  It  is  a  nice  feature  if  you  suspect  someone  is  abusing  your  site  and  want  to  keep  an  eye  on  them,  but  it  is  otherwise  a  waste  of  a  lot  of  resources  and  slows  the  site  down.  This  would  be  more  noticeable  if  the  site  had  a  lot  of  traffic.
Back to top
View user's profile Send private message Visit poster's website Visit member's Facebook: 154164544594519
forgotz
Xtreme Contributor
Xtreme Contributor




Joined: Mar 23, 2011
Age: 52
Posts: 79
Location: Boston
Reputation: 4.9
usa.png


Status: Offline
PostPosted: Thu Apr 14, 2011 7:11 pm Post subject: No icon Re: DB Importation Error Code Reply with quote

 I  see,  all  is  clear  now.  Conceptually,  you  have  helped  me  wrap  my  head  around  the  whole  process  better  Smile  
 
 -K
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sponsor
webstorm.jpg
Display posts from previous:
Post new topic  Reply to topic   printer-friendly view   Thank Post Evolution-Xtreme Forum Index -> Install ->  Site Upgrade All times are UTC - 5 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Brazilian language files Post - Translation in Progress 14 Todikovic 8082 Wed Nov 26, 2014 5:23 pm
Sonikboy View latest post
No new posts Help required to CHMOD files............ 10 Evil_Blue 3863 Wed Nov 24, 2010 3:59 pm
Evil_Blue View latest post
No new posts I have found a way to embed long text files... 2 Thomas 2339 Mon Nov 08, 2010 12:56 am
Thomas View latest post
No new posts Missing Files according to logging webhost 3 nemesisNL 2629 Sun Oct 17, 2010 5:09 pm
SgtLegend View latest post
No new posts How do i install 2 .sql files into my database??? 1 Evil_Blue 2316 Sun Sep 26, 2010 9:47 am
SgtLegend View latest post
 




Powered by phpBB © 2001, 2006 phpBB Group
EvoXtreme Theme by SgtLegend ©
Forums ©