Php Register Script

05/19/2014 18:25 D4rkWorkx#1
Hello,

I got a little Problem.

If I run my register script than the USER_PROFILE table crashes with timeout:

[Only registered and activated users can see links. Click Here To Register...]

Here is my php code:

PHP Code:
$plist mssql_query("INSERT INTO USER_PROFILE  (user_id) VALUES ('".$data["Username"]."')"); 
$data is an array with alle POST Data from the register form

But if I print my query and use it at the server query console, it works.
Any idea?
05/19/2014 19:22 jaskile12#2
I think is your databases try use different ones
05/19/2014 19:26 D4rkWorkx#3
Why the databases? ^^ I think its a config problem..^^
05/19/2014 22:51 misterd#4
with one piece of php code we can't solve your issue. please put your whole code up.
05/19/2014 23:05 D4rkWorkx#5
What you wanne see? There's only the connection

PHP Code:
GLOBALS["DB"] = mssql_pconnect($Server$User$Pass); 
and the query:
PHP Code:
$msdb mssql_select_db("account"$GLOBALS["DB"]);
            
$plist mssql_query("INSERT INTO USER_PROFILE (user_id, user_pwd) VALUES ('".$data["Username"]."', '".md5($data["Passwort"])."');"); 
I have checked the data array with var_dump = all ok

Tried some different querys ..but no way :/

But localy, it works.
05/19/2014 23:14 jaskile12#6
Dark will give u my register.php it works 100% tested by me and its the register i use .
If this register no work try to do the next :
- Retry add Queryz the problem can be there too
- Go in Php folder > php.ini > enable mssql ( see on janvier123 video ) its only delete the ; before all frase of mssql
- Create new ODBC Connection but with this register no need

Download in spoiler
05/19/2014 23:21 D4rkWorkx#7
Quote:
Originally Posted by jaskile12 View Post
Dark will give u my register.php it works 100% tested by me and its the register i use .
If this register no work try to do the next :
- Retry add Queryz the problem can be there too
- Go in Php folder > php.ini > enable mssql ( see on janvier123 video ) its only delete the ; before all frase of mssql
- Create new ODBC Connection but with this register no need

Download in spoiler
same as before... I think the problem is the config...(sql server) but dont know where
05/20/2014 05:43 darkaxis05#8
Do you have a database named db? or see if the account from the ODBC see if its pass is correct
05/20/2014 06:47 D4rkWorkx#9
no database named db and connection is ok. I can do SELECT's but no INSERT <.<

But if I try with query analyzer:

[Only registered and activated users can see links. Click Here To Register...]
It works

But if use my php code like that:

PHP Code:
$plist mssql_query("INSERT INTO [USER_PROFILE] VALUES(1)"); 
it goes timeout:

[Only registered and activated users can see links. Click Here To Register...]
05/20/2014 07:52 janvier123#10
Clearly one of you dont understand how MSSQL tables work, some columns cannot be NULL

Quote:
Cannot insert the value NULL into column 'user_no', table 'account.dbo.USER_PROFILE'; column does not allow nulls. INSERT fails.
The statement has been terminated.
PHP Code:
$dk_time strftime("%y%m%d%H%M%S");
$regdate strftime("%y%m%d");
list(
$usec1$sec1) = explode(" ",microtime());
$dk_user_no $dk_time.substr($usec122);
                
$pass md5($_POST['account_password']);
                                
$query1 $db->SQLquery("INSERT INTO account.dbo.USER_PROFILE 
(user_no,user_id,user_pwd,resident_no,user_type,login_flag,login_tag,server_id) 
VALUES ('"
.$dk_user_no."','".$_POST['account_name']."','".$pass."','801011000000','1','0','Y','000')"); 
Fill in every single value!
05/20/2014 15:12 D4rkWorkx#11
@janvier123
PHP Code:
Warningmssql_query(): messageCannot insert explicit value for identity column in table 'USER_PROFILE' when IDENTITY_INSERT is set to OFF. (severity 16in /var/www/XXXX/Application/Classes/Model/Account/Account.php on line 323

Warning
mssql_query(): General SQL Server errorCheck messages from the SQL Server (severity 16in /var/www/XXXXX/Application/Classes/Model/Account/Account.php on line 323

Warning
mssql_query(): Query failed in /var/www/XXXXXX/Application/Classes/Model/Account/Account.php on line 323 
05/20/2014 19:36 janvier123#12
[Only registered and activated users can see links. Click Here To Register...]
05/21/2014 07:33 D4rkWorkx#13
same as before...can I use an other function to connect ?
05/21/2014 09:53 janvier123#14
iam not going to spoon feed you everytime!


PHP Code:

CREATE TABLE dbo
.USER_PROFILE (
  
user_no       varchar(14),
  
user_id       varchar(20NOT NULL,
  
user_pwd      varchar(32),
  
resident_no   varchar(13),
  
user_type     varchar(3CONSTRAINT DF__user_prof__user___267ABA7A DEFAULT '1',
  
login_flag    int CONSTRAINT DF__user_prof__statu__276EDEB3 DEFAULT 0,
  
login_tag     char CONSTRAINT DF_user_profile_login_tag DEFAULT 'Y',
  
ipt_time      datetime,
  
login_time    datetime,
  
logout_time   datetime,
  
user_ip_addr  varbinary(4),
  
server_id     varchar(3CONSTRAINT DF__user_prof__serve__0D7A0286 DEFAULT '000',
  
user_mail     varchar(50NOT NULL DEFAULT 0,
  
/* Keys */
  
CONSTRAINT PK_USER_PROFILE PRIMARY KEY (user_noWITH
  FILLFACTOR 
90
ON FG_MST0
GO

CREATE UNIQUE INDEX IDX_USER_ID
  ON dbo
.USER_PROFILE
  
(user_id)
  
WITH
    FILLFACTOR 
85
GO 
05/21/2014 10:14 D4rkWorkx#15
Quote:
Originally Posted by janvier123 View Post
iam not going to spoon feed you everytime!


PHP Code:

CREATE TABLE dbo
.USER_PROFILE (
  
user_no       varchar(14),
  
user_id       varchar(20NOT NULL,
  
user_pwd      varchar(32),
  
resident_no   varchar(13),
  
user_type     varchar(3CONSTRAINT DF__user_prof__user___267ABA7A DEFAULT '1',
  
login_flag    int CONSTRAINT DF__user_prof__statu__276EDEB3 DEFAULT 0,
  
login_tag     char CONSTRAINT DF_user_profile_login_tag DEFAULT 'Y',
  
ipt_time      datetime,
  
login_time    datetime,
  
logout_time   datetime,
  
user_ip_addr  varbinary(4),
  
server_id     varchar(3CONSTRAINT DF__user_prof__serve__0D7A0286 DEFAULT '000',
  
user_mail     varchar(50NOT NULL DEFAULT 0,
  
/* Keys */
  
CONSTRAINT PK_USER_PROFILE PRIMARY KEY (user_noWITH
  FILLFACTOR 
90
ON FG_MST0
GO

CREATE UNIQUE INDEX IDX_USER_ID
  ON dbo
.USER_PROFILE
  
(user_id)
  
WITH
    FILLFACTOR 
85
GO 
same ...
and yea I changed to pdo, got no erros in the frontend...but no changes in table. This is so fucked up<.<

edit: I found a little crazy thing.
If I insert something with pdo and do a select on that table right after that...I get alle entrys with the new one. But the server dont save's it oO wth