⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 功能齐全
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php
//
require_once("config.inc.php");
//
require_once("include/DataSet.inc.php");
require_once("include/DB.inc.php");
require_once("include/Vant.inc.php");
require_once("include/Language.inc.php");
require_once("include/String.inc.php");
require_once("include/OutputHtml.inc.php");
//
$pp = new PhpPage();
$pp->phprun();
$pp->phpexit();
//
class PhpPage
{
	var $db;
	var $tpl;
	var $data;
	var $sys_lang;

	function PhpPage()
	{
		$this->db   = & new DB(HOST,USERNAME,PASSWORD,DATABASE,'');
		$this->db->connect();
		$this->data = & new DataSet($this->db);
		$this->sys_lang = & new Language("include/language/");
		$this->sys_lang->setLanguage();
		$this->tpl  = & new Vant("templates/");
	}

	function phpexit()
	{
		$this->db->close();
	}

	function phprun()
	{
		$this->tpl->set("sitename","Friends!婚介交友");
		require_once("function.php");
		/*
		判断是否管理员登录
		如果是,则显示编辑
		*/
		if(isAdmin($_COOKIE['loginname']))$admin=1;
		else $admin=0;
		$this->tpl->set("admin",$admin);
		$this->tpl->set("loginname",$_COOKIE['loginname']);
		$this->tpl->set("msg",$msg);
		
		if($_GET['op'] == '' && $_POST['op'] == '')$this->onInit();
		else
		{
			$op = $_GET['op'] != '' ? $_GET['op']:$_POST['op'];
			$this->{"on".$op}();
		}
	}

	function onInit()
	{
		$db = & $this->db;
		$tpl = & $this->tpl;
		$ds  = & new DataSet($db);

		require_once($this->sys_lang->getLangfile());

		//取最新男会员数据
		$str1 = "select username,birth,place,city from friends_user where sex=1 and grade>0 and active='1' order by joindate DESC";
		//取最新女会员数据
		$str2 = "select username,birth,place,city from friends_user where sex=2 and grade>0 and active='1' order by joindate DESC";
		//取最受欢迎男会员数据
		//$str3 = "select t1.username,t1.birth,t1.place,t1.city,t2.path,t2.click from friends_user as t1,user_album as t2 where t1.sex=1 and t2.fm=1 and t2.approved>0 and t1.username=t2.username and t1.active='1' and t1.grade>0 order by t2.click DESC";
		$str3 = "select username,birth,place,city from friends_user where sex=1 and active='1' and grade>0 order by click DESC";
		//取最受欢迎女会员数据
		//$str4 = "select t1.username,t1.birth,t1.place,t1.city,t2.path,t2.click from friends_user as t1,user_album as t2 where t1.sex=2 and t2.fm=1 and t2.approved>0 and t1.username=t2.username and t1.active='1' and t1.grade>0 order by t2.click DESC";
		$str4 = "select username,birth,place,city from friends_user where sex=2 and active='1' and grade>0 order by click DESC";
		//取公告信息
		$str5 = "select * from friends_words where category=1 order by date DESC";
		//取新闻信息
		$str6 = "select * from friends_words where category=2 order by date DESC";
		//取最受欢迎照片(相册 and t2.fm=1)信息
		$str7 = "select t1.username,t1.birth,t1.place,t1.city,t2.path,t2.click from friends_user as t1,user_album as t2 where t1.username=t2.username and t2.fm=1 and t2.approved>0 and t1.grade>0 and t1.active='1' order by t2.click DESC";
		//将数据放入翻页类
		$coObj1 = $ds->getList($str1,10);
		$coObj2 = $ds->getList($str2,10);
		$coObj3 = $ds->getList($str3,10);
		$coObj4 = $ds->getList($str4,10);
		$coObj5 = $ds->getList($str5,10);
		$coObj6 = $ds->getList($str6,10);
		$coObj7 = $ds->getList($str7,10);
		//将数据输入模板
		$tpl->set("m_data",$coObj1->field);
		$tpl->set("f_data",$coObj2->field);
		$tpl->set("m_data1",$coObj3->field);
		$tpl->set("f_data1",$coObj4->field);
		$tpl->set("bulletin",$coObj5->field);
		$tpl->set("news",$coObj6->field);
		$tpl->set("hotpic",$coObj7->field);
		$tpl->parse("index.html");
	}

	function onReg()
	{
		$tpl = & $this->tpl;
		$otHtml = & new OutputHtml();

		require_once($this->sys_lang->getLangfile());
		require_once("function.php");

		if($_POST['agree']==1||isAdmin($_COOKIE['loginname']))
		{
			$tpl->set("column",$nav["reg"]);
			$tpl->set("sex",$otHtml->selection("sex",$lang_sex["values"],$lang_sex["texts"],0,""));
			$tpl->set("byear",byear($byear));
			$tpl->set("bmonth",bmonth($bmonth));
			$tpl->set("bday",bday($bday));
			$tpl->set("place",$otHtml->selection("place",$lang_place["values"],$lang_place["texts"],0,"onChange='change_area(document.inputform)'"));
			$tpl->set("place1","0");
			$tpl->set("city",$lang_place["texts"][0]);
			$tpl->set("edu",$otHtml->selection("edu",$lang_edu["values"],$lang_edu["texts"],0,""));
			$tpl->set("job",$otHtml->selection("job",$lang_job["values"],$lang_job["texts"],0,""));
			$tpl->set("income",$otHtml->selection("income",$lang_income["values"],$lang_income["texts"],0,""));
			$tpl->set("height",height(160));
			$tpl->set("weight",weight(45));
			$tpl->set("marriage",$otHtml->selection("marriage",$lang_marriage["values"],$lang_marriage["texts"],0,""));
			$tpl->set("relation",$otHtml->selection("relation",$lang_relation["values"],$lang_relation["texts"],0,""));
			$tpl->set("skilledlang",$otHtml->selection("skilledlang[]",$lang_languages["values"],$lang_languages["texts"],0,"multiple size=10"));
			$tpl->set("studyinglang",$otHtml->selection("studyinglang[]",$lang_languages["values"],$lang_languages["texts"],0,"multiple size=10"));
			$tpl->set("interest",$otHtml->selection("interest[]",$lang_interest["values"],$lang_interest["texts"],0,"multiple size=5"));
			$tpl->set("drink",$otHtml->selection("drink",$lang_drink["values"],$lang_drink["texts"],0,""));
			$tpl->set("smoke",$otHtml->selection("smoke",$lang_smoke["values"],$lang_smoke["texts"],0,""));
			$tpl->set("grade","1");
			$tpl->set("isupdate","0");
			$tpl->set("main_middle","userinfo.html");
		}
		else
		{
			$tpl->set("column",$nav["regment"]);
			$tpl->set("main_middle","agreement.html");
		}

		if(isAdmin($_COOKIE['loginname']))
		$tpl->parse("admin_main.html");
		else
		$tpl->parse("main.html");
	}

	function onNewuser()
	{
		$db  = & $this->db;
		$tpl = & $this->tpl;

		require_once($this->sys_lang->getLangfile());
		require_once("function.php");
		
		//取得用户的真实ip
		$ip			 = ip();
		$name        = $_POST['username'];
		$pass        = md5($_POST['pass']);
		if($_POST['pass2']=='')$newpass = $pass;
		else $newpass	= md5($_POST['pass2']);
		$mail        = $_POST['email'];
		$real        = $_POST['realname'];
		$sex        = $_POST['sex'];
		$byear        = $_POST['byear'];
		$bmonth        = $_POST['bmonth'];
		$bday        = $_POST['bday'];
		$place        = $_POST['place'];
		$city        = $_POST['city'];
		$address        = $_POST['adress'];
		$zipcode        = $_POST['zipcode'];
		$tel        = $_POST['tel'];
		$otherinfo	= $_POST['otherinfo'];
		$edu	= $_POST['edu'];
		$job        = $_POST['job'];
		$income        = $_POST['income'];
		$birth        = $byear."-".$bmonth."-".$bday;
		$date        = date("Y-m-d");
		$height = $_POST['height'];
		$weight = $_POST['weight'];
		$marriage = $_POST['marriage'];
		$relation = $_POST['relation'];
		$skilledlang = array_string($_POST['skilledlang']);
		$studyinglang = array_string($_POST['studyinglang']);
		$interest = array_string($_POST['interest']);
		$drink = $_POST['drink'];
		$smoke = $_POST['smoke'];
		$aboutme = $_POST['aboutme'];

		if($_POST['isupdate'] == 1){
			//如果是管理员登录,则直接修改用户资料
			if(isAdmin($_COOKIE['loginname']))
			{
				$str = "update friends_user set pass='$newpass',email='$mail',realname='$real',sex='$sex',birth='$birth',place='$place',city='$city',address='$address',zipcode='$zipcode',tel='$tel',otherinfo='$otherinfo',edu='$edu',job='$job',income='$income',height = '$height',weight = '$weight',marriage = '$marriage',relation = '$relation',skilledlang = '$skilledlang',studyinglang = '$studyinglang',interest = '$interest',drink = '$drink',smoke = '$smoke',aboutme = '$aboutme' where username='$name'";
			}
			else
			{
				if($db->num_rows($db->query("select * from friends_user where username='$name' and pass='$pass'"))<1)
				exit($lang_sysmsg['regerro1']);
				
				$str = "update friends_user set pass='$newpass',email='$mail',realname='$real',sex='$sex',birth='$birth',place='$place',city='$city',address='$address',zipcode='$zipcode',tel='$tel',otherinfo='$otherinfo',edu='$edu',job='$job',income='$income',height = '$height',weight = '$weight',marriage = '$marriage',relation = '$relation',skilledlang = '$skilledlang',studyinglang = '$studyinglang',interest = '$interest',drink = '$drink',smoke = '$smoke',aboutme = '$aboutme',update = '$date',uptimes=uptimes+1 where username='$name'";
				//更新积分
				upPoint($name,"Modify","");
			}
			$msg_ok = $lang_sysmsg['updateok'];
			$msg_no = $lang_sysmsg['updateerro'];
		}
		else
		{
			if($db->num_rows($db->query("select * from friends_user where username='$name'"))>0)
			exit($lang_sysmsg['regerro2']);
			$str = "insert into friends_user values('','$name','$pass','$mail','$date','$ip','$real','$sex','$birth','$place','$city','$address','$zipcode','$tel','$otherinfo','$edu','$job','$income','1','$height','$weight','$marriage','$relation','$skilledlang','$studyinglang','$interest','$drink','$smoke','$aboutme','$date','1','0','0','0')";
			$msg_ok = $lang_sysmsg['newuserok'];
			$msg_no = $lang_sysmsg['newusererro'];
			//更新积分
			upPoint($name,"NewUser","");
		}
		//echo $str;exit;
		if($db->query($str))
		{
			$tpl->set("msg",$msg_ok);
		}
		else
		{
			$tpl->set("msg",$msg_no);
		}
		$tpl->set("gourl","index.php");
		$tpl->set("timesup","2000");
		$tpl->set("main_middle","sysmsg.html");
		$tpl->parse("main.html");
	}

	function onModify()
	{
		$db  = & $this->db;
		$tpl = & $this->tpl;
		$otHtml = & new OutputHtml();

		require_once($this->sys_lang->getLangfile());
		require_once("function.php");
		/*
		判断是否管理员登录
		如果是则显示编辑会员资料
		*/
		if(isAdmin($_COOKIE['loginname']))
		{
			$user = $_GET['name']!=""?$_GET['name']:$_COOKIE['loginname'];
			$tpl->set("admin",1);
		}
		else
		$user = $_COOKIE['loginname'];
		
		$str = "select * from friends_user where username='$user'";
		$res = $db->query($str);
		if($db->num_rows($res)>0)
		{
			$arr = $db->fetch_array($res);
			$name        = $arr['username'];
			$mail        = $arr['email'];
			$real        = $arr['realname'];
			$sex        = $arr['sex'];
			$birth        = $arr['birth'];
			$ymd        = explode("-",$birth);
			$byear        = $ymd[0];
			$bmonth        = $ymd[1];
			$bday        = $ymd[2];
			$place        = $arr['place'];
			$city        = $arr['city'];
			$address        = $arr['address'];
			$zipcode        = $arr['zipcode'];
			$tel        = $arr['tel'];
			$otherinfo	= $arr['otherinfo'];
			$edu	= $arr['edu'];
			$job        = $arr['job'];
			$income        = $arr['income'];
			$height = $arr['height'];
			$weight = $arr['weight'];
			$marriage = $arr['marriage'];
			$relation = $arr['relation'];
			$skilledlang = string_array($arr['skilledlang']);
			$studyinglang = string_array($arr['studyinglang']);
			$interest = string_array($arr['interest']);
			$drink = $arr['drink'];
			$smoke = $arr['smoke'];
			$aboutme = $arr['aboutme'];
			
			$tpl->set("column",$nav["modify"]);
			$tpl->set("username",$name);
			$tpl->set("email",$mail);
			$tpl->set("realname",$real);
			$tpl->set("sex",$otHtml->selection("sex",$lang_sex["values"],$lang_sex["texts"],$sex,""));
			$tpl->set("byear",byear($byear));
			$tpl->set("bmonth",bmonth($bmonth));
			$tpl->set("bday",bday($bday));
			$tpl->set("place",$otHtml->selection("place",$lang_place["values"],$lang_place["texts"],$place,"onChange='change_area(document.inputform)'"));
			$tpl->set("place1","$place");
			$tpl->set("city",$city);
			$tpl->set("address",$address);
			$tpl->set("zipcode",$zipcode);
			$tpl->set("tel",$tel);
			$tpl->set("otherinfo",$otherinfo);
			$tpl->set("edu",$otHtml->selection("edu",$lang_edu["values"],$lang_edu["texts"],$edu,""));
			$tpl->set("job",$otHtml->selection("job",$lang_job["values"],$lang_job["texts"],$job,""));
			$tpl->set("income",$otHtml->selection("income",$lang_income["values"],$lang_income["texts"],$income,""));

			$tpl->set("height",height($height));
			$tpl->set("weight",weight($weight));
			$tpl->set("marriage",$otHtml->selection("marriage",$lang_marriage["values"],$lang_marriage["texts"],$marriage,""));
			$tpl->set("relation",$otHtml->selection("relation",$lang_relation["values"],$lang_relation["texts"],$relation,""));
			$tpl->set("skilledlang",$otHtml->selection("skilledlang[]",$lang_languages["values"],$lang_languages["texts"],$skilledlang,"multiple size=10"));
			$tpl->set("studyinglang",$otHtml->selection("studyinglang[]",$lang_languages["values"],$lang_languages["texts"],$studyinglang,"multiple size=10"));
			$tpl->set("interest",$otHtml->selection("interest[]",$lang_interest["values"],$lang_interest["texts"],$interest,"multiple size=5"));
			$tpl->set("drink",$otHtml->selection("drink",$lang_drink["values"],$lang_drink["texts"],$drink,""));
			$tpl->set("smoke",$otHtml->selection("smoke",$lang_smoke["values"],$lang_smoke["texts"],$smoke,""));
			$tpl->set("aboutme",$aboutme);

			$tpl->set("isupdate",1);
			$tpl->set("main_middle","userinfo.html");

		}
		else
		{
			$tpl->set("msg",$lang_sysmsg['nologin']);
			$tpl->set("gourl","index.php");
			$tpl->set("timesup","2000");
			$tpl->set("main_middle","sysmsg.html");
		}
		$tpl->parse("main.html");
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -