Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
XML feed wont run - server and coding all tested
Old 06-12-2010, 09:39 AM XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Ive got a problem with RSS feeds that are slow to load.
My RSS feed started to time out and slow my whole site so I had to temporarily disable RSS feeds. Once they are disabled the site runs fine. Since titles and story content continue to be fetched ok from database and server, we recon the server and database and CMS scripts are ok.

Because I needed to disable the RSS on main site. I set up two sites with RSS feeds that are on the same server.
http://www.flightstation.co.uk/index1.php
http://www.homesplaces.co.uk/index1.php
The one on homesplaces is similar to the full setup that failed on main site [same database and stories with paths changed for homesplaces]. Fails completely to load and wont pass validation - simply times out.
The one on flightstation is similar to the full setup that failed on ukcitymedia - except, I deleted entries down to about 40 so that the feed loads ok and passes validation. [same database and stories with paths changed for flightstation].

I believe it must be something else within XML and RSS technology and not CMS, mySQL or server.

Ok
Im really struggling to find experts that can help me. Im just hoping that you may have an RSS / Feeds guru that may have an idea what the problem could be - or some testing tools - or anything.

Im totally stumped !


I attach the CMS code below
rss.php
config.php
mysql.php

PHP Code:
<?php 
/*********************************************************************** 
  N-13 News is a free news publishing system 
  Copyright (C)  
   ***********************************************************************/ 
define('ABSPATH'dirname(__FILE__) . '/' ); 
require_once(
ABSPATH 'db.php'); 
require_once(
ABSPATH 'config.php'); 
$_GET['feed'] = (empty($_GET['feed'])) ? '' $_GET['feed']; 
$feed $_GET['feed']; 
$rssexists DataAccess::fetch("SELECT name,location,title,description,encoding,language,amounttodisplay,rsscode,nocats,feedid FROM " NEWS_FEEDS " WHERE name = ?"$feed); 
if(!
$rssexists){ 
    die(
"RSS Feed doesn't exist.");     

$all            $rssexists['0']; 
$rsslanguage    $all['language']; 
$rssdescription    $all['description']; 
$rssencoding    $all['encoding']; 
$rsstitle        $all['title']; 
$rssamount        slash2($all['amounttodisplay']); 
$newslocation    $all['location']; 
$rsscode        $all['rsscode']; 
$feedid            $all['feedid']; 
$nocats            $all['nocats']; 
if(
$rssamount == "0"){ 
    
$rssamount '999999';    

if(!
$newslocation){ 
    die(
"RSS Feed not configured. Please login to the admin area goto <b>Options</b> > <b>RSS Feeds</b>"); 

header("Content-type: text/xml"); 
$feedlocation "TAKEN OUT BY POSTER" $_SERVER['TAKEN OUT BY POSTER_HOST'] . $_SERVER['PHP_SELF'] . "?feed=" $_GET['feed']; 
echo 
'<?xml version="1.0" encoding="'.$rssencoding.'" ?>'
?> 
<rss version="2.0" xmlns:atom="TAKEN OUT BY POSTER"> 
 <channel> 
 <atom:link href="<?php echo $feedlocation?>" rel="self" type="application/rss+xml" /> 
   <title><?php echo $rsstitle?></title> 
   <link><?php echo $newslocation?></link> 
   <language><?php echo $rsslanguage?></language> 
   <description><?php echo $rssdescription?></description> 
   <!-- RSS 2.0 file generated by N-13 News --> 
   <generator>N-13 News</generator> 
<?php 
    $prefix 
DataAccess::fetch("SELECT furlprefix FROM " NEWS_OPTIONS " WHERE 1"); 
    
$prefix $prefix['0']['furlprefix']; 
    
//select all categories this rss feed has been assigned 
    //then select all news posts assigned to those same cats 
    //if nocats = 1 also select all posts not assigned to cats 
    
$sql "SELECT title,story,shortstory,author,origauthor,ip,timestamp,allowcomments,short,approved,viewcount,rating,  archivedate,neverarchive,archived,id,  
    " 
NEWS_USERS ".user AS authorname,  
    " 
NEWS_USERS ".avatar AS authoravatar,  
    commentcount AS comments 
    FROM " 
NEWS_ARTICLES " INNER JOIN " NEWS_USERS " ON " NEWS_ARTICLES ".author = " NEWS_USERS ".uid WHERE id IN ("
        if(
$nocats == "1"){ 
            
$sql .= "SELECT id AS storyid FROM " NEWS_ARTICLES " WHERE id NOT IN (SELECT storyid FROM " NEWS_GROUPCATS " WHERE type = 'news') UNION "
        }                 
    
$sql .= "SELECT storyid FROM " NEWS_GROUPCATS " WHERE type = 'news' AND catid IN (SELECT catid FROM " NEWS_GROUPCATS " WHERE type = 'rss' AND storyid = ?) ) AND archived = '0' ORDER BY timestamp DESC LIMIT 0, $rssamount"
    
$newsstories DataAccess::fetch($sql$feedid); 
    foreach(
$newsstories AS $row){ 
        if(
FRIENDLY){ 
            
$fullurl $newslocation $prefix $row['id'] . "/0/" makefriendly($row[title]); 
        }else{ 
            
$fullurl $newslocation '?id=' $row['id'];  
        } 
        
$sql3 "SELECT " NEWS_CATS ".name AS catname FROM " NEWS_GROUPCATS " INNER JOIN " NEWS_CATS " ON " NEWS_GROUPCATS ".catid = " NEWS_CATS ".id WHERE storyid = '?' AND type = 'news' ORDER BY " NEWS_CATS ".name ASC"
        
$cats DataAccess::fetch($sql$row['id']); 
        
$categories ''
        foreach(
$cats AS $row3){ 
            
$row3['catname'] = (empty($row3['catname'])) ? '' $row3['catname']; 
            
$categories .= $row3['catname'] . CATDELIMITER
        } 
        
$categories substr($categories,0,strlen($categories) - strlen(CATDELIMITER)); 
        
$rsstemplate $rsscode
        
$rsstemplate str_replace("{categories}",$categories,$rsstemplate);     
        
$rsstemplate str_replace("{title}",displayhtml($row['title']),$rsstemplate); 
        
$rsstemplate str_replace("{friendlytitle}"makefriendly($row['title']), $rsstemplate); 
        
$rsstemplate str_replace("{url}",$fullurl,$rsstemplate); 
        
$rsstemplate str_replace("{shortstory}",bbcode($row['shortstory'],0),$rsstemplate); 
        
$rsstemplate str_replace("{story}",bbcode($row['story'],0),$rsstemplate); 
        
$rsstemplate str_replace("{date}",date("D, j M Y h:i:s",$row['timestamp']),$rsstemplate); 
        
$rsstemplate str_replace("{timezone}",TIMEZONE,$rsstemplate); 
        
$rsstemplate str_replace("{timestamp}",$row['timestamp'],$rsstemplate); 
        
$rsstemplate str_replace("{author}",$row['authorname'],$rsstemplate); 
        
$rsstemplate str_replace("{avatar}",sprintf("<img src=\"%s\" />"$row['authoravatar']),$rsstemplate); 
        
$rsstemplate str_replace("{id}",$row['id'],$rsstemplate); 
        
$rsstemplate str_replace("{comments}",$row['comments'],$rsstemplate); 
        echo 
$rsstemplate
        unset(
$categories);     
    } 
?> 
</channel> 
</rss>


end of rss.php
strat of config.php




PHP Code:
<?php
/***********************************************************************
  N-13 News is a free news publishing system
  Copyright (C) 2010 Chris Watt
  
  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 3 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
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
  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, see <[URL]http://www.gnu.org/licenses/[/URL]>.
***********************************************************************/
// Adds the security key image to the admin login form, 1 = on 0 = off
$image_verification 0
// Specify here which language should be used on the login module
$default_login_language 'english';
// Specify here which language should be used on the index.php file
$default_index_language 'english';
// Default options for the add news form
$newsform_options['toggle_archive']  = 0// 0 = Hide archive options, 1 = Show the archive options
$newsform_options['never_archive']  = 1// 0 = Never archive is not selected, 1 = Never archive is selected
$newsform_options['toggle_date']  = 0// 0 = Hide date options, 1 = Date options are shown
$newsform_options['short_story']  = 0// 0 = Hide short story, 1 = Short story section is shown by default
$newsform_options['allow_comments']  = 1// Default comment options. 0 = No, 1 = Yes, 2 = Needs approval
// Enable or disable automatic creation of thumbnails when viewing uploaded images
// If you're having trouble viewing the thumbnails change this to 0
$imageupload_thumbnails 1;
// Amount of characters to cut off the category delimiter when displaying categories
// Example 'Cat1, Cat2, Cat3, ' Notice the ending ', ' characters, specifying $catcutoff = 2 will get rid of that
$catcutoff 2;
// Set the language used for formatting dates
setlocale(LC_ALL'eng');

/*------ NO NEED TO EDIT BELOW ---------*/
if(!defined('ABSPATH')){
 
define('ABSPATH'dirname(__FILE__) . '/' );
}
// if using the old db.php define constants here
if(isset($cfg)){
 if(
is_array($cfg)){
  
define('HOSTNAME'$cfg['hostname']);
  
define('USER',  $cfg['user']);
  
define('PASS',  $cfg['pass']);
  
define('DATABASE'$cfg['database']);
  
define('PORT',  $cfg['port']);
  
define('SOCKET'$cfg['socket']);
  if(empty(
$cfg['extension'])){ 
   
define('EXTENSION''mysql');
  }
 }
}

require_once(
ABSPATH '/functions.php');
require_once(
ABSPATH '/bbparser.php');
require_once(
ABSPATH '/recaptchalib.php');
$alloptions DataAccess::fetch("SELECT * FROM " NEWS_OPTIONS " WHERE 1");
$registrationverification $alloptions['0']['registrationverification'];
define('SPAMTIME',    $alloptions['0']['spamtime']);
define('SPAMMSG',    $alloptions['0']['spammsg']);
define('COMMENTMSG',   $alloptions['0']['commentmsg']);
define('REGCOMMENT',   $alloptions['0']['regcomment']);
define('COMMENTAPPROVEMSG',  $alloptions['0']['commentapprovemsg']);
define('TIMEZONE',    $alloptions['0']['timezone']);
define('BANNEDMSG',    $alloptions['0']['bannedmsg']);
define('COMMENTSORDER',   $alloptions['0']['commentsorder']);
define('CATDELIMITER',   $alloptions['0']['catdelimiter']);
define('COMMENTSNOTIFY',  $alloptions['0']['commentsnotify']);
define('REGISTERNOTIFY',  $alloptions['0']['registernotify']);
define('EMAILNOTIFY',   $alloptions['0']['emailnotify']);
define('UNAPPROVEDNOTIFY',  $alloptions['0']['unapprovednotify']);
define('USEIMGVERIFICATION'$alloptions['0']['useimgverification']);
define('UPLOADPATH',   $alloptions['0']['uploadpath']);
define('SALT',     $alloptions['0']['salt']);
define('COMMENTSLENGTH',  $alloptions['0']['commentslength']);
define('REGISTRATIONALLOW',  $alloptions['0']['registrationallow']);
define('REGISTRATIONACCESS'$alloptions['0']['registrationaccess']);
define('REGISTRATIONVERIFICATION'$alloptions['0']['registrationverification']);
define('PUBLICKEY',    $alloptions['0']['publickey']);
define('PRIVATEKEY',   $alloptions['0']['privatekey']);
define('TAIL',     $alloptions['0']['tail']);
define('ENABLETAIL',   $alloptions['0']['enabletail']);
define('FRIENDLY',    $alloptions['0']['furlenabled']);
define('FILETIME',    $alloptions['0']['filetime']);
define('DELETEOWNCOMMENTS',  $alloptions['0']['deleteowncomments']);
define('LOGINVERIFICATION',  $alloptions['0']['loginverification']);
define('NOACCESSMSG',   $alloptions['0']['noaccessmsg']);
define('NEWSTIME',    $alloptions['0']['newstime']);
define('COMMENTSTIME',   $alloptions['0']['commentstime']);
define('TEMPLATE',    $alloptions['0']['template']);
define('NPPAGE',    $alloptions['0']['nppage']);
define('CPPAGE',    $alloptions['0']['cppage']);
define('NEWSORDER',    $alloptions['0']['newsorder']);
define('SUFFIX',  $alloptions['0']['furlextension']);
define('NEWSSUFFIX'$alloptions['0']['furldirname']);
define('PREFIX',  $alloptions['0']['furlprefix']);
define('IMAGEPATH',  $alloptions['0']['scriptpath'] . "http://www.webmaster-talk.com/images/");
define('ADMINPATH',  $alloptions['0']['scriptpath'] . "admin.php");
define('SCRIPTPATH'$alloptions['0']['scriptpath']);
$version  $alloptions['0']['version'];
$url    explode("/",$_SERVER['REQUEST_URI']);
$imageuploaddir 'uploads/'#slash at the end is important!
unset($alloptions);
define('SMILIES'serialize(DataAccess::fetch("SELECT keycode, path FROM " NEWS_SMILIES)));
define('FILTERS'serialize(DataAccess::fetch("SELECT filter, alt FROM " NEWS_FILTER)));

#archive any posts that need to be.
DataAccess::put("UPDATE " NEWS_ARTICLES " SET archived = ? WHERE archivedate <= ? AND neverarchive = ?""1"time(), "0");
?>
end of config.php
start of mysql.php




PHP Code:
<?php
/***********************************************************************
  N-13 News is a free news publishing system
  Copyright (C) 2010 Chris Watt
  
  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 3 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
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
  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, see <[URL]http://www.gnu.org/licenses/[/URL]>.
***********************************************************************/
class DataAccess {
 function 
establish_db_conn(){
  
$connection mysql_connect(HOSTNAME.":".PORT,USER,PASS);
  
$db   mysql_select_db(DATABASE);
  return 
$connection
 }
 function 
put() {
  
$args func_get_args();
  
$sql array_shift($args);
  
$link DataAccess::establish_db_conn();
  if(
count($args) > 0){
   
$sqlparts explode("?"$sql);
   
$newsql '';
   
$x 0;
   foreach(
$sqlparts AS $part){
    if(isset(
$args[$x])){
     
$argpart $args[$x];
    }else{
     
$argpart '';
    }
    
$argpart mysql_escape_string($argpart);
    
$newsql  .= $part;
    if(
$x count($args)){
     
$newsql .= sprintf("'%s'"$argpart);
    }
    
$x++;
   }
  }else{
   
$newsql $sql;
  }
  
$query mysql_query($newsql);
  if(
$query){
   
$_SESSION['insert_id'] = mysql_insert_id();
   return 
true;
  }else{
   
$error mysql_error($link);
   die(
'<strong style="color: #AA0000">Error</strong>: ' $error ' <br /><strong style="color: #AA0000">Statement</strong>: ' $sql ' <br /><strong style="color: #AA0000">Arguments</strong>: ' implode(","$args));
   return 
false;
  }
  
 }
 function 
fetch() {
  
$args func_get_args();
  
$sql array_shift($args);
  
$link DataAccess::establish_db_conn();  
  if(
count($args) > 0){
   
$sqlparts explode("?"$sql);
   
$newsql  '';
   
$x 0;
   foreach(
$sqlparts AS $part){
    if(isset(
$args[$x])){
     
$argpart $args[$x];
    }else{
     
$argpart '';
    }
    
$argpart mysql_escape_string($argpart);
    
$newsql  .= $part;
    if(
$x count($args)){
     
$newsql .= sprintf("'%s'"$argpart);
    }
    
$x++;
   }
  }else{
   
$newsql $sql;
  }
  
  
$query mysql_query($newsql);
  if(
$query){
   
$results = array();
   
$x 0;
   while(
$row mysql_fetch_assoc($query)){
    foreach(
$row AS $key => $val){ $results[$x][$key] = $val; }
    
$x++;
   }
   return 
$results;
  }else{
   
$error mysql_error($link);
   die(
'<strong style="color: #AA0000">Error</strong>: ' $error ' <br /><strong style="color: #AA0000">Statement</strong>: ' $sql ' <br /><strong style="color: #AA0000">Arguments</strong>: ' implode(","$args));
   return 
false;
  }
 }
}
?> 
     

 
<?php/***********************************************************************  N-13 News is a free news publishing system  Copyright (C) 2010 Chris Watt    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 3 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  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the  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, see <http://www.gnu.org/licenses/>.***********************************************************************/// Adds the security key image to the admin login form, 1 = on 0 = off$image_verification = 0;    // Specify here which language should be used on the login module$default_login_language = 'english';// Specify here which language should be used on the index.php file$default_index_language = 'english';// Default options for the add news form$newsform_options['toggle_archive']        = 0; // 0 = Hide archive options, 1 = Show the archive options$newsform_options['never_archive']        = 1; // 0 = Never archive is not selected, 1 = Never archive is selected$newsform_options['toggle_date']        = 0; // 0 = Hide date options, 1 = Date options are shown$newsform_options['short_story']        = 0; // 0 = Hide short story, 1 = Short story section is shown by default$newsform_options['allow_comments']        = 1; // Default comment options. 0 = No, 1 = Yes, 2 = Needs approval// Enable or disable automatic creation of thumbnails when viewing uploaded images// If you're having trouble viewing the thumbnails change this to 0$imageupload_thumbnails = 1;// Amount of characters to cut off the category delimiter when displaying categories// Example 'Cat1, Cat2, Cat3, ' Notice the ending ', ' characters, specifying $catcutoff = 2 will get rid of that$catcutoff = 2;// Set the language used for formatting datessetlocale(LC_ALL, 'eng');/*------ NO NEED TO EDIT BELOW ---------*/if(!defined('ABSPATH')){    define('ABSPATH', dirname(__FILE__) . '/' );}// if using the old db.php define constants hereif(isset($cfg)){    if(is_array($cfg)){        define('HOSTNAME',    $cfg['hostname']);        define('USER',        $cfg['user']);        define('PASS',        $cfg['pass']);        define('DATABASE',    $cfg['database']);        define('PORT',        $cfg['port']);        define('SOCKET',    $cfg['socket']);        if(empty($cfg['extension'])){             define('EXTENSION',    'mysql');        }    }}require_once(ABSPATH . '/functions.php');require_once(ABSPATH . '/bbparser.php');require_once(ABSPATH . '/recaptchalib.php');$alloptions = DataAccess::fetch("SELECT * FROM " . NEWS_OPTIONS . " WHERE 1");$registrationverification = $alloptions['0']['registrationverification'];define('SPAMTIME',                $alloptions['0']['spamtime']);define('SPAMMSG',                $alloptions['0']['spammsg']);define('COMMENTMSG',            $alloptions['0']['commentmsg']);define('REGCOMMENT',            $alloptions['0']['regcomment']);define('COMMENTAPPROVEMSG',        $alloptions['0']['commentapprovemsg']);define('TIMEZONE',                $alloptions['0']['timezone']);define('BANNEDMSG',                $alloptions['0']['bannedmsg']);define('COMMENTSORDER',            $alloptions['0']['commentsorder']);define('CATDELIMITER',            $alloptions['0']['catdelimiter']);define('COMMENTSNOTIFY',        $alloptions['0']['commentsnotify']);define('REGISTERNOTIFY',        $alloptions['0']['registernotify']);define('EMAILNOTIFY',            $alloptions['0']['emailnotify']);define('UNAPPROVEDNOTIFY',        $alloptions['0']['unapprovednotify']);define('USEIMGVERIFICATION',    $alloptions['0']['useimgverification']);define('UPLOADPATH',            $alloptions['0']['uploadpath']);define('SALT',                    $alloptions['0']['salt']);define('COMMENTSLENGTH',        $alloptions['0']['commentslength']);define('REGISTRATIONALLOW',        $alloptions['0']['registrationallow']);define('REGISTRATIONACCESS',    $alloptions['0']['registrationaccess']);define('REGISTRATIONVERIFICATION',    $alloptions['0']['registrationverification']);define('PUBLICKEY',                $alloptions['0']['publickey']);define('PRIVATEKEY',            $alloptions['0']['privatekey']);define('TAIL',                    $alloptions['0']['tail']);define('ENABLETAIL',            $alloptions['0']['enabletail']);define('FRIENDLY',                $alloptions['0']['furlenabled']);define('FILETIME',                $alloptions['0']['filetime']);define('DELETEOWNCOMMENTS',        $alloptions['0']['deleteowncomments']);define('LOGINVERIFICATION',        $alloptions['0']['loginverification']);define('NOACCESSMSG',            $alloptions['0']['noaccessmsg']);define('NEWSTIME',                $alloptions['0']['newstime']);define('COMMENTSTIME',            $alloptions['0']['commentstime']);define('TEMPLATE',                $alloptions['0']['template']);define('NPPAGE',                $alloptions['0']['nppage']);define('CPPAGE',                $alloptions['0']['cppage']);define('NEWSORDER',                $alloptions['0']['newsorder']);define('SUFFIX',        $alloptions['0']['furlextension']);define('NEWSSUFFIX',    $alloptions['0']['furldirname']);define('PREFIX',        $alloptions['0']['furlprefix']);define('IMAGEPATH',        $alloptions['0']['scriptpath'] . "http://www.webmaster-talk.com/images/");define('ADMINPATH',        $alloptions['0']['scriptpath'] . "admin.php");define('SCRIPTPATH',    $alloptions['0']['scriptpath']);$version        = $alloptions['0']['version'];$url             = explode("/",$_SERVER['REQUEST_URI']);$imageuploaddir = 'uploads/'; #slash at the end is important!unset($alloptions);define('SMILIES',    serialize(DataAccess::fetch("SELECT keycode, path FROM " . NEWS_SMILIES)));define('FILTERS',    serialize(DataAccess::fetch("SELECT filter, alt FROM " . NEWS_FILTER)));#archive any posts that need to be.DataAccess::put("UPDATE " . NEWS_ARTICLES . " SET archived = ? WHERE archivedate <= ? AND neverarchive = ?", "1", time(), "0");?>end of config.phpstart of mysql.php<?php/***********************************************************************  N-13 News is a free news publishing system  Copyright (C) 2010 Chris Watt    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 3 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  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the  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, see <http://www.gnu.org/licenses/>.***********************************************************************/class DataAccess {    function establish_db_conn(){        $connection    mysql_connect(HOSTNAME.":".PORT,USER,PASS);        $db            mysql_select_db(DATABASE);        return $connection;     }    function put() {        $args    func_get_args();        $sql    array_shift($args);        $link    DataAccess::establish_db_conn();        if(count($args) > 0){            $sqlparts explode("?"$sql);            $newsql '';            $x 0;            foreach($sqlparts AS $part){                if(isset($args[$x])){                    $argpart    $args[$x];                }else{                    $argpart '';                }                $argpart    mysql_escape_string($argpart);                $newsql        .= $part;                if($x count($args)){                    $newsql    .= sprintf("'%s'"$argpart);                }                $x++;            }        }else{            $newsql $sql;        }        $query mysql_query($newsql);        if($query){            $_SESSION['insert_id'] = mysql_insert_id();            return true;        }else{            $error mysql_error($link);            die('<strong style="color: #AA0000">Error</strong>: ' $error ' <br /><strong style="color: #AA0000">Statement</strong>: ' $sql ' <br /><strong style="color: #AA0000">Arguments</strong>: ' implode(","$args));            return false;        }            }    function fetch() {        $args    func_get_args();        $sql    array_shift($args);        $link    DataAccess::establish_db_conn();                if(count($args) > 0){            $sqlparts    explode("?"$sql);            $newsql        '';            $x 0;            foreach($sqlparts AS $part){                if(isset($args[$x])){                    $argpart    $args[$x];                }else{                    $argpart '';                }                $argpart    mysql_escape_string($argpart);                $newsql        .= $part;                if($x count($args)){                    $newsql    .= sprintf("'%s'"$argpart);                }                $x++;            }        }else{            $newsql $sql;        }                $query mysql_query($newsql);        if($query){            $results = array();            $x 0;            while($row mysql_fetch_assoc($query)){                foreach($row AS $key => $val){ $results[$x][$key] = $val; }                $x++;            }            return $results;        }else{            $error mysql_error($link);            die('<strong style="color: #AA0000">Error</strong>: ' $error ' <br /><strong style="color: #AA0000">Statement</strong>: ' $sql ' <br /><strong style="color: #AA0000">Arguments</strong>: ' implode(","$args));            return false;        }    }}?>

Last edited by chrishirst; 06-12-2010 at 01:34 PM..
alan_keys is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-12-2010, 09:44 AM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And this problem is visible how exactly?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 11:29 AM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Hi Chris

Basically the feeds takes so long to load that it just times out. Fails all validation.

So, I disabled on the main site and set up two tests with RSS feeds that are on different domains, but same server as the main site.

http://www.flightstation.co.uk/index1.php
http://www.homesplaces.co.uk/index1.php

The one on homesplaces is similar to the full setup that failed on main site [same database and stories with paths changed for homesplaces]. Fails completely to load and wont pass validation - simply times out.

The one on flightstation is similar to the full setup that failed on ukcitymedia - except, I deleted entries down to about 40 so that the feed loads ok and passes validation. [same database and stories with paths changed for flightstation].
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 11:32 AM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And do we get to see one that fails??


Because it is pretty much impossible to fault find on something that works.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 11:56 AM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Chris

Its identical to the failure at
http://www.homesplaces.co.uk/index1.php

both domains are on the same server.


However I take your point and am enabling the feed the site that matters.
www.ukcitymedia.co.uk

and feed is at
http://www.ukcitymedia.co.uk/news/rss.php?feed=New_News


but I will only leave this up until you have tried the feed. Can you indicate when you have tried it....
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 12:07 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Your code is adding spurious characters into the XML stream

From webbug:
Code:
27
<?xml version="1.0" encoding="UTF-8" ?>
5a
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
 <atom:link href="
3c
http://www.homesplaces.co.uk/news/rss.php?feed=property_news
35
" rel="self" type="application/rss+xml" />
   <title>
f
ttttttttttttttt
12
</title>
   <link>
2f
http://www.homesplaces.co.uk/news/fullstory.php
15
</link>
   <language>
5
en-us
1c
</language>
   <description>
10
dddddddddddddddd
63
</description>
   <!-- RSS 2.0 file generated by N-13 News -->
   <generator>N-13 News</generator>
Consequently the parser is falling over itself.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:09 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Chris

The tttttttttttttttttttttt and the ddddddddddddddddddddd


was me, I will take them out now.
Do you mean the f and 2f and 15 etc........
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 12:16 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Correct, they are nicode characters and they will be interfering with the parser, thus leading to the 500 error.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:19 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Error message
HTML Code:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 webmaster@ukcitymedia.co.uk and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
Check your error log as well.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:20 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Chris

Thank you already for your observation. Any idea why these are being generated ?
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 12:23 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
it looks like hex code doesnt it.....
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 12:32 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by alan_keys View Post
Chris

Thank you already for your observation. Any idea why these are being generated ?
Possibly they are in the database from whatever was used to create the data.

Here is a StripUTF() function to remove them before sending it to the parser.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:35 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Chris

Ill try it.
Where do you think I should add the stripper ?
Disabling the test now on www.ukcitymedia.co.uk
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 12:37 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by alan_keys View Post
it looks like hex code doesnt it.....
It is.

Unicode/UTF characters are 2 bytes (a word, 16bits) in length and anything that is expecting ASCII code 1 byte in length, will try to convert both bytes into individual characters and fail because one will probably convert to a ASCII control code.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:39 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
either where the string is pulled out of the database or before it is echoed out to the datastream.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 12:44 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
Chris

Could you relate that to a position within one of the scripts in post one

rss.php
config.php
mysql.php
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 01:00 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I would suggest at

echo $rsstemplate;

and send $rsstemplate through the function.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 01:09 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
I dont know exactly what the syntax is for that. Ive already tried a couple of guesses but they didnt work.

Can you paste a modified code to go in rss.php
alan_keys is offline
Reply With Quote
View Public Profile
 
Old 06-12-2010, 01:18 PM Re: XML feed wont run - server and coding all tested
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Just the same as any other function, predefined or user defined

echo functionName($rsstemplate);
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-12-2010, 01:28 PM Re: XML feed wont run - server and coding all tested
Average Talker

Posts: 18
Name: alan keys
Trades: 0
unfortunately... im not a coder...
until I get a course in php/mysql which I intend to do.

Can help further else im going to need a coder
alan_keys is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to XML feed wont run - server and coding all tested

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.35524 seconds with 12 queries