Location: PHPKode > scripts > Salary module for PHP Nuke > salary-module-for-php-nuke/salary.0.11.php
<?php

/***************************************************************************
 *                              Salary modul
 *   
 *   copyright            : (C) 2003 PB & MPL
 *   email                :  hide@address.com
 *
 * 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;
 ***************************************************************************/ 


    if (!eregi("modules.php", $PHP_SELF)) {
	die ("You can't access this file directly...");
    }

    include("header.php");
    OpenTable();

require_once("config.php"); 
$sum = 0;

echo "<font face='Arial' size='2'>Sallary modul version 0.11 | <a href='modules.php?name=Salary'>Main page of modul</a><br>";

function safeHTML($text) {
    $text = preg_replace
('/<(script|style)[^>]*>.+<\/(script|style)[^>]*>/is', '', $text);
    $text = ereg_replace ("<([^>]|\n)*>","",$text);
    $text = str_replace('&nbsp;', '', $text);
    $text = str_replace(' ', '', $text);
    $text = str_replace('\n', '', $text);
    return $text;
}


echo "<BR>Author : <B>";
echo $author;
echo "</B><BR>";
$datestart = $yyyys.$mms.$dds."000000";
$dateend = $yyyye.$mme.$dde."000000";

echo "From : $mms $dds $yyyys <BR>";
echo "To :  $mme $dde $yyyye";

echo "<BR>";
echo "<BR>";

$spojenie = MySQL_Connect($dbhost , $dbuname, $dbpass) or die("Nastala chyba pri spojení s databázou.");

mysql_select_db($dbname) or die(" ... nepodarilo sa spojenie na db x-ty krat");

$dopyt = "SELECT aid,counter,time,title,hometext,bodytext,sid FROM nuke_stories WHERE aid = '$author' AND time>=$datestart AND time<$dateend ORDER BY time DESC";
$vysledok = MySQL_Query($dopyt) or die ("Prikaz Select pre db sa nevykonal");



// vypis vysledku na stranku

echo "<table width='98%' border='1' cellspacing='0' bordercolorlight='#99CCFF' bordercolordark='#0000CC' bgcolor='#E1ECE1'>";
                echo "<tr><td>";
                echo "Title";
                echo " </td><td> ";
                echo "Author";
                echo " </td><td> ";
                echo "Date";
                echo " </td><td> ";
                echo "Accessed #times";
                echo " </td><td> ";
                echo "Lenght of html code";
                echo "</td><td>";
                echo "Number of letters in article";
                echo " </td><td> ";
                echo "Payment for article";
                echo "</td></tr>";



	while($line = mysql_fetch_array($vysledok)){
                echo "<tr><td>";
                echo "<font face='Verdana' size=1><a href=/modules.php?name=News&file=article&sid=";
                echo $line["sid"];
                echo ">";
                echo $line["title"];
                echo "</a></font>";                
                echo " </td><td> ";
                echo $line["aid"];
                echo " </td><td> ";
                echo "<font face='Verdana' size=1>";
                echo $line["time"];
                echo "</font>";
                echo " </td><td> ";
                echo $line["counter"];
                echo " </td><td> ";
                echo strlen($line["bodytext"])+strlen($line["hometext"]);
                echo " </td><td> ";
                $nl = strlen(safeHTML($line["bodytext"]))+strlen(safeHTML($line["hometext"]));
                echo $nl;      
                echo " </td><td> ";
                $pa = $nl*$letter*$acoef;
                echo $pa;
                $sum = $sum+$pa;                        
                echo "</td></tr>";
	}

echo "</table>";


echo "<BR><B>Total payment : $sum $currency</B>";

echo "<center><BR><BR><B>(c) 2003 <a href='http://hwsk.sk/salary'>PB & MPL</a></B><center>";

MySQL_Close($spojenie);

    CloseTable();
    include("footer.php");

?>
Return current item: Salary module for PHP Nuke