summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authordirk <beliebige_email_adresse@fidocon.de>2011-09-05 22:27:25 +0200
committerdirk <beliebige_email_adresse@fidocon.de>2011-09-05 22:27:25 +0200
commit5f3965197374aeb4392602fcafcac1d904d2d932 (patch)
tree2b17434db3e740a63c08343c0c147c3bb4fb4062 /www
parentc280f997a4ef442ad8f1c1b7d868c8260b468424 (diff)
parent665977338fa53f2a929b09e783f2a7986c70df37 (diff)
downloadcacert-devel-5f3965197374aeb4392602fcafcac1d904d2d932.tar.gz
cacert-devel-5f3965197374aeb4392602fcafcac1d904d2d932.tar.xz
cacert-devel-5f3965197374aeb4392602fcafcac1d904d2d932.zip
Merge branch 'release' of ssh://dirk@git-cacert.it-sls.de/var/cache/git/cacert-devel into bug-894
Diffstat (limited to 'www')
-rw-r--r--www/cats/cats_import.php5
-rw-r--r--www/index.php15
2 files changed, 12 insertions, 8 deletions
diff --git a/www/cats/cats_import.php b/www/cats/cats_import.php
index 6d77a75..56dd0cf 100644
--- a/www/cats/cats_import.php
+++ b/www/cats/cats_import.php
@@ -24,6 +24,8 @@
API for CATS to import passed tests into main CAcert database.
*/
+require_once('../../includes/lib/account.php');
+
function sanitize_string($buffer) {
return htmlentities(utf8_decode($buffer), (int)ENQ_QUOTES);
}
@@ -154,8 +156,7 @@ if (!$query) {
}
// Update Assurer-Flag on users table if 100 points. Should the number of points be SUM(points) or SUM(awarded)?
-$query = mysql_query('UPDATE `users` AS `u` SET `assurer` = 1 WHERE `u`.`id` = \''.(int)intval($userID).'\' AND EXISTS(SELECT 1 FROM `cats_passed` AS `tp` WHERE `tp`.`user_id` = `u`.`id`) AND (SELECT SUM(`points`) FROM `notary` AS `n` WHERE `n`.`to` = `u`.`id` AND `expire` < now()) >= 100;'); // Challenge has been passed and non-expired points >= 100
-if (!$query) {
+if (!fix_assurer_flag($userID)) {
echo 'Invalid query'."\r\n";
trigger_error('Invalid query', E_USER_ERROR);
exit();
diff --git a/www/index.php b/www/index.php
index 7330877..a4c50fc 100644
--- a/www/index.php
+++ b/www/index.php
@@ -148,13 +148,16 @@
if($id == 4 && $_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname'])
{
- $query = "select * from `emailcerts` where `serial`='$_SERVER[SSL_CLIENT_M_SERIAL]' and `revoked`=0 and disablelogin=0 and
- UNIX_TIMESTAMP(`expire`) - UNIX_TIMESTAMP() > 0";
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
+ include_once("../includes/lib/general.php");
+ $user_id = get_user_id_from_cert($_SERVER['SSL_CLIENT_M_SERIAL'],
+ $_SERVER['SSL_CLIENT_I_DN_CN']);
+
+ if($user_id >= 0)
{
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile'] = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='$row[memid]' and `deleted`=0 and `locked`=0"));
+ $_SESSION['profile'] = mysql_fetch_assoc(mysql_query(
+ "select * from `users` where
+ `id`='$user_id' and `deleted`=0 and `locked`=0"));
+
if($_SESSION['profile']['id'] != 0)
{
$_SESSION['profile']['loggedin'] = 1;