case 2: $etime = $datetime + 86400 - 1; $etime += ($cs - 1) * 86400 * 7; break; case 1: $etime = $metime + 86400 - 1; break; default: $etime = $datetime + 86400 - 1; break; } $address = htmlspecialchars(trim($_POST['address']), ENT_QUOTES); $iSQL = sprintf('insert into %s (uid, jluid, xqid, name, content, c_cy, isgf, isxzrs, xzrs, datetime, sjtid, cs, etime, address, lasttime) values (%s, %s, %s, %s, %s, 1, %s, %s, %s, %s, %s, %s, %s, %s, %s)', $yjl_dbprefix . 'hd', $user_id, $jluid, $hxqid, yjl_SQLString($name, 'text'), yjl_SQLString($content, 'text'), $isgf, $isxzrs, $xzrs, $datetime, $sjtid, $cs, $etime, yjl_SQLString($address, 'text'), time()); $result = mysql_query($iSQL) or die(''); $hdid = mysql_insert_id(); yjl_addlog('[uid]创建活动:<a href="active-' . $hxqid . '-' . $hdid . '.html">' . $name . '</a>', md5('cjhd|' . $user_id . '|' . $user_id . '|' . $hdid)); if ($hxqid > 0) { $uSQL = sprintf('update %s set c_hd=c_hd+1 where xqid=%s', $yjl_dbprefix . 'xq', $hxqid); $result = mysql_query($uSQL) or die(''); } $iSQL = sprintf('insert into %s (uid, hdid, datetime) values (%s, %s, %s)', $yjl_dbprefix . 'hd_user', $user_id, $hdid, time()); $result = mysql_query($iSQL) or die(''); $app_a = yjl_app('活动 ' . $name, $hdid, $yjl_url . 'active-' . $hxqid . '-' . $hdid . '.html', 'hd'); $uSQL = sprintf('update %s set app_id=%s where hdid=%s', $yjl_dbprefix . 'hd', $app_a[0], $hdid); $result = mysql_query($uSQL) or die(''); require_once 'lib/jishigouapi.class.php'; $JishiGouAPI = new JishiGouAPI($yjl_url . $yjl_tpath . 'api.php', $app_a[1], $app_a[2], $udb['nickname'], md5($udb['nickname'] . $udb['password'])); $content = '添加活动:' . $_POST['name'] . ' ' . $yjl_url . 'active-' . $hxqid . '-' . $hdid . '.html'; $jsg_result = $JishiGouAPI->AddTopic($content); if (!isset($jsg_result['error']) && isset($jsg_result['result']['tid'])) { $tid = $jsg_result['result']['tid'];
$iSQL = sprintf('insert into %s (uid, hdid, name, lxfs, email, xqid, xqname, iscy, datetime) values (%s, %s, %s, %s, %s, %s, %s, %s, %s)', $yjl_dbprefix . 'hd_user', $user_id, $hdid, yjl_SQLString($name, 'text'), yjl_SQLString($lxfs, 'text'), yjl_SQLString($email, 'text'), $xqid, yjl_SQLString($xqname, 'text'), $iscy, time()); $result = mysql_query($iSQL) or die(''); if ($iscy > 0) { if ($user_id > 0) { yjl_addlog('[uid]申请参加活动:<a href="active-' . $xqid . '-' . $hdid . '.html">' . $r_res['name'] . '</a>', md5('hdcj|' . $r_res['uid'] . '|' . $user_id . '|' . $hdid), 1, $r_res['uid'], $user_id); } else { yjl_addlog($name . '申请参加活动:<a href="active-' . $xqid . '-' . $hdid . '.html">' . $r_res['name'] . '</a>', md5('hdcj|' . $r_res['uid'] . '|' . time() . '|' . $hdid), 1, $r_res['uid']); } echo 'alert(\'已申请参加,请等待审核。\');'; } else { $uSQL = sprintf('update %s set c_cy=c_cy+1, lasttime=%s where hdid=%s', $yjl_dbprefix . 'hd', time(), $r_res['hdid']); $result = mysql_query($uSQL) or die(''); if ($user_id > 0) { yjl_addlog('[uid]参加活动:<a href="active-' . $xqid . '-' . $hdid . '.html">' . $r_res['name'] . '</a>', md5('hdcj|' . $r_res['uid'] . '|' . $user_id . '|' . $hdid), 0, $r_res['uid'], $user_id); } else { yjl_addlog($name . '参加活动:<a href="active-' . $xqid . '-' . $hdid . '.html">' . $r_res['name'] . '</a>', md5('hdcj|' . $r_res['uid'] . '|' . time() . '|' . $hdid), 0, $r_res['uid']); } echo 'alert(\'祝贺您已报名成功,请您注意活动时间,欢迎您准时参加!\');'; } } else { echo 'alert(\'请输入姓名、联系方式、邮箱、小区名。\');'; } echo 'location.href=\'active-' . $xqid . '-' . $hdid . '.html\';</script>'; exit; } if (isset($_GET['j']) && $_GET['j'] == 1) { $js_c .= ' $(\'#cj_link\').click(); $(\'.close\').click(function(){ location.href=\'active-' . $xqid . '-' . $hdid . '.html\'; });';
function yjl_follow($u, $i) { global $dbprefix; $q_res = sprintf('select uid from %s where uid=%s and buddyid=%s limit 1', $dbprefix . 'buddys', $i, $u); $res = mysql_query($q_res) or die(mysql_error()); if (mysql_num_rows($res) == 0) { yjl_addlog('[uid]关注了[luid]', md5('gz|' . $u . '|' . $i), 0, $u, $i); $iSQL = sprintf('insert into %s (uid, buddyid, dateline, buddy_lastuptime) values (%s, %s, %s, %s)', $dbprefix . 'buddys', $i, $u, time(), time()); $result = mysql_query($iSQL) or die(mysql_error()); $uSQL = sprintf('update %s set follow_count=follow_count+1 where uid=%s', $dbprefix . 'members', $i); $result = mysql_query($uSQL) or die(mysql_error()); $uSQL = sprintf('update %s set fans_count=fans_count+1 where uid=%s', $dbprefix . 'members', $u); $result = mysql_query($uSQL) or die(mysql_error()); } mysql_free_result($res); }