Skip to content

Commit

Permalink
Properly compile the query to insert the values. Pointy-hat: myself. …
Browse files Browse the repository at this point in the history
…While here respect the redirurl when passed to portal_allow and use proper function to do redirection.
  • Loading branch information
Ermal committed Feb 24, 2014
1 parent 8cee3e4 commit 846bedf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etc/inc/captiveportal.inc
Expand Up @@ -1955,7 +1955,7 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
$bpassword = base64_encode($password);
$insertquery = "INSERT INTO captiveportal (allow_time, pipeno, ip, mac, username, sessionid, bpassword, session_timeout, idle_timeout, session_terminate_time, interim_interval, radiusctx) ";
$insertquery .= "VALUES ({$allow_time}, {$pipeno}, '{$clientip}', '{$clientmac}', '{$safe_username}', '{$sessionid}', '{$bpassword}', ";
$insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval}, {$radiusctx})";
$insertquery .= "{$session_timeout}, {$idle_timeout}, {$session_terminate_time}, {$interim_interval}, '{$radiusctx}')";

/* store information to database */
captiveportal_write_db($insertquery);
Expand All @@ -1977,10 +1977,10 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
/* redirect user to desired destination */
if (!empty($attributes['url_redirection']))
$my_redirurl = $attributes['url_redirection'];
else if (!empty($redirurl))
$my_redirurl = $redirurl;
else if (!empty($config['captiveportal'][$cpzone]['redirurl']))
$my_redirurl = $config['captiveportal'][$cpzone]['redirurl'];
else
$my_redirurl = $redirurl;

if(isset($config['captiveportal'][$cpzone]['logoutwin_enable']) && !$passthrumac) {
$ourhostname = portal_hostname_from_client_ip($clientip);
Expand All @@ -1995,7 +1995,7 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
include("{$g['varetc_path']}/captiveportal-{$cpzone}-logout.html");

} else {
header("Location: " . $my_redirurl);
portal_reply_page($redirurl, "redir", "Just redirect the user.");
}

return $sessionid;
Expand Down

0 comments on commit 846bedf

Please sign in to comment.