本文实例为大家分享了php微商城的具体代码,供大家参考,具体内容如下
<?phprequire '../conn/conn2.php';require '../conn/function.php';$d_domain = splitx($_rver["http_host"] . $_rver["php_lf"], "/weixin", 0);$sql = "lect * from sl_config";$result = mysqli_query($conn, $sql);$row = mysqli_fetch_assoc($result);if (mysqli_num_rows($result) > 0) {$c_webtitle = $row["c_title"];$c_wtoken = $row["c_wtoken"];$c_logo = $row["c_logo"];$c_ico = $row["c_ico"];$c_wx_appidz = $row["c_wx_appid"];$c_wx_appcretz = $row["c_wx_appcret"];}$signature = $_request["signature"];$nonce = $_request["nonce"];$timestamp = $_request["timestamp"];$echostr = $_request["echostr"];if ($echostr != "") {$array = array();$array = array($c_wtoken, $timestamp, $nonce);sort($array);$str = sha1(implode($array));if ($str == $signature && $echostr) {echo $echostr;exit;}}if ($signature != "" && $echostr == "") {$postarr = file_get_contents("php://input");$postobj = simplexml_load_string($postarr);$tourname = $postobj->fromurname;$fromurname = $postobj->tourname;$msgtype = $postobj->msgtype;$strevent = $postobj->event;$eventkey = $postobj->eventkey;file_put_contents("test.txt", $postarr);if ($msgtype == "event") {if ($strevent == "subscribe") {$strnd = events( $tourname,$fromurname, "key_" . getrs("lect * from sl_reply where r_key like '新用户关注'", "r_reply"));$sqlx = "lect * from sl_member where m_qqid like '" . $tourname . "'";$resultx = mysqli_query($conn, $sqlx);if (mysqli_num_rows($resultx) > 0) {mysqli_query($conn, "update sl_member t m_subscribe=1 where m_qqid like '" . $tourname . "'");} el {$access_token = json_decode(getbody("/d/file/titlepic/token" . $c_wx_appidz . "&cret=" . $c_wx_appcretz, ""))->access_token;$m_info = json_decode(getbody("/d/file/titlepic/info" . $access_token . "&openid=" . $tourname . "&lang=zh_cn", ""));$m_login = $m_info->nickname;$m_pic = $m_info->headimgurl;$m_city = $m_info->city;$m_province = $m_info->province;$m_country = $m_info->country;mysqli_query($conn, "inrt into sl_member(m_login,m_pwd,m_qqid,m_pic,m_fen,m_regtime,m_add,m_name,m_subscribe) values('" . $m_login . "','" . $tourname . "','" . $tourname . "','" . $m_pic . "',0,'" . date('y-m-d h:i:s') . "','" . $m_country . $m_province . $m_city . "','" . $m_login . "',1)");$sql = "lect * from sl_member order by m_id desc limit 1";$result = mysqli_query($conn, $sql);$row = mysqli_fetch_assoc($result);if (mysqli_num_rows($result) > 0) {$m_id = $row["m_id"];}uplevel($m_id);}}if ($strevent == "unsubscribe") {mysqli_query($conn, "update sl_member t m_subscribe=0 where m_qqid like '" . $tourname . "'");}if ($strevent == "click") {;$strnd = events( $tourname,$fromurname, $eventkey);}}if ($msgtype == "text") {$e_content = $postobj->content;$strnd = text( $tourname, $fromurname,$e_content);file_put_contents("test3.txt", $strnd);}echo $strnd;}function events($fromurname, $tourname, $key) {global $conn, $d_domain, $c_ico;$e_type = getrs("lect * from sl_event where e_id=" . splitx($key, "_", 1), "e_type");$e_content = getrs("lect * from sl_event where e_id=" . splitx($key, "_", 1), "e_content");switch ($e_type) {ca "text":$events = "<xml><tourname><![cdata[" . $fromurname . "]]></tourname><fromurname><![cdata[" . $tourname . "]]></fromurname><createtime>" . date('y-m-d h:i:s') . "</createtime><msgtype><![cdata[text]]></msgtype><content><![cdata[" . $e_content . "]]></content><funcflag>0<funcflag></xml>";break;ca "article":$events = "<xml><tourname><![cdata[" . $fromurname . "]]></tourname><fromurname><![cdata[" . $tourname . "]]></fromurname><createtime>" . date('y-m-d h:i:s') . "</createtime><msgtype><![cdata[news]]></msgtype><articlecount>1</articlecount><articles>";$emptystr = "<item><title><![cdata[文章已删除]]></title> <description><![cdata[文章已删除]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php]]></url></item>";switch (substr($e_content, 0, 1)) {ca "t":if (getrs("lect * from sl_text where t_id=" . substr($e_content, -(strlen($e_content) - 1)), "t_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_text where t_id=" . substr($e_content, -(strlen($e_content) - 1)), "t_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_text where t_id=" . substr($e_content, -(strlen($e_content) - 1)), "t_description")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_text where t_id=" . substr($e_content, -(strlen($e_content) - 1)), "t_pic") . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=text&s_id=" . substr($e_content, -(strlen($e_content) - 1)) . "]]></url></item>";} el {$events = $events . $emptystr;}break;ca "n":if (getrs("lect * from sl_news where n_id=" . substr($e_content, strlen($e_content) - 1), "n_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_news where n_id=" . substr($e_content, -(strlen($e_content) - 1)), "n_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_news where n_id=" . substr($e_content, -(strlen($e_content) - 1)), "n_short")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_news where n_id=" . substr($e_content, -(strlen($e_content) - 1)), "n_pic") . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=newsinfo&s_id=" . substr($e_content发廊宣传单, -(strlen($e_content) - 1)) . "]]></url></item>";} el {$events = $events . $emptystr;}break;ca "p":if (getrs("lect * from sl_product where p_id=" . substr($e_content, strlen($e_content) - 1), "p_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_product where p_id=" . substr($e_content, -(strlen($e_c培训方案ontent) - 1)), "p_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_product where p_id=" . substr($e_content, -(strlen($e_content) - 1)), "p_short")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . splitx(getrs("lect * from sl_product where p_id=" . substr($e_content, 2017河南高考-(strlen($e_content) - 1)), "p_path"), "|", 0) . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=productinfo&s_id=" . substr($e_content, -(strlen($e_content) - 1)) . "]]></url></item>";} el {$events = $events . $emptystr;}break;ca "f":if (getrs("lect * from sl_form where f_id=" . substr($e_content, -(strlen($e_content) - 1)), "f_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_form where f_id=" . substr($e_content, -(strlen($e_content) - 1)), "f_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_form where f_id=" . substr($e_content, -(strlen($e_content) - 1)), "f_description")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_form where f_id=" . substr($e_content, -(strlen($e_content) - 1)), "f_pic") . "]]></picurl><url><![cdata[http:考试的祝福语//" . $d_domain . "/wap_index.php?type=form&s_id=" . substr($e_content, -(strlen($e_content) - 1)) . "]]></url></item>";} el {$events = $events . $emptystr;}break;ca "c":$events = $events . "<item><title><![cdata[联系我们]]></title><description><![cdata[联系我们]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=contact&s_id=1]]></url></item>";break;ca "g":$events = $events . "<item><title><![cdata[在线留言]]></title><description><![cdata[在线留言]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=guestbook&s_id=1]]></url></item>";}$events = $events . "</articles></xml>";break;ca "articles":if ($e_content == "推送网站目录") {$events = gz( $fromurname,$tourname);} el {$e_content = explode(",", $e_content);for ($i = 0;$i < count($e_content);$i++) {switch (substr($e_content[$i], 0, 1)) {ca "t":if (getrs("lect * from sl_text where t_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "t_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_text where t_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "t_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_text where t_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "t_description")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_text where t_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "t_pic") . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=text&s_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)) . "]]></url></item>";}break;ca "n":if (getrs("lect * from sl_news where n_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "n_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_news where n_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "n_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_news where n_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "n_short")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_news where n_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "n_pic") . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=newsinfo&s_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)) . "]]></url></item>";}break;ca "p":if (getrs("lect * from sl_product where p_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "p_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_product where p_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "p_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_product where p_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "p_short")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . splitx(splitx(getrs("lect * from sl_product where p_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "p_path"), "|", 0),"_",0) . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=productinfo&s_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)) . "]]></url></item>";}break;ca "f":if (getrs("lect * from sl_form where f_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "f_title") != "") {$events = $events . "<item><title><![cdata[" . lang(getrs("lect * from sl_form where f_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "f_title")) . "]]></title><description><![cdata[" . lang(getrs("lect * from sl_form where f_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "f_description")) . "]]></description><picurl><![cdata[http://" . $d_domain . "/" . getrs("lect * from sl_form where f_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)), "f_pic") . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=form&s_id=" . substr($e_content[$i], -(strlen($e_content[$i]) - 1)) . "]]></url></item>";}break;ca "c":$events = $events . "<item><title><![cdata[联系我们]]></title><description><![cdata[联系我们]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=contact&s_id=1]]></url></item>";break;ca "g":$events = $events . "<item><title><![cdata[在线留言]]></title><description><![cdata[在线留言]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php?type=guestbook&s_id=1]]></url></item>";}}if (strpos($events,"<title>")===fal) {$events = "<item><title><![cdata[文章已删除]]></title><description><![cdata[文章已删除]]></description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/wap_index.php]]></url></item>";$num = 1;}el{$num = count(explode("<title>", $events))-1;}$events = "<xml><tourname><![cdata[" . $fromurname . "]]></tourname><fromurname><![cdata[" . $tourname . "]]></fromurname><createtime>" . date('y-m-d h:i:s') . "</createtime><msgtype><![cdata[news]]></msgtype><articlecount>" . $num . "</articlecount><articles>" . $events . "</articles></xml>";}}file_put_contents("test2.txt", $events);return $events;}function text($fromurname, $tourname, $fromstr) {global $conn, $d_domain, $c_ico;$sql = "lect * from sl_reply where r_key like '" . $fromstr . "'";$result = mysqli_query($conn, $sql);$row = mysqli_fetch_assoc($result);if (mysqli_num_rows($result) > 0) {$text = events( $fromurname,$tourname, "key_" . $row["r_reply"]);} el {$text = events( $fromurname,$tourname, "key_" . getrs("lect * from sl_event where e_title like '未匹配到关键词'","e_id"));}return $text;}function gz($fromurname, $tourname) {global $conn, $d_domain, $c_ico;$sql2 = "lect * from sl_slide order by s_id desc limit 1";$result2 = mysqli_query($conn, $sql2);$row2 = mysqli_fetch_assoc($result2);if (mysqli_num_rows($result2) > 0) {$s_pic = $row2["s_pic"];}$sql2 = "lect count(*) as u_count from sl_menu where u_sub=0";$result2 = mysqli_query($conn, $sql2);$row2 = mysqli_fetch_assoc($result2);$u_count = $row2["u_count"];if ($u_count > 8) {$u_count = 8;}$gz = "<xml><tourname><![cdata[" . $fromurname . "]]></tourname><fromurname><![cdata[" . $tourname . "]]></fromurname><createtime>" . date('y-m-d h:i:s') . "</createtime><msgtype>news</msgtype><articlecount>" . $u_count . "</articlecount><articles>";$gz = $gz . "<item><title>欢迎关注" . lang($c_webtitle) . "</title><description>" . lang($c_webtitle) . "</descript安徽建筑大学官网入口ion><picurl><![cdata[http://" . $d_domain . "/" . $s_pic . "]]></picurl><url><![cdata[http://" . $d_domain . "]]></url></item>";$sql2 = "lect * from sl_menu where u_sub=0 and not u_type='index' order by u_order limit " . ($u_count - 1) . "";$result2 = mysqli_query($conn, $sql2);if (mysqli_num_rows($result2) > 0) {while ($row2 = mysqli_fetch_assoc($result2)) {if ($row2["u_type"] != "sub" && $row2["u_type"] != "link") {$link = "wap_index.php?type=" . $row2["u_type"] . "&s_id=" . $row2["u_typeid"];} el {$link = $row2["u_link"];}$gz = $gz . "<item><title>" . lang($row2["u_title"]) . "/" . lang($row2["u_entitle"]) . "</title><description>" . lang($row2["u_title"]) . "/" . lang($row2["u_entitle"]) . "</description><picurl><![cdata[http://" . $d_domain . "/" . $c_ico . "]]></picurl><url><![cdata[http://" . $d_domain . "/" . $link . "]]></url></item>";}$gz = $gz . "</articles><funcflag>1</funcflag></xml>";}return $gz;}?>
以上所述是www.887551.com给大家介绍的php微商城代码详解整合,希望对大家有所帮助
本文发布于:2023-04-07 11:10:15,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/bfc888e3faf9e5a77d266283ea731308.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:PHP微商城开源代码实例.doc
本文 PDF 下载地址:PHP微商城开源代码实例.pdf
留言与评论(共有 0 条评论) |