Пример #1
0
    $rsCache = sql("SELECT caches.cache_id, user.user_id\n        FROM caches\n        INNER JOIN user ON caches.user_id=user.user_id\n        WHERE caches.cache_id='&1'", $cacheid);
    $rCache = sql_fetch_assoc($rsCache);
    sql_free_result($rsCache);
    $rsUser = sql("SELECT user_id FROM user WHERE user_id='&1'", $newuserid);
    $rUser = sql_fetch_assoc($rsUser);
    sql_free_result($rsUser);
    if ($rCache === false) {
        die('Cache existiert nicht!');
    }
    if ($rUser === false) {
        die('User existiert nicht!');
    }
    sql("UPDATE caches SET user_id='&1' WHERE cache_id='&2'", $rUser['user_id'], $rCache['cache_id']);
    // send event to delete statpic
    event_change_statpic($rCache['user_id']);
    event_change_statpic($rUser['user_id']);
    echo 'Besitzer geändert';
    // logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details)
    logentry('approving', 4, 0, $cacheid, 0, 'Owner changed ' . $cacheid, '');
    exit;
} elseif ($action == 'showcache') {
    $wp = isset($_REQUEST['waypoint']) ? $_REQUEST['waypoint'] : 0;
    $newusername = isset($_REQUEST['newusername']) ? $_REQUEST['newusername'] : 0;
    $cacheid = sqlValue("SELECT cache_id FROM caches WHERE wp_oc='" . sql_escape($wp) . "'", 0);
    $userid = sqlValue("SELECT user_id FROM user WHERE username='******'", '');
    if ($cacheid == 0) {
        die('Cache nicht gefunden!');
    }
    if ($userid == 0) {
        die('User nicht gefunden!');
    }
Пример #2
0
 // SUBMIT changed data
 if (isset($_POST['submit'])) {
     //load datas from form
     $statpic_text = isset($_POST['statpic_text']) ? mb_substr($_POST['statpic_text'], 0, 30) : 'Opencaching';
     $statpic_logo = isset($_POST['statpic_logo']) ? $_POST['statpic_logo'] + 0 : 0;
     tpl_set_var('statpic_text', $statpic_text);
     tpl_set_var('statpic_logo', $statpic_logo);
     //validate data
     $statpic_text_not_ok = mb_ereg_match(regex_statpic_text, $statpic_text) ? false : true;
     //try to save
     if (!$statpic_text_not_ok) {
         //in DB updaten
         sql("UPDATE `user` SET `statpic_text`='&1', `statpic_logo`='&2' WHERE `user_id`='&3'", $statpic_text, $statpic_logo, $usr['userid']);
         //call eventhandler
         require_once $rootpath . 'lib/eventhandler.inc.php';
         event_change_statpic($usr['userid'] + 0);
         //wieder normal anzeigen
         tpl_redirect('myprofile.php');
     } else {
         tpl_set_var('statpic_text_message', $error_statpic_text);
     }
 } else {
     //load from database
     $statpic_text = $record['statpic_text'];
     $stmp = '';
     $rs2 = sql('SELECT `id`, `previewpath`, `description` FROM `statpics`');
     while ($record2 = sql_fetch_array($rs2)) {
         $logo_temp = '<tr><td class="content-title-noshade">{statpic_desc}</td><td><input type="radio" name="statpic_logo" class="radio" value={statpic_id}{statpic_selected}/><img src="{statpic_preview}" align=middle /></td></tr><tr><td class="spacer" colspan="2"></td></tr>';
         $logo_temp = mb_ereg_replace('{statpic_id}', $record2['id'], $logo_temp);
         if ($record2['id'] == $using_logo) {
             $logo_temp = mb_ereg_replace('{statpic_selected}', ' checked="checked"', $logo_temp);