<style type="text/css">
.gray-dashed {
border-bottom: #000 1px dashed;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #3c3c3c;
LINE-HEIGHT: 16px
}
.list {
LINE-HEIGHT: 16px
}
</style>
<?php
header("Content-Type: text/html; charset=utf-8"); $employee_no = $_GET['employeeid'];
$employee_name = $_GET['username_erp'];
?>
<script type="text/javascript">
function showDetail_erpforum(para){
alert("tid是多少 "+para);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+$employee_no+"&username_erp="+$employee_name+"&tid="+para ;
window.open(url);
}
</script><?php
$conn = mysql_connect("10.222.1.104","root","passw0rd");
mysql_select_db("discuz");
mysql_query("set names utf8;",$conn);
$sql = "select * from cdb_posts p where p.fid =26 and subject <> '' ORDER by dateline desc limit 5 ";
$rs = mysql_query($sql);
?><?php if(@mysql_num_rows($rs)>0){
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) { ?>
<table class=list border=0 cellSpacing=0 cellPadding=0 width="105%" align=center>
<tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);">
<td height="10" width="10" align="right" valign="bottom">
<image width="10" height="10" src="./images/arrow.gif" />
</td>
<td height=10 align="left" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<?php echo $row['subject'] ?>
</font>
</td>
<td height=10 align="right" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<? $d=date('Y-m-d',$row['dateline']); ?>
[<?echo $d; ?>
</font>]
</td>
<td width="5"> </td>
</tr>
</table>
<?php
}
mysql_close($conn);
}
?>这里有几个比较关键的,<script type="text/javascript">
function showDetail_erpforum(para){
alert("tid是多少 "+para);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+$employee_no+"&username_erp="+$employee_name+"&tid="+para ;
window.open(url);
}
</script>
<?php
header("Content-Type: text/html; charset=utf-8"); $employee_no = $_GET['employeeid'];
$employee_name = $_GET['username_erp'];
?>
<tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);">
这里 onclick 总是报错 不清楚php ,不知道该咋写
.gray-dashed {
border-bottom: #000 1px dashed;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #3c3c3c;
LINE-HEIGHT: 16px
}
.list {
LINE-HEIGHT: 16px
}
</style>
<?php
header("Content-Type: text/html; charset=utf-8"); $employee_no = $_GET['employeeid'];
$employee_name = $_GET['username_erp'];
?>
<script type="text/javascript">
function showDetail_erpforum(para){
alert("tid是多少 "+para);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+$employee_no+"&username_erp="+$employee_name+"&tid="+para ;
window.open(url);
}
</script><?php
$conn = mysql_connect("10.222.1.104","root","passw0rd");
mysql_select_db("discuz");
mysql_query("set names utf8;",$conn);
$sql = "select * from cdb_posts p where p.fid =26 and subject <> '' ORDER by dateline desc limit 5 ";
$rs = mysql_query($sql);
?><?php if(@mysql_num_rows($rs)>0){
while ($row = mysql_fetch_array($rs, MYSQL_ASSOC)) { ?>
<table class=list border=0 cellSpacing=0 cellPadding=0 width="105%" align=center>
<tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);">
<td height="10" width="10" align="right" valign="bottom">
<image width="10" height="10" src="./images/arrow.gif" />
</td>
<td height=10 align="left" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<?php echo $row['subject'] ?>
</font>
</td>
<td height=10 align="right" valign="bottom" class="gray-dashed">
<font style="font-size:12px;color:#353535">
<? $d=date('Y-m-d',$row['dateline']); ?>
[<?echo $d; ?>
</font>]
</td>
<td width="5"> </td>
</tr>
</table>
<?php
}
mysql_close($conn);
}
?>这里有几个比较关键的,<script type="text/javascript">
function showDetail_erpforum(para){
alert("tid是多少 "+para);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+$employee_no+"&username_erp="+$employee_name+"&tid="+para ;
window.open(url);
}
</script>
<?php
header("Content-Type: text/html; charset=utf-8"); $employee_no = $_GET['employeeid'];
$employee_name = $_GET['username_erp'];
?>
<tr vAlign=top style="cursor:hand" onclick="showDetail_erpforum(<?php $row['tid'] ?>);">
这里 onclick 总是报错 不清楚php ,不知道该咋写
onclick="showDetail_erpforum('<?php echo $row['tid'];?>');">
function showDetail_erpforum(para){
alert("tid是多少 "+para);
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+<?php echo $employee_no; ?>+"&username_erp="
+<?php echo $employee_name; ?>+"&tid="+para ;
alert("url"+url);
window.open(url);
}
</script>
第一个alert 输出了,第二个没有出来,报错“张三”undefined
其实指向的就是那个 $employee_name
不知道为嘛
行业要求: 互联网
职位描述: PHP开发工程师岗位职责与任职要求 岗位职责
互联网相关产品开发,项目开发,系统维护等 任职要求
1. 精通PHP开发语言,熟悉面向对象的软件设计方法;
2. 熟悉Unix/Linux操作系统,熟悉C/C++编程,熟悉Shell脚本编程及常用Unix管理命
令,熟悉bash/python/perl;
3. 熟悉HTTP协议及W3C相关互联网规范,熟练掌握XHTML、CSS、DIV、Javascript
等页面技术;
4. 熟悉MySQL数据库应用开发,了解MySQL的数据库配置管理、性能优化等基本操
作技能;
5. 具备良好的代码编程习惯及较强的文档编写能力;
6. 具备强烈的进取心、求知欲及团队合作精神,有较强的沟通及协调能力;
QQ(1486904696)MSN:[email protected]
这里改了吗?
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid=<?php echo $employee_no; ?>&username_erp=<?php echo $employee_name; ?>&tid="+tid ;
window.open(url);
}
这里已经正常的跳转到那个php了,而且参数通过alert来看 都是正确的。<?php
define('IN_DISCUZ', true);
define('DISCUZ_ROOT', './');
require_once './config.inc.php';
require_once './include/db_'.$database.'.class.php';
require_once './forumdata/cache/cache_settings.php';
header("Content-Type: text/html; charset=utf-8");$tid = $_GET['tid'];if ( !$ssoauth ) {
/* 若URL中没有SSO相关的参数,则尝试从HTTP请求中获取用户信息并进行SSO */ // 从请求中取sso信息,可自定义从url参数或者header中取
//$filterInfo = $employeeid; // from request
$headers = getallheaders();
//$filterInfo = $headers['iv-user'];
$filterInfo = $_GET['employeeid'];
$erp_username = $_GET['username_erp'];
// 下述情况下,需要根据filter信息重新生成用户session
if ( $filterInfo ) {
/* 取uid、pwd、secques,可自定义SQL条件,但查询结果不能变 */
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$query = $db->query("SELECT uid, password, secques FROM {$tablepre}members
WHERE uid=(SELECT uid FROM {$tablepre}memberfields WHERE employeeid='$filterInfo')");
$member = $db->fetch_array($query);
/* 若用户不存在,可自定义,如直接生成用户 */
if( !$member['uid'] ) {
// 直接插入用户,用户名为工号,密码为md5(123456), coped from admin/members.inc.php
$db->query("INSERT INTO {$tablepre}members (uid, password, groupid, username, timeoffset)
VALUES (NULL, 'e10adc3949ba59abbe56e057f20f883e', 10, '$filterInfo', '8');");
$uid = $db->insert_id();
$db->query("REPLACE INTO {$tablepre}memberfields (uid, employeeid) VALUES ('$uid','$filterInfo')");
//
$member['uid'] = $filterInfo;
$member['password'] = 'e10adc3949ba59abbe56e057f20f883e';
$member['secques'] = '';
}
$db->close(); /* 用户存在,则生成加密的cookie信息,并作为参数拼装到URL中重定向到论坛的实际地址 */
if( $member['uid'] ) {
$ssoauth = base64_encode(authcode($member['password']."\t".$member['secques']."\t".$member['uid'], 'ENCODE'));
$ssourl = $_DCACHE['settings']['siteurl'] . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
$ssourl = "$ssourl?ssoauth=$ssoauth&time=" . time();
// 采用js来进行重定向,并将url拆分,以免被WebSEAL截获并修改
print ('<script>');
print ('location.replace("' . substr($ssourl,0,6) . '"+"' . substr($ssourl,6) . '")');
print ('</script>');
}
}
} else {
/* 根据URL中的参数,重新生成cookie,并重定向到ERP论坛 */
dsetcookie('sid', '');
dsetcookie('cookietime', 0);
dsetcookie('auth', base64_decode($ssoauth), 0);
dsetcookie('erpvalidate', 'hide');
if( $tid ){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid=$tid&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}
}
就不正常了,print &tid 是空的,不知道为嘛 代码不走header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid=$tid&extra=page%3D1&sid=ywqyMG');
define('DISCUZ_ROOT', './');
require_once './config.inc.php';
require_once './include/db_'.$database.'.class.php';
require_once './forumdata/cache/cache_settings.php';
header("Content-Type: text/html; charset=utf-8");
$tid = $_GET['tid'];if ( !$ssoauth ) {
/* 若URL中没有SSO相关的参数,则尝试从HTTP请求中获取用户信息并进行SSO */ // 从请求中取sso信息,可自定义从url参数或者header中取
//$filterInfo = $employeeid; // from request
$headers = getallheaders();
//$filterInfo = $headers['iv-user'];
$filterInfo = $_GET['employeeid'];
$erp_username = $_GET['username_erp'];
// 下述情况下,需要根据filter信息重新生成用户session
if ( $filterInfo ) {
/* 取uid、pwd、secques,可自定义SQL条件,但查询结果不能变 */
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$query = $db->query("SELECT uid, password, secques FROM {$tablepre}members
WHERE uid=(SELECT uid FROM {$tablepre}memberfields WHERE employeeid='$filterInfo')");
$member = $db->fetch_array($query);
/* 若用户不存在,可自定义,如直接生成用户 */
if( !$member['uid'] ) {
// 直接插入用户,用户名为工号,密码为md5(123456), coped from admin/members.inc.php
$db->query("INSERT INTO {$tablepre}members (uid, password, groupid, username, timeoffset)
VALUES (NULL, 'e10adc3949ba59abbe56e057f20f883e', 10, '$filterInfo', '8');");
$uid = $db->insert_id();
$db->query("REPLACE INTO {$tablepre}memberfields (uid, employeeid) VALUES ('$uid','$filterInfo')");
//
$member['uid'] = $filterInfo;
$member['password'] = 'e10adc3949ba59abbe56e057f20f883e';
$member['secques'] = '';
}
$db->close(); /* 用户存在,则生成加密的cookie信息,并作为参数拼装到URL中重定向到论坛的实际地址 */
if( $member['uid'] ) {
$ssoauth = base64_encode(authcode($member['password']."\t".$member['secques']."\t".$member['uid'], 'ENCODE'));
$ssourl = $_DCACHE['settings']['siteurl'] . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
$ssourl = "$ssourl?ssoauth=$ssoauth&time=" . time();
// 采用js来进行重定向,并将url拆分,以免被WebSEAL截获并修改
print ('<script>');
print ('location.replace("' . substr($ssourl,0,6) . '"+"' . substr($ssourl,6) . '")');
print ('</script>');
}
}
} else {
/* 根据URL中的参数,重新生成cookie,并重定向到ERP论坛 */
dsetcookie('sid', '');
dsetcookie('cookietime', 0);
dsetcookie('auth', base64_decode($ssoauth), 0);
dsetcookie('erpvalidate', 'hide');
print ('<script>');
print ('alert("'.$tid.'");');
print ('</script>');
if( $tid ){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}
}这样的话先是弹一个alert,空的,什么也不显示,后来就报错,指向header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
我发现到了这里之后 判断 $tid 有问题,是空的,不进这个判断啊~~
echo $_GET['tid'];
echo $_REQUEST['tid'];哪一个有值?
都没值那就看: alert("tid是多少 "+para);//这里有值吗?
var url = "http://10.222.1.104:8080/discuz/erp_sso.php?employeeid="+$employee_no+"&username_erp="+$employee_name+"&tid="+para ;
window.open(url);或者看window.open打开的窗口的地址栏的地址是什么?
echo $_REQUEST['tid'];怎么写啊? 用alert的方式?
define('DISCUZ_ROOT', './');
require_once './config.inc.php';
require_once './include/db_'.$database.'.class.php';
require_once './forumdata/cache/cache_settings.php';
header("Content-Type: text/html; charset=utf-8");
$tid = $_GET['tid'];echo "GET:".$_GET['tid']."<br>";
echo "REQUEST:".$_REQUEST['tid']."<br>";
exit;.....
都有值的GET:9
REQUEST:9
if ( !$ssoauth ) {
第二次走的是 else 的那个
dsetcookie('cookietime', 0);
dsetcookie('auth', base64_decode($ssoauth), 0);
dsetcookie('erpvalidate', 'hide');
/*这里不能有输出否则后面的header会出错
print ('<script>');
print ('alert("'.$tid.'");');
print ('</script>');
*/
if($tid){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}
if ( !$ssoauth ) {
这里面也确实能获取tid 并 print 出来,然后第二次走的是
if ( !$ssoauth ) {
对应的else 里面,这时文件又一次重新读取,$tid = $_GET['tid']; 就获取不到东西了,所以里面的判断就...
if($tid){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}我在想 在
if ( !$ssoauth ) {
里面获取即 $tid = $_GET['tid']; 并 存入cookie,等第二次到了else的时候 ,从cookie里面取出来放到里面进行判断,行么? 我的思路是这样就是不知道该怎么写?
dsetcookie('tid', $_GET['tid']);
else 中这样写
else {
/* 根据URL中的参数,重新生成cookie,并重定向到ERP论坛 */
dsetcookie('erpvalidate', 'hide');
if( $_COOKIE["tGO_tid"] ){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}
}
这次走的是header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG'); 但是在地址栏中看到 tid是 无值的.
$ssourl = "$ssourl?tid=".$tid."&ssoauth=$ssoauth&time=" . time();
//第一次调用后进行第二次调用,那这里也要将tid的值传过去。不然第二次当然就没有值了。
define('DISCUZ_ROOT', './');
require_once './config.inc.php';
require_once './include/db_'.$database.'.class.php';
require_once './forumdata/cache/cache_settings.php';
header("Content-Type: text/html; charset=utf-8");
if ( !$ssoauth ) {
/* 若URL中没有SSO相关的参数,则尝试从HTTP请求中获取用户信息并进行SSO */ // 从请求中取sso信息,可自定义从url参数或者header中取
//$filterInfo = $employeeid; // from request
$headers = getallheaders();
//$filterInfo = $headers['iv-user'];
$filterInfo = $_GET['employeeid'];
$erp_username = $_GET['username_erp'];
$tid = $_GET['tid'];
//dsetcookie('tid', $_GET['tid']);
// 下述情况下,需要根据filter信息重新生成用户session
if ( $filterInfo ) {
/* 取uid、pwd、secques,可自定义SQL条件,但查询结果不能变 */
$db = new dbstuff;
$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
$query = $db->query("SELECT uid, password, secques FROM {$tablepre}members
WHERE uid=(SELECT uid FROM {$tablepre}memberfields WHERE employeeid='$filterInfo')");
$member = $db->fetch_array($query);
/* 若用户不存在,可自定义,如直接生成用户 */
if( !$member['uid'] ) {
// 直接插入用户,用户名为工号,密码为md5(123456), coped from admin/members.inc.php
$db->query("INSERT INTO {$tablepre}members (uid, password, groupid, username, timeoffset)
VALUES (NULL, 'e10adc3949ba59abbe56e057f20f883e', 10, '$filterInfo', '8');");
$uid = $db->insert_id();
$db->query("REPLACE INTO {$tablepre}memberfields (uid, employeeid) VALUES ('$uid','$filterInfo')");
//
$member['uid'] = $filterInfo;
$member['password'] = 'e10adc3949ba59abbe56e057f20f883e';
$member['secques'] = '';
}
$db->close(); /* 用户存在,则生成加密的cookie信息,并作为参数拼装到URL中重定向到论坛的实际地址 */
if( $member['uid'] ) {
$ssoauth = base64_encode(authcode($member['password']."\t".$member['secques']."\t".$member['uid'], 'ENCODE'));
$ssourl = $_DCACHE['settings']['siteurl'] . substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/"));
$ssourl = "$ssourl?tid=".$tid."&ssoauth=$ssoauth&time=" . time();
// 采用js来进行重定向,并将url拆分,以免被WebSEAL截获并修改
print ('<script>');
print ('location.replace("' . substr($ssourl,0,6) . '"+"' . substr($ssourl,6) . '")');
print ('</script>');
}
}
} else {
/* 根据URL中的参数,重新生成cookie,并重定向到ERP论坛 */
dsetcookie('sid', '');
dsetcookie('cookietime', 0);
dsetcookie('auth', base64_decode($ssoauth), 0);
dsetcookie('erpvalidate', 'hide');
if( $tid ){
header('Location: '.'http://10.222.1.104:8080/discuz/viewthread.php?tid='.$tid.'&extra=page%3D1&sid=ywqyMG');
}else{
header('Location: '.'http://10.222.1.104:8080/discuz/forumdisplay.php?fid=26');
}
}
else 中的 判断和 header 中的写法 合适么? 我没学过php 对语法什么的一窍不通,谢谢指教!