njlocoy 发表于 2013-3-6 12:51:37

手动注册新用户时提示ID被占用

本帖最后由 njlocoy 于 2013-3-6 13:17 编辑

dz x2.0,用接口文件里的随机用户发布成功,但是用户都被提示已删除,手动注册新用户时提示ID被占用。请问如何让接口文件里用户被真实注册,且在后台里能查到这些用户,谢谢!<?php
header("Content-Type:text/html;   charset=utf-8");
require './config/config_global.php';

$fid = $_POST['fid'];
$typeid = $_POST['typeid'];
$subject = $_POST['subject'];
$message = $_POST['message'];

$views = rand(100,9999);

$postuser=array("xmxm76","纸水仙","suncool","忧郁者","96818","fswdnr","ssplyh","cmkzjw","jinquan26","fumingxia","sxyzy","bjghzly","sunren","yzwj2004","dew","cnq","qqwe","jdxyzlh","漂亮蓝影","angela","jason0401","FragranceM","雷锋","lchl0388","小乔","mqzlp","zxcvb12","...............
;

$author = $postuser;

$dbhost=$_config['db']['1']['dbhost'];
$dbuser=$_config['db']['1']['dbuser'];
$dbpw=$_config['db']['1']['dbpw'];
$dbname=$_config['db']['1']['dbname'];

$DB = new MySQLDB($dbhost,$dbuser,$dbpw,$dbname);

$result = $DB->query("SELECT uid FROM ".$DB->table('common_member')." WHERE username='$author'");
$row = mysql_fetch_array($result);
$authorid = $row['uid'];
$time = time();

if (empty($authorid))
{
$email=$author."@"."qi6".com;
$DB->query("INSERT INTO ".$DB->table('common_member')." (email, username, password, regdate, timeoffset)
                                              VALUES ('$email', '$author', '$time', '$time', 999)");
$authorid = $DB->insert_id();
}

$userip = "127.0.0.1";

//echo $authorid;

if( 'newthread' == $_REQUEST['action']) {
$DB->query("INSERT INTO ".$DB->table('forum_thread')." (fid, typeid, author, authorid, subject, dateline, lastpost, lastposter, views)
                                              VALUES ('$fid', '$typeid', '$author', '$authorid', '$subject', '$time', '$time', '$author', '$views')");
$tid = $DB->insert_id();
$DB->query("INSERT INTO ".$DB->table('forum_post')." (fid, tid, author, authorid, subject, dateline, message, useip)
                                           VALUES ('$fid', '$tid', '$author', '$authorid', '$subject', '$time', '$message', '$useip')");
                                          
$succ ="恭喜,成功发布一条主题";
echo $succ;
}

// 数据库操作类

Class MySQLDB
{
var $host;
var $user;
var $passwd;
var $database;
var $conn;
//利用构造函数实现变量初始化
//同时连接数据库操作
function MySQLDB($host,$user,$password,$database)
{
$this->host = $host;

$this->user = $user;

$this->passwd = $password;

$this->database = $database;

$this->conn=mysql_connect($this->host, $this->user,$this->passwd) or die('Connect   Error: '.mysql_error());

mysql_select_db($this->database,$this->conn) or die('Select   Error: '.mysql_error());

mysql_query("set names utf8");
}
//该函数用来关闭数据库连接
function Close()
{
MySQL_close($this->conn);
}
//获取数据库表
function table($n)
{
        return "any_".$n;
}
/*取得上一步 INSERT 操作产生的 ID*/   
function insert_id()
{
        return mysql_insert_id();
}
//该函数实现数据库查询操作

function Query($queryStr)

{
$res =Mysql_query($queryStr, $this->conn) or die('query: '.mysql_error());

return $res;
   }
}

?>

303718 发表于 2013-3-6 13:31:28

应该是发布接口有问题。你可以找别的接口试试。

懷念過去↑文 发表于 2013-3-6 13:32:33

要把用户注册进uc才可以

njlocoy 发表于 2013-3-6 13:58:11

懷念過去↑文 发表于 2013-3-6 13:32 static/image/common/back.gif
要把用户注册进uc才可以

能通过在此基础上修改一下实现吗?

wddldw 发表于 2013-3-6 19:54:21

懷念過去↑文 发表于 2013-3-6 13:32 static/image/common/back.gif
要把用户注册进uc才可以

你好 你的这个

Discuz! X2.5门户免登陆接口,支持随机用户 你发的这个怎么现在用不了啊 能不能检查下啊 是不是文件过期了 看有个文件都是现实日期是2007年的

懷念過去↑文 发表于 2013-3-6 21:04:13

wddldw 发表于 2013-3-6 19:54 static/image/common/back.gif
你好 你的这个

Discuz! X2.5门户免登陆接口,支持随机用户 你发的这个怎么现在用不了啊 能不能检查下啊 ...

错误提示?
页: [1]
查看完整版本: 手动注册新用户时提示ID被占用