Alright. Right now, I'm working on a Register script. The POST data, and stuff like that works fine, it's only the Stored Procedure that's bothering me. Everytime I "attempt to register", it comes up with the error:
Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in /usr/local/lsws/DEFAULT/html/configs/class.php on line 1038
We're running on:
PHP Version 5.3.6
Linux 2.6.18-238.9.1.el5.pony5-1 #3 SMP Fri Jun 3 16:37:31 PDT 2011 i686
LiteSpeed V5.5
With MySQLi, MySQL, And MsSQL(Plugins).
Here's the stored procedure:
USE [ACCOUNT_DBF]
GO
/****** Object: StoredProcedure [dbo].[createaccount] Script Date: 08/03/2011 23:42:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[createaccount]
@account VARCHAR(15),
@password VARCHAR(32),
@email VARCHAR(max),
@ques int,
@answer VARCHAR(max),
@date VARCHAR(50),
@time VARCHAR(50),
@ip VARCHAR(MAX),
@string VARCHAR(MAX)
AS
SET NOCOUNT ON
DECLARE @DateActivated AS CHAR(8)
IF NOT EXISTS (SELECT account FROM ACCOUNT_TBL WHERE account = @account) BEGIN
INSERT INTO ACCOUNT_TBL (account, [password], id_no2, isuse, member, realname, support_key)
VALUES (@account, @password, @password, 'T', 'A', 'F', @string)
SET @DateActivated = CONVERT(CHAR(8), GETDATE()-1, 112 ) --Is the date today - 1
--UPDATE ACCOUNT_TBL_DETAIL SET BlockTime = @DateYesterday WHERE account = @userid
--INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse)
-- VALUES (@account, 'A000', '2', 'F', GETDATE(), '20990101', '20990101', '20050101', 'O')
INSERT INTO ACCOUNT_TBL_DETAIL (account, gamecode, tester, m_chLoginAuthority, regdate, BlockTime, EndTime, WebTime, isuse, email, security_question, security_answer, ip, [date], [time])
VALUES (@account, 'A000', '2', 'F', GETDATE(), @DateActivated, '20990101', '20050101', 'O', @email, @ques, @answer, @ip, @date, @time)
END
Here's the PHP calling the Procedure:
public function createAccount($username, $password, $email, $security_question, $security_answer, $ip, $date, $time, $key)
{
$string = md5("1n5t1nctk4y5f0rth3w1n".$key);
$stmt = mssql_init('ACCOUNT_DBF.dbo.createaccount');
mssql_bind($stmt, '@account', $username, SQLVARCHAR, false, false, 15);
mssql_bind($stmt, '@password', $password, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@email', $email, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@ques', $security_question, SQLINT1, false, false, 36);
mssql_bind($stmt, '@answer', $security_answer, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@date', $date, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@time', $time, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@ip', $ip, SQLVARCHAR, false, false, 36);
mssql_bind($stmt, '@string', $string, SQLVARCHAR, false, false, 36);
mssql_execute($stmt) or die ("[Function Error]: Cannot Register account.<BR>".mssql_get_last_message()."");
mssql_free_statement($stmt) or die(mssql_get_last_message());
/*$this->mailUser($username, $pass, $email, $date, $time, $key);*/
echo "<script language='Javascript'>alert('[Success]: Your account has been created successfully!');</script>";
}
Any suggestions?