Esempio n. 1
0
function editText($filed, $value, $userId)
{
    $result = updateSql('users', "{$filed}='{$value}'", 'user_id=' . $userId);
    if ($result['state'] == 1) {
        echo json_encode(array('state' => 1, 'msg' => '保存成功'));
    } else {
        echo json_encode(array('state' => 0, 'msg' => '保存失败'));
    }
}
Esempio n. 2
0
function upsert($today, $pilotName, $pilotRank, $pilotLevel, $pilotKeyID, $pilotVcode, $pilotCharID, $corporationName, $corporationId, $allianceName, $allianceId, $pilotRealName, $pilotGender, $pilotBirthDay, $pilotBirthMonth, $pilotBirthYear, $pilotCountry, $pilotTimeZone, $pilotEmail, $pilotFacebookID, $pilotStatus, $pilotQuestionaire, $pilotPrimary, $pilotAltAccount)
{
    $q = mysql_query("SELECT * FROM ecms_pilots WHERE pilotKeyID = '{$pilotKeyID}' AND pilotVcode = '{$pilotVcode}' AND pilotCharID = '{$pilotCharID}';");
    $num = mysql_num_rows($q);
    if ($num == 0) {
        insertSql($today, $pilotName, $pilotRank, $pilotLevel, $pilotKeyID, $pilotVcode, $pilotCharID, $corporationName, $corporationId, $allianceName, $allianceId, $pilotRealName, $pilotGender, $pilotBirthDay, $pilotBirthMonth, $pilotBirthYear, $pilotCountry, $pilotTimeZone, $pilotEmail, $pilotFacebookID, $pilotStatus, $pilotQuestionaire, $pilotPrimary, $pilotAltAccount);
    } else {
        updateSql($today, $pilotName, $pilotRank, $pilotLevel, $pilotKeyID, $pilotVcode, $pilotCharID, $corporationName, $corporationId, $allianceName, $allianceId, $pilotRealName, $pilotGender, $pilotBirthDay, $pilotBirthMonth, $pilotBirthYear, $pilotCountry, $pilotTimeZone, $pilotEmail, $pilotFacebookID, $pilotStatus, $pilotQuestionaire, $pilotPrimary, $pilotAltAccount);
    }
}
Esempio n. 3
0
 } else {
     $function_last = end($codefiles) == $codefile;
     $namespaced_code .= namespaceFunction(addCodeFunction($func, $codefile, $descr1), $function_last);
 }
 // sanitize
 foreach ($info as $k => $v) {
     $info[$k] = addslashes($v);
 }
 // update || insert
 echo $info["title_url"] . " (" . $descr1 . ")";
 list($num, $res) = queryS("SELECT `article_id` FROM `article` WHERE `title_url`='" . $info["title_url"] . "'");
 if ($num) {
     $mode = "update";
     $row = mysql_fetch_assoc($res);
     $save["article"] = $info["article"];
     $sqle = updateSql($row["article_id"], $save, "article", "article_id");
     echo "exists. updating... ";
 } else {
     $mode = "insert";
     $save = $info;
     $sqle = insertSql($save, "article");
     echo "does not exist. inserting... ";
 }
 // report
 if (!queryE($sqle)) {
     echo "fail\n";
 } else {
     echo "sucess\n";
     if ($mode == "insert" && ($article_id = mysql_insert_id())) {
         $tags = array("programming", "php", "javascript", "phpjs");
         foreach ($tags as $k => $tag_raw) {
Esempio n. 4
0
        } else {
            $content = $result['MerchantOrderNo'] . ': ERROR_2';
            fwrite($fp, $content . "\n");
            fclose($fp);
            echo $content;
            die;
        }
    } else {
        $content = $result['MerchantOrderNo'] . ': ERROR_1';
        echo $content;
        fwrite($fp, $content . "\n");
        // 修改訂單狀態 && 新增歷史紀錄 (Only Credit or WebAtm)
        if (in_array($result['PaymentType'], array('CREDIT', 'WEBATM'))) {
            $today = time();
            // 修改訂單狀態
            $update_sql = updateSql($result['MerchantOrderNo'], $pay2go_configs['Pay2goMPG_fail_status_id'], $today, $config->dbprefix);
            mysql_query($update_sql);
            // 新增歷史紀錄
            $insert_sql = addSql($result, $pay2go_configs['Pay2goMPG_fail_status_id'], $today, $config->dbprefix);
            mysql_query($insert_sql);
        }
        fclose($fp);
        die;
    }
} else {
    fwrite($fp, $result['MerchantOrderNo'] . ": DataError\n");
}
fclose($fp);
die;
/**
 * 更新語法
Esempio n. 5
0
    $smarty->assign('userName', $userName);
    $smarty->assign('cssFileName', 'albumEdit');
    $smarty->display('albumEdit.tpl');
}
if (isset($_POST['albumName']) && isset($_POST['albumId'])) {
    $userId = $_SESSION['userId'];
    $albumId = $_POST['albumId'];
    $albumName = $_POST['albumName'];
    $albumDesc = $_POST['albumDesc'];
    // $result = selectSql('albums','album_name','user_id='.$userId);
    // if($result['state'] == 1){
    // 	$albumNameArr = array();
    // 	while($rows = mysql_fetch_assoc($result['msg'])){
    // 		$albumNameArr[] = $rows['album_name'];
    // 	}
    // 	if(in_array($albumName,$albumNameArr)){
    // 		echo json_encode(array('state'=>0,'msg'=>'该相册名已存在.'));
    // 	}
    // 	else{
    //更新相册信息
    $result = updateSql('albums', "album_name='{$albumName}',album_desc='{$albumDesc}'", "album_id='{$albumId}'");
    if ($result['state'] == 1) {
        echo json_encode(array('state' => 1, 'msg' => '编辑成功.'));
    } else {
        echo json_encode(array('state' => 0, 'msg' => '编辑失败.'));
    }
    // 	}
    // }
}
?>
	
Esempio n. 6
0
        echo json_encode(array('state' => 1, 'msg' => '编辑成功.'));
    } else {
        echo json_encode(array('state' => 0, 'msg' => '编辑失败.'));
    }
    return false;
}
if (!empty($_POST['photoId']) && !empty($_POST['act']) && $_POST['act'] == 'setAlbumCover') {
    $photoId = $_POST['photoId'];
    //找出当前照片路径和所属相册id
    $result = selectSql('photos', 'photo_name,album_id', 'photo_id=' . $photoId);
    if ($result['state'] == 1) {
        $rows = mysql_fetch_assoc($result['msg']);
        $photoName = $rows['photo_name'];
        $albumId = $rows['album_id'];
        //更新相册封面
        $result = updateSql('albums', "album_cover='{$photoName}'", 'album_id=' . $albumId);
        if ($result['state'] == 1) {
            echo json_encode(array('state' => 1, 'msg' => '设置成功.'));
        } else {
            echo json_encode(array('state' => 0, 'msg' => '设置失败.'));
        }
    }
    return false;
}
if (!empty($_POST['photoOwnerId']) && !empty($_POST['postText']) && !empty($_POST['act']) && $_POST['act'] == 'addComment') {
    $photoId = $_POST['photoId'];
    $postText = $_POST['postText'];
    $commentTime = date('Y-m-d H:i:s');
    $commenterId = $userId;
    $photoOwnerId = $_POST['photoOwnerId'];
    //添加评论