本文整理汇总了PHP中writetofile函数的典型用法代码示例。如果您正苦于以下问题:PHP writetofile函数的具体用法?PHP writetofile怎么用?PHP writetofile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writetofile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chkLogin
function chkLogin()
{
global $db;
$m_id = getCookie("adminid");
$m_id = chkSql($m_id, true);
$m_name = getCookie("adminname");
// writetofile("operate.log", "loginame:{".$m_name ."};action:{".be("all","action")."};referce:{".getReferer()."}.request:{".$_SERVER["REQUEST_URI"]."};parameters GET:{".json_encode($_GET)."}" );
writetofile("operate.log", "loginame:{" . $m_name . "};action:{" . be("all", "action") . "};referce:{" . getReferer() . "}.request:{" . $_SERVER["REQUEST_URI"] . "};parameters POST:{" . json_encode($_POST) . "}");
$m_name = chkSql($m_name, true);
if (!isN($m_name) && !isN($m_id)) {
$row = $db->getRow("SELECT * FROM {pre}manager WHERE m_name='" . $m_name . "' AND m_id= '" . $m_id . "' AND m_status ='1'");
if ($row) {
$loginValidate = md5($row["m_random"] . $row["m_name"] . $row["m_id"]);
if (getCookie("admincheck") != $loginValidate) {
sCookie("admincheck", "");
die("<script>top.location.href='index.php?action=login';</script>");
}
} else {
sCookie("admincheck", "");
die("<script>top.location.href='index.php?action=login';</script>");
}
} else {
die("<script>top.location.href='index.php?action=login';</script>");
}
}
示例2: parseVideoUrls
function parseVideoUrls($sql)
{
global $db;
writetofile("parseVideo.txt", $sql);
$rs = $db->query($sql);
$rscount = $db->num_rows($rs);
if ($rscount == 0) {
errmsg("没有可用的数据");
} else {
while ($row = $db->fetch_array($rs)) {
$u_id = $row["u_id"];
$u_weburl = $row["u_weburl"];
$p_id = $row["p_id"];
$m_urltest = $row["m_urltest"];
if (isN($u_weburl)) {
$u_weburl = $m_urltest;
}
$project = getProgject($p_id);
$webCode = getPage($u_weburl, $project->p_coding);
$videoUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseIOSVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
$androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
if (!isN($videoUrl)) {
$sql = "update {pre}cj_vod_url set iso_video_url='" . $videoUrl . "', u_weburl='" . $u_weburl . "',android_vedio_url ='" . $androidUrl . "' where u_id=" . $u_id;
writetofile("parseVideo.txt", $sql);
$db->query($sql);
} else {
writetofile("videoUrlErrors.txt", '{===}' . $p_id . '{===}' . $u_id . '{===}' . $u_weburl);
}
}
}
unset($rs);
}
示例3: checkWebUrls
function checkWebUrls($rs)
{
global $db, $template, $cache;
$ids = '';
$flag = false;
while ($row = $db->fetch_array($rs)) {
$url = $row['webUrls'];
$id = $row['d_id'];
$d_playfrom = $row['d_playfrom'];
$d_playfrom = explode("\$\$\$", $d_playfrom);
$d_playfrom = $d_playfrom[0];
$url = getFirstWeburl($url);
if (!ContentProviderFactory::checkHtmlCanPlay($d_playfrom, $url)) {
// writetofileNoAppend("checkVoditem.txt",$id.'{===}'.$row['d_name']);
writetofile("checkVod.txt", $id . '{===}' . $row['d_name'] . ' can\'t play');
if ($flag) {
$ids = ',' . $ids;
}
$flag = true;
$ids = $id . $ids;
} else {
// writetofile("checkVod.txt",$id.'{===}'.$row['d_name'].' can play');
}
}
unset($rs);
if (isset($ids) && !is_null($ids) && strlen($ids) > 0) {
$db->query('update {pre}vod set d_hide=-100, d_play_check=2 where d_id in (' . $ids . ')');
}
}
示例4: parseVodPad
function parseVodPad($rs, $scoreDouban)
{
global $db;
while ($row = $db->fetch_array($rs)) {
$name = $row["d_name"];
$area = $row["d_area"];
$year = $row["d_year"];
$d_id = $row["d_id"];
$type = $row["d_type"];
$doubanid = $row['d_douban_id'];
writetofile("updateVodThumb.txt", 'sssdoubanid{=}' . $doubanid);
$flag = true;
if (!isN($doubanid) && $doubanid !== 0 && $doubanid !== '0') {
$flag = false;
writetofile("updateVodThumb.txt", 'getThumb:' . $name);
$pic = $scoreDouban->getThumb($doubanid);
} else {
writetofile("updateVodThumb.txt", 'getDoubanThumb:' . $name);
$pic = $scoreDouban->getDoubanThumb($name, $year, $area);
}
if ($pic !== false) {
$doubanid = $pic['id'];
writetofile("updateVodThumb.txt", 'doubanid{=}' . $doubanid);
if (!isN($doubanid) && $flag) {
$db->Update("{pre}vod", array("d_douban_id"), array($doubanid), "d_id=" . $d_id);
}
$pic = $pic['pic'];
}
if ($pic !== false && !isN($pic)) {
writetofile("updateVodThumb.txt", 'd_pic{=}' . $pic);
$db->Update("{pre}vod", array("d_pic"), array($pic), "d_id=" . $d_id);
}
}
unset($rs);
}
示例5: crawleAndroidVideoByPlayUrl
function crawleAndroidVideoByPlayUrl($url, $project)
{
$webCode = getPage($url, $project->p_coding);
$androidUrl = ContentProviderFactory::getContentProvider($project->p_playtype)->parseAndroidVideoUrlByContent($webCode, $project->p_coding, $project->p_script);
writetofile("android_log.txt", $strlink . '{===}' . $androidUrl);
return $androidUrl;
}
示例6: parseIOSVideoUrl
public function parseIOSVideoUrl($url, $p_coding, $p_script)
{
$content = getPage($this->p_videocodeApiUrl . $this->from . '/?url=' . $url, "utf-8");
// var_dump($url);
writetofile("joyplus.log", $this->p_videocodeApiUrl . $this->from . '/?url=' . $url);
return $this->parseIOSVideoUrlByContent($content, $p_coding, $p_script);
}
示例7: parseVodPad
function parseVodPad($rs, $scoreDouban)
{
global $db;
while ($row = $db->fetch_array($rs)) {
$name = $row["d_name"];
$area = $row["d_area"];
$year = $row["d_year"];
$d_id = $row["d_id"];
$type = $row["d_type"];
$doubanid = $row['d_douban_id'];
$flag = true;
if (!isN($doubanid) && $doubanid !== 0 && $doubanid !== '0') {
$flag = false;
$pic = $scoreDouban->getPicById($doubanid, 7 / 5);
} else {
$pic = $scoreDouban->getDouBanPics($name, $year, $area, 7 / 5);
}
if ($pic !== false) {
$doubanid = $pic['id'];
if (!isN($doubanid) && $flag) {
$db->Update("{pre}vod", array("d_douban_id"), array($doubanid), "d_id=" . $d_id);
}
$pic = $pic['pic'];
}
if ($pic !== false && !isN($pic)) {
$padPic = explode("{Array}", $pic);
if (count($padPic) > 0) {
$padPic = $padPic[0];
writetofile("updateVodPic.txt", 'd_pic_ipad{=}' . $padPic . '{=}d_pic_ipad_tmp{=}' . $pic);
$db->Update("{pre}vod", array("d_pic_ipad", "d_pic_ipad_tmp"), array($padPic, $pic), "d_id=" . $d_id);
}
}
}
unset($rs);
}
示例8: updatecachefile
function updatecachefile($filename)
{
global $db;
switch ($filename) {
case "config":
$query = $db->query("SELECT * FROM `config`");
while ($result = $db->fetch_array($query)) {
$options[$result['name']] = $result['value'];
}
$data .= '$options = ' . var_export($options, true) . ";\n";
//此函数返回关于传递给该函数的变量的结构信息
$str = serialize($options);
writetofile('config.ini', ROOT_PATH . "cache" . DS . 'config', $str, 1);
//writetocache('config','config',$data);
break;
case "psort":
require_once ROOT_PATH . 'include/sort.class.php';
$sc = new sortclass('category');
writetofile('psort.ini', ROOT_PATH . 'cache' . DS . 'config', serialize($sc->sort2array()));
break;
case "asort":
require_once ROOT_PATH . 'include/sort.class.php';
$sc = new sortclass('catagory');
writetofile('asort.ini', ROOT_PATH . 'cache' . DS . 'config', serialize($sc->sort2array()));
break;
}
}
示例9: connect
function connect($url, $password, $ip = '')
{
$ucapi = preg_replace("/\\/\$/", '', trim($url));
$ucip = trim($ip);
if (!$ucip) {
$temp = @parse_url($ucapi);
$ucip = gethostbyname($temp['host']);
if (ip2long($ucip) == -1 || ip2long($ucip) === FALSE) {
$ucip = '';
}
}
$ucinfo = uc_fopen2($ucapi . '/index.php?m=app&a=ucinfo&a=ucinfo', 500, '', '', 1, $ucip);
list($status, $ucversion, $ucrelease, $uccharset, $ucdbcharset, $apptypes) = explode('|', $ucinfo);
if ($status != 'UC_STATUS_OK') {
exit('连接失败,请检查URL和密码是否正确!');
}
$postdata = "m=app&a=add&ucfounder=&ucfounderpw=" . urlencode($password) . "&apptype=" . urlencode('OTHER') . "&appname=" . urlencode($this->base->setting['site_name']) . "&appurl=" . urlencode(SITE_URL) . "&appip=&appcharset=" . TIPASK_CHARSET . '&appdbcharset=' . DB_CHARSET;
$s = uc_fopen2($ucapi . '/index.php', 500, $postdata, '', 1, $ucip);
if (empty($s)) {
exit('不能连接到UCenter服务端!');
} elseif ($s == '-1') {
exit('UCenter密码错误!');
} else {
$ucs = explode('|', $s);
if (empty($ucs[0]) || empty($ucs[1])) {
exit('网络连接超时,不能返回数据,请稍后重试!');
}
}
$ucdata = "<?php\ndefine('UC_OPEN','1');\ndefine('UC_CONNECT', 'uc_api_post');\ndefine('UC_DBHOST', '{$ucs['2']}');\ndefine('UC_DBUSER', '{$ucs['4']}');\ndefine('UC_DBPW', '{$ucs['5']}');\ndefine('UC_DBNAME', '{$ucs['3']}');\ndefine('UC_DBCHARSET', '{$ucs['6']}');\ndefine('UC_DBTABLEPRE', '{$ucs['7']}');\ndefine('UC_KEY', '{$ucs['0']}');\ndefine('UC_API', '{$ucapi}');\ndefine('UC_CHARSET', '{$ucs['8']}');\ndefine('UC_IP', '{$ucip}');\ndefine('UC_APPID', '{$ucs['1']}');\n?>";
$bytes = writetofile(TIPASK_ROOT . '/data/ucconfig.inc.php', $ucdata);
return 0 != $bytes;
}
示例10: updateMenu
function updateMenu()
{
$menu = $GLOBALS['tree']->getChilds(1);
array_splice($menu, -6);
foreach ($menu as $k => $v) {
$_menu[$v['cid']] = $v;
unset($menu[$k]);
}
writetofile(ROOT_PATH . 'admin/_menu.php', '$MENUS = ' . var_export($_menu, true));
}
示例11: write
function write($cachename, $arraydata)
{
$this->getfile($cachename);
if (!is_array($arraydata)) {
return false;
}
$strdata = "<?php\nreturn " . var_export($arraydata, true) . ";\n?>";
$bytes = writetofile($this->cachefile, $strdata);
return $bytes;
}
示例12: crawlerProgramItems
static function crawlerProgramItems($date, $chnnel)
{
$url = replaceStr(CnTVLiveParse::BASE_EPISODE, '{DATE}', $date);
$url = replaceStr($url, '{TV_CODE}', $chnnel);
$client = new HttpClient('tv.cntv.cn');
$client->get('/epg');
$client->get($url);
writetofile("program_live_item_crawler.log", "url:[http://tv.cntv.cn" . $url . "]");
$content = $client->getContent();
return CnTVLiveParse::parseMovieInfoByContent($content, $p_code, $type);
}
示例13: parseVodPad
function parseVodPad($rs, $scoreDouban)
{
global $db;
while ($row = $db->fetch_array($rs)) {
$name = $row["d_name"];
$area = $row["d_area"];
$year = $row["d_year"];
$d_id = $row["d_id"];
$type = $row["d_type"];
$doubanid = $row['d_douban_id'];
writetofile("updateVodReviews.txt", 'sssdoubanid{=}' . $doubanid);
$flag = true;
if (!isN($doubanid) && $doubanid !== 0 && $doubanid !== '0') {
$flag = false;
writetofile("updateVodReviews.txt", 'getThumb:' . $name);
$comments = $scoreDouban->getReviewsById($doubanid);
} else {
writetofile("updateVodReviews.txt", 'getDoubanThumb:' . $name);
$comments = $scoreDouban->getDoubanReviews($name, $year, $area);
}
if ($comments !== false) {
$doubanid = $comments['id'];
writetofile("updateVodReviews.txt", 'getDoubanThumb:' . $doubanid);
if (!isN($doubanid) && $flag) {
$db->Update("{pre}vod", array("d_douban_id"), array($doubanid), "d_id=" . $d_id);
}
}
if (is_array($comments) && !isN($comments['comments'])) {
$commentsArray = $comments['comments'];
$titlesArray = $comments['title'];
$reviewidsArray = $comments['reviewid'];
$total = count($commentsArray);
if ($total > 0) {
$db->Delete("tbl_comments", "content_id=" . $d_id . " and author_id is null and comment_type=1");
//$db->Delete("mac_comment", "c_vid=".$d_id );
}
for ($i = 0; $i < $total; $i++) {
$com = $commentsArray[$i];
$title = $titlesArray[$i];
$reviewid = $reviewidsArray[$i];
if (!isN($com)) {
$com = filterScript($com, 8191);
$db->Add("tbl_comments", array("status", "content_type", "content_name", "content_id", "create_date", "comments", "comment_type", "douban_comment_id", "comment_title"), array('1', $type, $name, $d_id, date("Y-m-d H:i:s"), $com, '1', $reviewid, $title));
$db->Add("mac_comment", array("c_audit", "c_type", "c_vid", "c_time", "c_content", "c_name"), array('1', $type, $d_id, date("Y-m-d H:i:s"), $com, $author));
}
}
}
}
unset($rs);
}
示例14: crawlerProgramItems
static function crawlerProgramItems($date, $chnnel)
{
$dateTime = strtotime($date);
$date = date('w', $dateTime);
if ($date === '0') {
$date = '7';
}
$url = replaceStr(TVSouLiveParse::BASE_EPISODE, '{DATE}', $date);
$url = replaceStr($url, '{TV_CODE}', $chnnel);
$content = getPage($url, "gb2312");
writetofile("program_live_item_crawler.log", "url:[" . $url . "]");
// var_dump($url);
return TVSouLiveParse::parseMovieInfoByContent($content, $p_code, $type);
}
示例15: updatecachefile
function updatecachefile($filename)
{
global $db, $tablepre;
switch ($filename) {
case "config":
$query = $db->query("SELECT * FROM `{$tablepre}config`");
while ($result = $db->fetch_array($query)) {
$options[$result['name']] = $result['value'];
}
$data .= '$options = ' . var_export($options, true) . ";\n";
//此函数返回关于传递给该函数的变量的结构信息
$str = serialize($options);
writetofile('config.ini', ROOT_PATH . "cache" . DS . 'config', $str, 1);
//writetocache('config','config',$data);
break;
}
}