Register page

06/04/2009 21:05 Dr. Phil#1
Anyone have a guide on how to set up the reg page? I have it where I can access the page. When I put in the info and everything, it is saying I have an ODBC error.

I have looked on here and google and haven't found anything, any help?
06/04/2009 21:30 naruto820#2
go to control panel-->administrative tools--->services--->ODBC manager--> system tab---->add new one and name it Account and choose account as default db, press ok and done.
06/04/2009 22:04 Dr. Phil#3
Thankyou, I will try that.

When it has the drop down for "Server", I click the drop down, and nothing is there. o_O
06/04/2009 22:13 naruto820#4
choose SQL server from teh drivers and click next then if your sql server doesnt show up on the list, go on service managger and copy the server name and paste it there.
06/04/2009 22:17 Dr. Phil#5
Okay, now it said that the tests completed successfully. Going to try and make an account now. If this works, Ill click "thanks" :)

I get this error still:

Warning: odbc_do() [function.odbc-do]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert explicit value for identity column in table 'Tbl_user' when IDENTITY_INSERT is set to OFF., SQL state 23000 in SQLExecDirect in C:\AppServ\www\register.php on line 82
06/04/2009 22:22 janvier123#6
did you run SN.txt ?
06/04/2009 22:26 Dr. Phil#7
Quote:
Originally Posted by janvier123 View Post
did you run SN.txt ?
Didn't know that was required because this server was once running, all I done was turn it off and done some edits and then decided to replace all server side files and restored my databases, I have to run it again?
06/04/2009 22:30 janvier123#8
yes try again
06/04/2009 22:31 Dr. Phil#9
I did it again and it said it done the command successful. But when I try to make an account, Here is what I get at the top of the page.


Warning: odbc_do() [function.odbc-do]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert explicit value for identity column in table 'USER_PROFILE' when IDENTITY_INSERT is set to OFF., SQL state 23000 in SQLExecDirect in C:\AppServ\www\register.php on line 81

Warning: odbc_do() [function.odbc-do]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert explicit value for identity column in table 'Tbl_user' when IDENTITY_INSERT is set to OFF., SQL state 23000 in SQLExecDirect in C:\AppServ\www\register.php on line 82
06/04/2009 22:36 naruto820#10
check line 81/82 of ur register.php, also what version of windows are u running x64 or 32?
06/04/2009 22:37 Dr. Phil#11
I have checked it more than once, and nothing appears to be wrong with it and I am running 32 bit windows and have ran a server before with no problems at all.
06/04/2009 22:44 naruto820#12
hmm then u havent added the odbc properly.
make sure once ur in the odbc manager screen, click on system tab, clicl on new, from drivers (a lot of them) chose the last one which should say SQL server, go next and choose ur sql server from dropdown list. If it isnt there copy it from service manager and paste it on the server name in odbc window. click next and choose Account database as your default database. then click on finish and ok.
06/04/2009 22:57 Dr. Phil#13
Thats what I have done already, I just done it again.

Microsoft SQL Server ODBC Driver Version 03.85.1132

Running connectivity tests...

Attempting connection
Connection established
Verifying option settings
Disconnecting from server

TESTS COMPLETED SUCCESSFULLY!

also, still getting same errors.
06/05/2009 02:04 janvier123#14
here is a version that does work, its only the register.php file
its the most important one

NOTE: read the BOLD parts

Quote:
<?php

require_once "config.inc.php";

if(isset($_SESSION[step2]) && isset($_POST[step2])) {
//提取的最后一步
$errorStr = formStep3();
if($errorStr!=null){
require_once('register.html');
}else{
require_once('success.html');
$suc=$success;
unset($_SESSION[step2], $_SESSION[step1]);
}}
else {
//Username
require_once('register.html');
$_SESSION[step2] = 1; }


//判断用户提交的表单的数据的 准确性 和 保存提交数据 的函数
function formStep3(){
$errors = array();
$errorStr = null;
//查询用户名是否存在
$strSql="select * from Tbl_user where user_id='$_POST[username]'";
if ($_POST[ZoneGroup]=="zone1") {
$account_odbc = odbc_connect('account','sa','admin');
} elseif ($_POST[ZoneGroup]=="zone2") {
$account_odbc = odbc_connect('account2','sa','admin');
} else {
die ("<p><b>分区选择错误!</b></p>");
}
$user_result=odbc_do($account_odbc,$strSql);
$result_query=odbc_fetch_row($user_result);
if (odbc_result($user_result,1)!= "") $errors[] = "This Accountname already exists, please choose another one.";
//验证用户名是否规范
if(!preg_match("/^[0-9a-zA-Z]{3,12}$/i", $_POST[username])) $errors[]="You are only alowed to use uppper and lower cases in English in your username.";
//验证用户名长度
if(strlen($_POST[username])<3) $errors[] = "The length of your username can't be less than 3 characters";
if(strlen($_POST[username])>12) $errors[]= "The length of your username can't be more than 12 characters";
//验证密码是否规范
if(!preg_match("/^[0-9a-zA-Z]{3,12}$/i", $_POST[password1])) $errors[]="You can only use English Characters of Upper case and lower case in your password. Try again";
if(preg_match("/^[0-9]{3,12}$/i",$_POST[password1])) $errors[]="You are not alowed just to input numbers as your password.";
//验证用户名和密码是否相同
if($_POST[username]==$_POST[password1]) $errors[]= "Accountname and password can't be the same!";
//验证密码长度
if(strlen($_POST[password1])<3) $errors[] = "The length of the password can't be less than 3 characters";
if(strlen($_POST[password1])>12) $errors[] = "The length of the password can't be more than 12 characters";
//验证密码一致性
if($_POST[password2]!=$_POST[password1]) $errors[] = "输入的密码不一致";
//验证找回密码问题答案长度
if(strlen($_POST[question])>20) $errors[] = "The length of the secret question can't be more than 20 characters";
if(strlen($_POST[question])<5) $errors[] = "The length of the secret question can't be less than 5 characters";
if(strlen($_POST[answer])>20) $errors[] = "The length of the secret answer can't be more than 20 characters";
if(strlen($_POST[answer])<5) $errors[] = "The length of the secret answer can't be less than 5 characters";
//验证用户email正确性
if(!preg_match("/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/i",$_POST[mail])) $errors[]="Your E-mail Adress is not valid. Please enter a valid one.";


//错误信息输出
if(sizeof($errors)>0){
$errorStr .= "<br><font>";
$errorStr .= "You have the following error(s):";
foreach($errors as $error)
$errorStr .= "<li>$error</li>";
$errorStr .= "</font><br><br>";
}else{

//加密密码
$passwd_user=md5($_POST[password1]);
//获取user_no
$dk_time=strftime("%y%m%d%H%M%S");
list($usec1, $sec1) = explode(" ",microtime());
$dk_user_no=$dk_time.substr($usec1,2,2);
//用户注册语句
$dk_account_query="insert into user_profile(user_no,user_id,user_pwd,resident_no, user_type,login_flag,login_tag,ipt_time,login_time ,logout_time,user_ip_addr,server_id) values('$dk_user_no','$_POST[username]','$passwd_user','801011000000','1','0','Y','01/01/2006 00:00:00',null,null,null,'000')";
//用户资料保存
$dk_account_query2="insert into Tbl_user(user_no,user_id,user_pwd,user_mail,user_a nswer,user_question) values('$dk_user_no','$_POST[username]','$_POST[password1]','$_POST[mail]','$_POST[answer]','$_POST[question]')";
//执行用户注册和资料保存语句
$dk_account_result1=odbc_do($account_odbc,$dk_acco unt_query);
$dk_account_result2=odbc_do($account_odbc,$dk_acco unt_query2);
odbc_close($account_odbc);



}
//返回错误消息到页面
return $errorStr;
}

?>
06/06/2009 12:59 janvier123#15
Good news,

yesterday, after we did a wipe on the DB i got the same error msg
i tryed also anything, it seems that i uploaded a version that has things missing in it

Dr. Phil
please delete all your DB's and install this one
[Only registered and activated users can see links. Click Here To Register...]
the error was gone and the page was fixed :)

good luck