【php开源代码栏目提醒】:网学会员php开源代码为您提供getTalenet.php参考,解决您在getTalenet.php学习中工作中的难题,参考学习。
<?php
/*
* Created on 2006-11-21
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse -
PHP - Code Templates
*/
session_start();
require_once('db.php');
$db = new DataAccess();
$db->connect();
//个人用户不能收藏个人用户
if ($_SESSION['usercode']!=2 or empty($_SESSION['validuser']))
{
header("Location:com/error.php?errid=10");
return;
}
$eid = $_SESSION['validuser'];
$uid = $_GET['personid'];
$sql = "select count(*) m from talenet where enterprise_id='$eid'";
$result = $db->query($sql);
$row = mysql_fetch_array($result);
//vip可以添加10人,非vip只添加1人
if(1==$_SESSION['vip'] and $row['m']>=10)
{
header("Location:com/error.php?errid=9");
return;
}
if(0==$_SESSION['vip'] and $row['m']>=1)
{
header("Location:com/error.php?errid=8");
return;
}
//判断是否重复添加同一人进入才库
$
sql = "select user_id from talenet where enterprise_id='$eid'";
$result = $db->query($sql);
while($row =
mysql_fetch_array($result))
if($uid==$row['user_id'] and !empty($row['user_id']) and !empty($uid))
{
header("Location:com/error.php?errid=7");
return;
}
//添加此人才
$db1 = new DataAccess();
$db1->connect();
$time = date('y.m.d h:i:s');
$sql="insert into talenet(enterprise_id,user_id,addtime) " .
"values('$eid','$uid','$time')";
$db1->perform($sql);
echo "添加完毕";
//header("Location:../index.php");
?>