Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
8 - 4 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: Link only for special group - code problem
by metin on 2005/6/30 22:05:09

OK. I could solve the problem. Finito.
Re: Link only for special group - code problem
by metin on 2005/6/30 20:09:27

Where i could add the right code in the followin ratefile.php

anonymous & normal users cannot vote.

<?php /* $Id: ratefile.php,v 2.3 11 july 2004 Liquid Exp $ * Module: PD-Downloads * Version: v1.0 * Release Date: 04. März 2005 * Author: Power-Dreams Team * Licence: GNU */ include 'header.php'; global $myts; if (!empty($_POST['submit'])) { if (empty($xoopsUser)) { $ratinguser = 0; } else { $ratinguser = $xoopsUser -> getVar('uid'); } // Make sure only 1 anonymous from an IP in a single day. $anonwaitdays = 1; $ip = getenv("REMOTE_ADDR"); $lid = intval($_POST['lid']); $cid = intval($_POST['cid']); $rating = intval($_POST['rating']); // Check if Rating is Null if ($rating == "--") { redirect_header("ratefile.php?cid=" . $cid . "&lid=" . $lid . "", 4, _MD_PDD_NORATING); exit(); } // Check if Download POSTER is voting (UNLESS Anonymous users allowed to post) if ($ratinguser != 0) { $result = $xoopsDB -> query("SELECT submitter FROM " . $xoopsDB -> prefix('PDdownloads_downloads') . " WHERE lid=$lid"); while (list($ratinguserDB) = $xoopsDB -> fetchRow($result)) { if ($ratinguserDB == $ratinguser) { redirect_header("index.php", 4, _MD_PDD_CANTVOTEOWN); exit(); } } // Check if REG user is trying to vote twice. $result = $xoopsDB -> query("SELECT ratinguser FROM " . $xoopsDB -> prefix('PDdownloads_votedata') . " WHERE lid=$lid"); while (list($ratinguserDB) = $xoopsDB -> fetchRow($result)) { if ($ratinguserDB == $ratinguser) { redirect_header('index.php', 4, _MD_PDD_VOTEONCE); exit(); } } } else { // Check if ANONYMOUS user is trying to vote more than once per day. $yesterday = (time() - (86400 * $anonwaitdays)); $result = $xoopsDB -> query("SELECT COUNT(*) FROM " . $xoopsDB -> prefix('PDdownloads_votedata') . " WHERE lid=$lid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); list($anonvotecount) = $xoopsDB -> fetchRow($result); if ($anonvotecount >= 1) { redirect_header("index.php", 4, _MD_PDD_VOTEONCE); exit(); } } // All is well. Add to Line Item Rate to DB. $newid = $xoopsDB -> genId($xoopsDB -> prefix('PDdownloads_votedata') . "_ratingid_seq"); $datetime = time(); $sql = sprintf("INSERT INTO %s (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB -> prefix('PDdownloads_votedata'), $newid, $lid, $ratinguser, $rating, $ip, $datetime); $xoopsDB -> query($sql); // All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. PDd_updaterating($lid); $ratemessage = _MD_PDD_VOTEAPPRE . "<br />" . sprintf(_MD_PDD_THANKYOU, $xoopsConfig['sitename']); redirect_header('index.php', 4, $ratemessage); exit(); } else { $xoopsOption['template_main'] = 'PDdownloads_ratefile.html'; include XOOPS_ROOT_PATH . '/header.php'; $lid = intval($_GET['lid']); $cid = intval($_GET['cid']); $imageheader = PDd_imageheader(); $result = $xoopsDB -> query("SELECT title FROM " . $xoopsDB -> prefix('PDdownloads_downloads') . " WHERE lid=$lid"); list($title) = $xoopsDB -> fetchRow($result); $xoopsTpl -> assign('file', array('id' => $lid, 'cid' => $cid, 'title' => $myts -> htmlSpecialChars($title), 'imageheader' => $imageheader)); include XOOPS_ROOT_PATH . '/footer.php'; } include XOOPS_ROOT_PATH.'/footer.php'; ?>
Re: Link only for special group - code problem
by metin on 2005/6/30 19:44:01

monty i did try it without \n too but have the same blank page. All other blocks are visible.

It´s interesting that i had in the beginning not this problem. At first i did get an error page and not the ratefile page that had to be shown.

Now when i add the code in the singlefile template the singlefile content doesn´t shown and if i add the code in ratefile template this does not show the content, but the rest of the site.

i only want that only an special group can reach the ratingfile page or can vote there. It cannot be so difficult to get this, but i have no expirience with php too.
Re: Link only for special group - code problem
by m0nty on 2005/6/30 19:28:34

i'm no coder, but could it possibly be the line end characters?

\n after each line???
Re: Link only for special group - code problem
by metin on 2005/6/30 19:19:42

now the singlefile page doesn´t work anymore.

Did try to add this code at ratefile template, cause than normal users can´t pushed the voting button but there is the same problem after i add the code in the template. The ratefile page don´t work.

this was the code for the ratingfile template

le="color: #000000"><?php <{if $xoops_isuser}> <{php}> global $xoopsUser; $redaktion = '4'; $name = $xoopsUser->getVar('uname'); $groups = $xoopsUser->getGroups(); if (in_array($redaktion, $groups)) { echo '<form method="post" action="ratefile.php">n <input type="hidden" name="lid" value="<{$file.id}>" />n <input type="hidden" name="cid" value="<{$file.cid}>" />n <select name="rating"><option>--</option><option>10</option><option>9</option><option>8</option><option>7</option><option>6</option><option>5</option><option>4</option><option>3</option><option>2</option><option>1</option></select>n &nbsp;&nbsp;n <input type="submit" name="submit" value="<{$smarty.const._MD_PDD_RATEIT}>" alt="<{$smarty.const._MD_PDD_RATEIT}>" /> <input type="button" value="<{$smarty.const._CANCEL}>" alt="<{$smarty.const._CANCEL}>" onclick="location='<{$xoops_url}>/modules/PDdownloads/singlefile.php?cid=<{$file.cid}>&lid=<{$file.id}>'" />n </form>n"; } <{/php}> <{/if}>

Who's Online

201 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 201


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits