Jump to content

Recommended Posts

Hi i have a rating website and I have enabled guests to rate but is there anyway I can do that if guests rate people, their vote dont count, so only my registered users votes count not the guests.

 

here is the code for rating:

<?php

if(!defined("IN_MIPHOTO")) {
trigger_error("Unable to process {$HTTP_SERVER_VARS['PHP_SELF']}", E_USER_ERROR);
}

/*

DEV_CHECK

Added parameter of $bVideo. Need to find where this function is called from and setup to use the parameter

*/


$iId = initVar('id');
$iRating = initVar('rating');
$iGender = initVar('gender',HTTP_GET,true,0);
$sAct = initVar('act');

$bVideo = initVar('video');

if(getConfig('loginrate',0) && !$gGlobals['user']['loggedin'] ) {
$oTpl->assign('ErrorMessage',getConfig('errormustlogin'),false);
return;
}

if(!userHasAccess(USER_ACCESS_RATE)) {
if($gGlobals['user']['loggedin']) {
	$sDo = $HTTP_GET_VARS['do'] = "subscriptions";
	return $cPlugins->callPluginFunction(PLUGIN_FUNCTION_CLIENT_OUTPUT,0,0);
} else {
	$oTpl->assign('ErrorMessage',getConfig('errormustlogin'),false);
	include('login.php');
}
return;
}

if($iGender != '0' && $gGlobals['user']['loggedin'] && $oCustoms->getCustomID() != 154 /*!CUSTOM_BEN_*/) {
$iUserCategory = $oDb->getResult($oDb->select("gender","users","id='".$oDb->escape($gGlobals['user']['id'])."'","LIMIT 1"));
if($oDb->getResult($oDb->select("COUNT(*)","categories_settings","category_id='".$oDb->escape($iUserCategory)."' AND value='".$oDb->escape($iGender)."' AND setting_id='".$oDb->escape(CATEGORY_SETTING_RATE)."'","LIMIT 1")) < 1) {
	$oTpl->assign('Content',getConfig('errorcannotratecategory'),false);
	return;
}
}

$iPreviousPhoto = initVar('prevphoto',HTTP_GET,true,0);

if($iRating > 10 && !empty($iPreviousPhoto) && $sAct != "nextphoto" && $sAct != "prevphoto")
$iRating = 10;

if($iRating < 1 && !empty($iPreviousPhoto) && $sAct != "nextphoto" && $sAct != "prevphoto")
$iRating = 1;

require_once(dirname(__FILE__)."/../include/functions.vote.php");

// Try to record the vote it if valid
recordRating($iPreviousPhoto,$iRating);

$oTpl->define(array("rate-Default"	=> "rate/default.tpl",));

if($oCustoms->runCustoms(FILE_CONTENT_RATE,1)) {
} else {
$sUsersTablePrefix = "userstable.";
$sPhotosTablePrefix = "photostable.";

$sWhere = " !({$sUsersTablePrefix}special_flags & ".$oDb->escape(USERS_SPECIAL_FLAGS_PAYMENT_DUE).") AND !({$sUsersTablePrefix}special_flags & ".$oDb->escape(USERS_SPECIAL_FLAGS_PROFILE_NEEDS_APPROVAL).") AND !({$sUsersTablePrefix}special_flags & ".$oDb->escape(USERS_SPECIAL_FLAGS_REGISTER_APPROVAL).") AND !({$sUsersTablePrefix}special_flags & ".$oDb->escape(USERS_SPECIAL_FLAGS_PROFILE_DECLINED).") AND !({$sUsersTablePrefix}special_flags & ".$oDb->escape(USERS_SPECIAL_FLAGS_SUSPENDED).") AND {$sUsersTablePrefix}rating_contest='1' ";

if($iGender != '0')
	$sWhere .= " AND {$sUsersTablePrefix}gender='".$oDb->escape($iGender)."'";

if(getConfig('votedelay',0)) {
	$sWhereVotes = "((";

	if($gGlobals['user']['loggedin'])
		$sWhereVotes .= "from_user_id='".$oDb->escape(getUserId())."' OR ";

	$sWhereVotes .= "ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."') AND ((";

	if(getConfig('ratingdelaytype',0) == '2') {
		$sDelayDate = getConfig('votedelaydate',0);
		$sWhereVotes .= "((UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')-UNIX_TIMESTAMP(added)) > 0)  AND ((UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')) <= 0)))) GROUP BY to_user_id";
	} else {
		$iIdelay = intval(getConfig('votedelayseconds',0));

		if(empty($iIdelay) || !is_numeric($iIdelay))
			$iIdelay = 300;

		$sWhereVotes .= "UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) < {$iIdelay})) GROUP BY to_user_id";
	}

	$sWhereVotesList = "";
	if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
		$sWhere .= $sWhereVotesList = " AND ({$sPhotosTablePrefix}userid NOT IN(";
	}
	elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY) {
		$sWhere .= $sWhereVotesList = " AND ({$sPhotosTablePrefix}id NOT IN(";
	}
	elseif($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || $gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS) {
		$sWhere .= $sWhereVotesList = " AND (videostable.id NOT IN(";
	}

	$sWhereList = "0,";

	$rResult = $oDb->select("to_user_id","votes",$sWhereVotes,"ORDER BY NULL");
	while($aData = $oDb->getRow($rResult)) {
		$sWhereList .= "{$aData['to_user_id']},";
	}
	$oDb->freeResult($rResult);

	$sWhereList = substr($sWhereList,0,-1);

	$sWhere .= "{$sWhereList}))";
//		$sWhereVotesList .= "{$sWhereList}))";
}

$sWhere .= " AND userstable.id!=".intval(getUserId());

$iMaxAge = intval(initVar('maxage'));
$iMinAge = intval(initVar('minage'));
// Add min and max age restrictions if they are setup...
if($iMinAge > 0)
	$sWhere .= " AND ROUND((PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM userstable.birthday),EXTRACT(YEAR_MONTH FROM NOW()))/-12),0)>=".($iMinAge);
if($iMaxAge > 0)
	$sWhere .= " AND ROUND((PERIOD_DIFF(EXTRACT(YEAR_MONTH FROM userstable.birthday),EXTRACT(YEAR_MONTH FROM NOW()))/-12),0)<=".($iMaxAge);


$oCustoms->runCustoms(FILE_CONTENT_RATE,4,array('sWhere' => &$sWhere));

if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
	$aTables = array(
						array('table'	=>	'photos',
								'alias'	=>	'photostable',
								'select'	=>	array('id','userid'),
								'useindex' => 'photos_default',
								),
						array('table'	=>	'users',
								'alias'	=>	'userstable',
								'select'	=> array(),
								'useindex' => 'users_random_rating',
								)
						);

	$sWhere .= " AND photostable.isdefault=1 AND photostable.gallery_id=0 AND photostable.approved=1 AND photostable.userid=userstable.id";
	//		$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY photostable.userid ORDER BY NULL");
	$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY photostable.userid ORDER BY RAND() LIMIT 1");
}
elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && !$bVideo)) {
	$aTables = array(
						array('table'	=>	'photos',
								'alias'	=>	'photostable',
								'select'	=>	array('id','userid')
								),
						array('table'	=>	'users',
								'alias'	=>	'userstable',
								'select'	=> array(),
								'useindex' => 'users_random_rating',
								),
						array('table'	=>	'galleries',
								'alias'	=>	'g',
								'select'	=> array(),
								)
					);
	$sWhere .= " AND photostable.ratable=1 AND photostable.approved=1 AND photostable.userid=userstable.id AND (photostable.gallery_id=0 OR (g.id=photostable.gallery_id AND g.is_private=0)) ";
	//		$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY photostable.id ORDER BY NULL");

	$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY photostable.id ORDER BY RAND() LIMIT 1");
}
elseif($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && $bVideo)) {
	$aTables = array(
						array('table'	=>	'videos',
								'alias'	=>	'videostable',
								'select'	=>	array('id','userid','description','video_filename')
								),
						array('table'	=>	'users',
								'alias'	=>	'userstable',
								'select'	=> array(),
								'useindex' => 'users_random_rating',
								)
					);

	$sWhere .= " AND videostable.ratable=1 AND videostable.approved=1 AND videostable.userid=userstable.id ";
	//		$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY videostable.id ORDER BY NULL");
	$rResult = $oDb->selectMultiple($aTables,$sWhere," GROUP BY videostable.id ORDER BY RAND() LIMIT 1");
}

//echo "<!-- ".$sWhere." -->";

$iMaxPhotos = $oDb->getRowCount($rResult);

if($iMaxPhotos > 0) {
	$bFindUser = true;

	$aData = $oDb->getRow($rResult);

	if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
		$iUserId = $aData['userid'];
	}
	elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || $gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || $gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS) {
		$iUserId = $aData['id'];
	}

	$bFindUser = false;

	$iUserId = $aData['userid'];
	$iPhotoId = $aData['id'];


	// Display rating bars here... stops the template variables from being cleared...
	if($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || $gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || $gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS) {
		displayRatingBars($iPhotoId,'Rate',"index.php?do=rate",$iGender);
		$oTpl->assign('RateUserIdOrPhotoId',$iPhotoId);
	}


	$oTpl->assign('RateUserVideoDownloadLink','');
	$oTpl->assign('RateUserVideoFileName','');

	if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
		$iPhotoId = getUserDefaultPhotoId($iUserId);
		$oTpl->assign('RateUserIdOrPhotoId',$iUserId);
		displayRatingBars($iUserId,'Rate',"index.php?do=rate",$iGender);

		if(MIPHOTO_FEATURE_PHOTO_DETAILS) {
			setPhotoFieldsTemplateVariables($iPhotoId,'Rate');
		}
	}
	elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && !$bVideo)) {
		if(MIPHOTO_FEATURE_PHOTO_DETAILS) {
			setPhotoFieldsTemplateVariables($iPhotoId,'Rate');
		}
	}
	elseif($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && $bVideo)) {
		$oTpl->assign('RateUserPhotoDescription',$aData['description'],false);
		//$oTpl->assign('RateUserVideoDownloadLink',"dl.php?",false);
		$oTpl->assign('RateUserVideoFileName',$aData['video_filename'],false);
	}

	$oTpl->assign('RateUserId',$iUserId);
	$oTpl->assign('RateUserName',getUserProfileLink($iUserId));

	if(RANDOM_RATE_PROFILE_INFORMATION) {
		setUserTemplateVariables($iUserId,'Rate',false,NULL,false);
	}

	$oTpl->assign('RateUserPhotoId',$iPhotoId);

	$oTpl->assign('RateUserThumbnailLink',getImageThumbnailLink($iPhotoId,false,THUMBNAIL_SIZE_RATE,false,false,(($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && $bVideo)) ? true : false),true,"",$iUserId));

	$oCustoms->runCustoms(FILE_CONTENT_RATE,2,array('iPhotoId'=> &$iPhotoId, 'iUserId' => &$iUserId));

	$oTpl->assign('RateUserGender',$iGender);
	$oTpl->parse('Content','rate-Default',true);
} else {
	$oTpl->assign('ErrorMessage',getConfig('errornousertorate'),false);
}
}
?>

 

and here is function.vote.php

<?php


if(!defined("IN_MIPHOTO")) {
trigger_error("Unable to process {$HTTP_SERVER_VARS['PHP_SELF']}", E_USER_ERROR);
}

function updateDatabaseRealRatingField($sTable, $iId = -1) {
global $oDb;

switch(strtolower($sTable)) {
	case "photos":
		$oDb->update("photos",array('real_rating' => MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.MIPHOTO_RATING_FORMULA_MYSQL), ($iId != -1 ? "id=".intval($iId) : ""));
		break;
	case "users":
		$oDb->update("users",array('real_rating' => MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.MIPHOTO_RATING_FORMULA_MYSQL), ($iId != -1 ? "id=".intval($iId) : ""));
		break;
}
}

/*

DEV_CHECK

Added parameter of $bVideo. Need to find where this function is called from and setup to use the parameter

*/

function canUserVoteAgain($iPreviousPhoto, $bVideo = false) {
global $oDb,$gGlobals,$oTpl;
// check to see if voting is disabled
if(!getConfig('votingenabled',0)) {
	$oTpl->assign('Content',getConfig('errorvotingdisabled'),false);
	return -1;
}


if($gGlobals['user']['loggedin']) {
	if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
		$iOtherUserCategory = $oDb->getResult($oDb->select("gender","users","id='".$oDb->escape($iPreviousPhoto)."'","LIMIT 1"));
	}
	elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && !$bVideo)) {
		$iUserId = $oDb->getResult($oDb->select("userid","photos","id='".$oDb->escape($iPreviousPhoto)."'","LIMIT 1"));

		$iOtherUserCategory = $oDb->getResult($oDb->select("gender","users","id='".$oDb->escape($iUserId)."'","LIMIT 1"));
	}
	elseif($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && $bVideo)) {
		$iUserId = $oDb->getResult($oDb->select("userid","videos","id='".$oDb->escape($iPreviousPhoto)."'","LIMIT 1"));

		$iOtherUserCategory = $oDb->getResult($oDb->select("gender","users","id='".$oDb->escape($iUserId)."'","LIMIT 1"));
	}


	$iUserCategory = $oDb->getResult($oDb->select("gender","users","id='".$oDb->escape($gGlobals['user']['id'])."'","LIMIT 1"));

	//echo "\n\n<!-- DEBUG  {$iOtherUserCategory}:{$iUserCategory} -->\n\n";

	if($oDb->getResult($oDb->select("COUNT(*)","categories_settings","category_id='".$oDb->escape($iUserCategory)."' AND value='".$oDb->escape($iOtherUserCategory)."' AND setting_id='".$oDb->escape(CATEGORY_SETTING_RATE)."'","LIMIT 1")) < 1) {
		//echo "\n\n<!-- DEBUG  user cannot rate members in this category -->\n\n";
		return -2;
	}

	if($oDb->getResult($oDb->select("COUNT(*)","block_list","user_id='".$oDb->escape($iPreviousPhoto)."' AND block_user_id='".$oDb->escape(getUserId())."'","LIMIT 1"))) {
		return -3;
	}
}

$bVoteDelay = getConfig('votedelay',0);
$iNewRating = 1;

if($bVoteDelay) {
	if(getConfig('ratingdelaytype',0) == '2') {
		$sDelayDate = getConfig('votedelaydate',0);
		//$iNewRating = !$oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."' OR from_user_id='".$oDb->escape(getUserId())."') AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND ((UNIX_TIMESTAMP(added)-UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')) <= 0)"));
		//$iNewRating = (($oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."' OR from_user_id='".$oDb->escape(getUserId())."') AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND (((UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')-UNIX_TIMESTAMP(added)) > 0)  AND ((UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')) <= 0))")) == '0') ? 1 : 0);

		$iNewRating = (($oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."'".(($gGlobals['user']['loggedin'])?" OR from_user_id='".$oDb->escape(getUserId())."'":"").") AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND (((UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')-UNIX_TIMESTAMP(added)) > 0)  AND ((UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP('".$oDb->escape($sDelayDate)."')) <= 0))","LIMIT 1")) == '0') ? 1 : 0);
	} else {
		$iIdelay = getConfig('votedelayseconds',0);

		if(empty($iIdelay) || !is_numeric($iIdelay))
			$iIdelay = 300;

		//$iNewRating = (($oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."' OR from_user_id='".$oDb->escape(getUserId())."') AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND ((UNIX_TIMESTAMP(added)-UNIX_TIMESTAMP((now()-{$iIdelay}))) >= 0)")) == '0') ? 1 : 0);
		$iNewRating = (($oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."'".(($gGlobals['user']['loggedin'])?" OR from_user_id='".$oDb->escape(getUserId())."'":"").") AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND ((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(added)) < '{$iIdelay}')","LIMIT 1")) == '0') ? 1 : 0);
		//$iNewRating = (($oDb->getResult($oDb->select("COUNT(*)","votes","(ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."'".(($gGlobals['user']['loggedin'])?" OR from_user_id='".$oDb->escape(getUserId())."'":"").") AND to_user_id='".$oDb->escape($iPreviousPhoto)."' AND ((added-(CURRENT_TIMESTAMP()-{$iIdelay})) >= 0)")) == '0') ? 1 : 0);
	}
}

return $iNewRating;
}

/*

DEV_CHECK

Added parameter of $bVideo. Need to find where this function is called from and setup to use the parameter

*/

function recordRating($iPreviousPhoto, $iRating, $bVideo = false) {
global $oDb,$gGlobals;

if(empty($iPreviousPhoto) || empty($iRating) || !is_numeric($iRating) || !is_numeric($iPreviousPhoto) || $iPreviousPhoto == getUserId())
	return 0;

if((int)$iRating > 10) {
	return 0;
}
if((int)$iRating < 1) {
	return 0;
}

if(strlen((string)$iRating) > 2)
	return 0;

$iNewRating = canUserVoteAgain($iPreviousPhoto);

if((int)$iNewRating < 0)
	return 0;

if($iNewRating) {
	$aFields = array('rating'	=>	MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.'(rating+'.$oDb->escape($iRating).')',
						'votes'	=>	MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.'(votes+1)'
					);

	if($gGlobals['rating']['type'] == RATE_USERS_ONLY) {
		$oDb->update("users",$aFields,"id='".$oDb->escape($iPreviousPhoto)."'");

		updateDatabaseRealRatingField("users",$iPreviousPhoto);
	}
	elseif($gGlobals['rating']['type'] == RATE_PHOTOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && !$bVideo)) {
		$iUserId = $oDb->getResult($oDb->select("userid","photos","id='".$oDb->escape($iPreviousPhoto)."'","LIMIT 1"));

		$oDb->update("users",$aFields,"id='".$oDb->escape($iUserId)."'");
		$oDb->update("photos",$aFields,"id='".$oDb->escape($iPreviousPhoto)."'");

		updateDatabaseRealRatingField("users",$iUserId);
		updateDatabaseRealRatingField("photos",$iPreviousPhoto);
	}
	elseif($gGlobals['rating']['type'] == RATE_VIDEOS_ONLY || ($gGlobals['rating']['type'] == RATE_PHOTOS_VIDEOS && $bVideo)) {
		$iUserId = $oDb->getResult($oDb->select("userid","videos","id='".$oDb->escape($iPreviousPhoto)."'","LIMIT 1"));

		$oDb->update("users",$aFields,"id='".$oDb->escape($iUserId)."'");
		$oDb->update("videos",$aFields,"id='".$oDb->escape($iPreviousPhoto)."'");

		updateDatabaseRealRatingField("users",$iUserId);
		updateDatabaseRealRatingField("videos",$iPreviousPhoto);
	}

	$aFields = array('added'	=>	MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.'NOW()',
						'to_user_id'	=> $iPreviousPhoto,
						'from_user_id'	=>	getUserId(),
						'rating'	=>	$iRating,
						'ip_address'	=>	$gGlobals['user']['ipaddress']);
	$oDb->insert("votes",$aFields);
} else {
	/*
	// Disabled due to not allowing a user to vote any more since implementation of rating_bars.tpl
	$sWhere = "to_user_id='".$oDb->escape($iPreviousPhoto)."' AND (";

	if($gGlobals['user']['loggedin'])
		$sWhere .= "from_user_id='".$oDb->escape(getUserId())."' OR ";

	$sWhere .= " ip_address='".$oDb->escape($gGlobals['user']['ipaddress'])."')";

	$iOldRating = $oDb->getResult($oDb->select("rating","votes",$sWhere,"LIMIT 1"));
	$aFields = array('updated'	=>	MYSQL_NO_QUOTES_ESCAPE_CHARACTERS.'NOW()',
						'rating' => $iRating);

	$iRating = $iRating - $iOldRating;
	$oDb->query("UPDATE {$gGlobals['database']['prefix']}_usersz SET rating=(rating+".$oDb->escape($iRating).") WHERE id='".$oDb->escape($iPreviousPhoto)."'");

	$oDb->update('votes',$aFields,$sWhere,"ORDER BY added DESC LIMIT 1");
	*/
}
return 1;
}

?>

Link to comment
https://forums.phpfreaks.com/topic/162396-guests-vote/
Share on other sites

Check the session variable to see if a registered user is logged in before you increment the vote count.  If they're not then throw an error message.

 

Yeah I have checked it and there is an option for enable/disable login to rate but I want to disable the login to rate and let the guests to rate and also not count their vote

Link to comment
https://forums.phpfreaks.com/topic/162396-guests-vote/#findComment-857194
Share on other sites

Check the session variable to see if a registered user is logged in before you increment the vote count.  If they're not then throw an error message.

 

Yeah I have checked it and there is an option for enable/disable login to rate but I want to disable the login to rate and let the guests to rate and also not count their vote

 

If they don't have to login to vote then how are you supposed to distinguish from guest and user?  I guess you could prompt them to choose between user or guest, and if they choose user prompt them again for their username/password when they vote.

Link to comment
https://forums.phpfreaks.com/topic/162396-guests-vote/#findComment-857235
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.