I don't know how i can make this....
I have this link for my RSS:
http://tutorialspace.ro/rss.php?do=latest Who can i make, or implementing a counter for RSS readers.
Also... can a redefined my RSS design ??
Tks a lot
Hi,
I've experimented with the following which can place a counter on the site statistics.
Add a new table in the database:
Code:
CREATE TABLE `rss` (
`rss_id` int(5) NOT NULL auto_increment,
`ip` varchar(20) NOT NULL default '',
`hits` int(10) NOT NULL default '1',
PRIMARY KEY (`rss_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Next, in rss.php edit as follows:
Code:
require('includes/config.php');
$ip = $_SERVER['REMOTE_ADDR'];
$results = mysql_query("SELECT * FROM `rss` WHERE `ip`='".$ip."'") or die
(mysql_error());
if(mysql_num_rows($results) == 0 ) {
$select = mysql_query("INSERT INTO `rss` (`ip`, `hits`) VALUES ('".$ip."',
'1')") or die(mysql_error());
} else {
$select = mysql_query("UPDATE `rss` SET `hits`=`hits`+1 WHERE
`ip`='".$ip."'");
}
require_once('includes/classes/template.php');
require_once('includes/functions.php');
require_once('includes/global.php');
require_once('includes/classes/tutorial.php');
In global.php edit the "// $statistics array" by adding "total rss subscribers":
Code:
// total tutorial views
$statistics['total_views'] = 0;
$query = "SELECT `views` FROM `tutorial_front` WHERE `approved`='1'";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$statistics['total_views'] += $row['views'];
}
// total rss subscribers
$query = "SELECT COUNT(`rss_id`) AS 'rss_subscribers' FROM `rss`";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
$statistics['rss_subscribers'] = $row['rss_subscribers'];
Then change the "site_statistics" template as follows (hopefully my Romanian is ok

):
Code:
<div class="rightrow1">
<img src="$config[HTTP_SERVER]images/header_icons/online_record.gif"
alt="Online maxim" class="inlineimg" />Online maxim: <span style="fontsize:
12px;">$statistics[most_online]</span>
</div>
<div class="rightrow2">
<img src="$config[HTTP_SERVER]images/header_icons/search_record.gif"
alt="Total cautari" class="inlineimg" />Total cautari: <span style="fontsize:
12px;">$statistics[searches]</span>
</div>
<div class="rightrow1">
<img src="$config[HTTP_SERVER]images/header_icons/total_tutorials.gif"
alt="Total Tutoriale" class="inlineimg" />Total Tutoriale: <span style="fontsize:
12px;">$statistics[total_tutorials]</span>
</div>
<div class="rightrow2">
<img src="$config[HTTP_SERVER]images/header_icons/view_record.gif"
alt="Total Vizualizari" class="inlineimg" />Total Vizualizari: <span style="fontsize:
12px;">$statistics[total_views]</span>
</div>
<div class="rightrow1">
<img src="$config[HTTP_SERVER]images/header_icons/star.gif" alt="RSS
Abonati" class="inlineimg" />RSS Abonati: <span style="fontsize:
12px;">$statistics[rss_subscribers]</span>
</div>
<div class="rightrow2" style="border: 0;">
<img src="$config[HTTP_SERVER]images/header_icons/currently_online.gif"
alt="Online acum" class="inlineimg" />Online acum: <span style="fontsize:
12px;">$statistics[people_online]</span>
</div>
</div>
Make your own rss.gif 16x16 and rescript from the star.gif
Each load of rss.php is added to the database, but filtered by the ip address for display. It's not a true exact count, but ip filtering makes it closer.
Hope this helps.
O yeah ! It's work

thanks james.. you'r the best

I post here because i don't start a new topic. I have a little problem with a new page in tms.
direct link:
http://tutorialspace.ro/download.php
i want to open
http://tutorialspace.ro/descarcare/index.php
i make news templates (download_break / download_start) i make download.php i modify the code in global.php.... but i can't succeed a "redirect" between direct link and what i wont to open.
Details: I want this:
http://tutorialspace.ro/descarcare/index.php between left column and right column. I want that in middle.
Thank for your helps.
P.S. i try with require... with direct link in break template... nothing nothing

Hi,
Here's something to try, though I'm not sure how well it will work in the div. Code from
http://www.dynamicdrive.com/dynamicindex...messi2.htm
Copy the following and save in your root as "download.js"
Code:
// JavaScript Document
/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/
//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]
//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"
var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}
function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}
function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}
function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}
if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller
Next, in your "header" template add above </head>
Code:
<script language="JavaScript" src="$config[HTTP_SERVER]download.js" type="text/JavaScript"></script>
Finally, in your "download_start" template:
Code:
<div class="genmcontainer">
<iframe id="myframe" src="descarcare/index.php" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
</div>
This should work, and resize the height according to the page content. It worked for me in another application so hopefully it will work for you.
Oh ... Nice new banner

Tks james

(banner)
It works....i succeed to make this... but i have 1 problem..the download don't works :|
Yes... i see that, but if you look at the attachement, you'll see that, at localhost it work's. It's work with complex link.... and i try to modify the link.... but without success. Can you help me?

Can you post, or PM the code for descarcare/index.php ? There's a coding error somewhere and I can't detect it in the source so I'd need to look at the php itself.
This is the code for descarcare/index.php
Code:
<?php
session_start(); if ($_GET['m']=="logout") {unset($_SESSION['pw']); session_destroy();} ?>
<?php
// ------------------------- NOTES ------------------------- //
// * This directory browser will not prevent file downloading when password protection is enabled!
// People who know the url of a file will be able to directly download it.
// When absolute protection is required, it is advised to use a .httaccess file in combination with this tool.
// ------------------------- CONFIGURATION ------------------------- //
// You can configure the directory browser in config.php, in the $confDir directory.
$config = array();
$config["config_dir"] = "includes"; // The configuration directory path. This dir will not be listed.
// ------------------------- CONTROLLER CODE ------------------------- //
include($config["config_dir"]."/config.php"); // Include the configuration
include($config["config_dir"]."/library/xmlLogger.php"); // Include the functions needed to log events
// Set session password when entered valid code
if (isset($config["password"]) && isset($_POST['pw'])) $_SESSION['pw'] = $_POST['pw'];
// Get the url pars
$d = $_GET['d']; // Directory path
$s = $_GET['s']; // Sorting type
$r = $_GET['r']; // Sorting (0: ascending, 1: descending)
$f = $_GET['f']; // File name
$m = $_GET['m']; // Mode
$pwEnabled = strlen($config["password"]) > 1;
$pwValid = $_SESSION['pw'] == $config["password"];
if ($m == "dl")
{ // When viewing a file, show or start download, and add the download to the log
if (($pwValid && $pwEnabled) || !$pwEnabled)
{
header("Location: $config[root]$d/$f");
addXmlStatistic(array(time(), $config["root"].$d."/".$f, $_SERVER["REMOTE_ADDR"]), "download");
}
}
else
{ // When viewing a directory, show it's contents and add the visit to the log
// Include the model - the part that gets the data
include($config["config_dir"]."/model.php");
// Get the directory contents - this function is definded in the model
$contents = getDirContents($d, $s, $r, $config["config_dir"], $pwEnabled, $pwValid, $config);
$data = $contents[1]; // The directory meta data
$contents = $contents[0]; // The directory contents
// Include the layout - the basic xhtml structure
// This part will echo the whole page
include($config["config_dir"]."/layout.php");
addXmlStatistic(array(time(), $d, $_SERVER["REMOTE_ADDR"]));
}
?>