Only allow betting if user is in a match
This commit is contained in:
@@ -741,6 +741,32 @@ function user_is_member($userid, $season, $league)
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is user allowed to bet this matchday
|
||||
*/
|
||||
function user_is_allowed_to_bet($userid, $season, $league, $matchday)
|
||||
{
|
||||
global $db;
|
||||
$sql = 'SELECT COUNT(*) AS counter
|
||||
FROM ' . FOOTB_MATCHES . "
|
||||
WHERE season = $season
|
||||
AND league = $league + 50
|
||||
AND matchday = $matchday
|
||||
AND (team_id_home = $userid + 2000 OR team_id_guest = $userid + 2000)";
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
||||
if ($row['counter'] > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count existing matches on matchday or league
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user