You last visited: Today at 14:09
Advertisement
Register script doesn't work
Discussion on Register script doesn't work within the Shaiya PServer Development forum part of the Shaiya Private Server category.
01/28/2018, 18:03
#1
elite*gold: 0
Join Date: Apr 2015
Posts: 70
Received Thanks: 47
Register script doesn't work
Hey Guys ! I spent almost many hours on this php script, I tried many things but nothing works. Could you help me ? I'm trying to make my register php script works, but It doesn't. I got no error in my php logs. And when I click to register, it redirect me to my home page but the account isn't created.
Here is the script:
PHP Code:
<h1><center>Registration</center></h1>
<center><img src="img/line.png" /></center>
<br/>
<?php
$error = 0 ;
if (isset( $_POST [ 'accountname' ]) && isset( $_POST [ 'shoutname' ]) && isset( $_POST [ 'password' ]) && isset( $_POST [ 'rePassword' ])){
echo '<span style="font-size:15px;font-weight:bold;">Failure to create your account. Please read the information below fields.</span>' ;
// enable cookies
// clear any previously defined IDs
if (isset( $_SESSION [ 'UserUID' ]))
unset( $_SESSION [ 'UserUID' ]);
// setup a query to get information on player account
$query = $conn -> prepare ( 'SELECT UserUID FROM PS_UserData.dbo.Users_Master WHERE UserID=?' );
if ( $query === false )
die( FormatErrors ( $query -> errorInfo ()));
// bind the parameter
$query -> bindParam ( 1 , $_POST [ 'accountname' ], PDO :: PARAM_STR );
// execute the query
if ( $query -> execute () === false )
die( FormatErrors ( $query -> errorInfo ()));
// get response (a single row is expected)
$row = $query -> fetch ( PDO :: FETCH_NUM );
if ( $row != null ){
// UserID was valid ...
$error = 1 ;
}
elseif( is_numeric ( $_POST [ 'accountname' ])){
//only numbers issue
$error = 44 ;
}
else {
echo( "poire" );
// verify password, depending on actual DB you may have to verify a hash
if ( $_POST [ 'password' ] != $_POST [ 'rePassword' ]){
// password was invalid
$error = 2 ;
} else {
$query2 = $conn -> prepare ( 'SELECT Email FROM PS_UserData.dbo.Users_Master WHERE Email= ?' );
$query2 -> bindParam ( 1 , $_POST [ 'emailAddress' ], PDO :: PARAM_STR );
$query2 -> execute ();
$row2 = $query2 -> fetch ( PDO :: FETCH_NUM );
$bday = "20/02/1990" ;
if(isset( $_POST [ "bday" ])){
if( $_POST [ "bday" ] != "" ){
$bday = $_POST [ "bday" ];
}
}
if ( $_POST [ 'emailAddress' ] != $row2 [ 0 ]){
$userip = $_SERVER [ 'REMOTE_ADDR' ];
$query = $conn -> prepare ( "INSERT INTO PS_UserData.dbo.Users_Master (UserID, Pw, JoinDate, Admin, AdminLevel, UseQueue, Status, Leave, LeaveDate, UserType, Point, EnPassword, UserIp, Birth, IsNew, Shoutbox, Email, Skype, MainCharID, Sign)VALUES (?,?,GETDATE(),0,0,'False',0,0,GETDATE(),'N',0,'',?,?,1,?,?,'','','')" );
$query -> bindParam ( 1 , $_POST [ 'accountname' ], PDO :: PARAM_STR );
$query -> bindParam ( 2 , $_POST [ 'password' ], PDO :: PARAM_STR );
$query -> bindParam ( 3 , $userip , PDO :: PARAM_STR );
$query -> bindParam ( 4 , $bday , PDO :: PARAM_STR );
$query -> bindParam ( 5 , $_POST [ 'shoutname' ], PDO :: PARAM_STR );
$query -> bindParam ( 6 , $_POST [ 'emailAddress' ], PDO :: PARAM_STR );
$query -> execute ();
$row = $query -> fetch ( PDO :: FETCH_NUM );
$query1 = $conn -> prepare ( 'SELECT UserUID FROM PS_UserData.dbo.Users_Master WHERE UserID= ?' );
$query1 -> bindParam ( 1 , $_POST [ 'accountname' ], PDO :: PARAM_STR );
$query1 -> execute ();
$row1 = $query1 -> fetch ( PDO :: FETCH_NUM );
$uid = $row1 [ 0 ];
$_SESSION [ 'UserUID' ] = $uid ;
$_SESSION [ 'Status' ] = 0 ;
if(( NEW_PLAYER_PM_TITLE != "" ) && ( NEW_PLAYER_PM_MESSAGE != "" )){
send_pm ( $row1 [ 0 ], NEW_PLAYER_PM_TITLE , NEW_PLAYER_PM_MESSAGE );
}
header ( "Location: /Home" );
// redirect to Char selection page
} else {
$error = 3 ;
}
}
}
// setup a query to get information on player account
$query4 = $conn -> prepare ( 'SELECT UserUID FROM PS_UserData.dbo.Users_Master WHERE Shoutbox=?' );
if ( $query4 === false )
die( FormatErrors ( $query4 -> errorInfo ()));
// bind the parameter
$query4 -> bindParam ( 1 , $_POST [ 'shoutname' ], PDO :: PARAM_STR );
// execute the query
if ( $query4 -> execute () === false )
die( FormatErrors ( $query4 -> errorInfo ()));
// get response (a single row is expected)
$row4 = $query4 -> fetch ( PDO :: FETCH_NUM );
if ( $row4 != null ){
// UserID was valid ...
$error = 4 ;
}
if( strlen ( $_POST [ 'password' ]) < 4 || strlen ( $_POST [ 'password' ]) > 12 ) {
$error = 5 ;
}
if( strlen ( $_POST [ 'accountname' ]) < 4 || strlen ( $_POST [ 'accountname' ]) > 12 ) {
$error = 6 ;
}
}
?>
<article>
<section class="body">
<form action="Register" class="page_form" method="post" accept-charset="utf-8">
<table style="width:80%">
<tr>
<td><label for="Username">Username</label></td>
<td>
<input type="text" name="accountname" id="accountname" placeholder="Must contain between 4 and 12 characters." value=""/>
<br>
<? if ( $error == 1 ){
echo '<span style="color:red; id="username_error">Username already in use. Find another one.</span>' ;
}
if ( $error == 6 ){
echo '<span style="color:red; id="username_error">Username must contain between 4 and 12 characters.</span>' ;
}
if( $error == 44 ){
echo '<span style="color:red; id="username_error">Username can not contain only numbers.</span>' ;
} ?>
</td>
</tr>
<tr>
<td><label for="ShoutName">ShoutName</label></td>
<td>
<input type="text" name="shoutname" id="shoutname" placeholder="This pseudo will be used for the ShoutBox." value=""/>
<br>
<? if ( $error == 4 ){
echo '<span style="color:red; id="username_error">ShoutName already in use. Find another one.</span>' ;
}
?>
</td>
</tr>
<tr>
<td><label for="Email">Email Adress</label></td>
<td>
<input type="email" name="emailAddress" id="emailAddress" placeholder="Email Adress" value=""/>
<br>
<? if ( $error == 3 ){
echo '<span style="color:red; id="email_error">E-mail already in use. Find another one.</span>' ;
} ?>
</td>
</tr>
<tr>
<td><label for="Password">Password</label></td>
<td>
<input type="password" name="password" id="password" placeholder="Must contain between 4 and 12 characters." value=""/>
<br>
<? if ( $error == 5 ){
echo '<span style="color:red; id="password_error">Your password must contain between 4 and 12 characters.</span>' ;
} ?>
</td>
</tr>
<tr>
<td><label for="Confirm Password">Confirm Password</label></td>
<td>
<input type="password" name="rePassword" id="rePassword" placeholder="Confirm Password" value="" />
<br>
<? if ( $error == 2 ){
echo '<span style="color:red; id="password_error">Passwords do not match. Try again.</span>' ;
} ?>
</td>
</tr>
<tr>
<td><label for="Birth">Birthday</label></td>
<td>
<input type="date" name="bday" placeoldaer="Birth"/>
</td>
</tr>
</table>
<center style="margin-bottom:10px;">
<input type="submit" name="login_submit" value="Register" />
</center>
</form>
</article>
<center> <img src="img/line.png" /></center>
01/28/2018, 18:29
#2
elite*gold: 0
Join Date: Mar 2013
Posts: 850
Received Thanks: 409
Hi,
where you have this registration from?
Regards
01/28/2018, 19:06
#3
elite*gold: 0
Join Date: Apr 2009
Posts: 232
Received Thanks: 216
include your database.php in your script
01/28/2018, 19:18
#4
elite*gold: 260
Join Date: Sep 2011
Posts: 487
Received Thanks: 360
Probably you have RowID in your users_master
01/28/2018, 19:25
#5
elite*gold: 0
Join Date: Mar 2013
Posts: 850
Received Thanks: 409
This is not the problem. The Problem is, that there is an problem in the html part of the php file. The php file dont execute the queries It just skip and go to main page.
01/28/2018, 19:31
#6
elite*gold: 0
Join Date: Apr 2015
Posts: 70
Received Thanks: 47
The html part is with the php part. Give a look under the php part that I posted.
01/28/2018, 20:01
#7
elite*gold: 0
Join Date: Mar 2013
Posts: 850
Received Thanks: 409
yes i know. I mean this part:
Quote:
<form action="Register" class="page_form" method="post" accept-charset="utf-8">
This needs to be linkes to your register.php or your name.php again.
Regards
01/29/2018, 08:47
#8
elite*gold: 0
Join Date: Apr 2015
Posts: 70
Received Thanks: 47
I moved the php part on another file and then I've changed this:
PHP Code:
< form action = "signup.php" class= "page_form" method = "post" accept - charset = "utf-8" >
But still doesn't work. I got this error:
Failure to create your account. Please read the information below fields.
I also tried to delete RowID but don't work
01/29/2018, 14:47
#9
elite*gold: 0
Join Date: Nov 2017
Posts: 137
Received Thanks: 148
Quote:
Originally Posted by
[ADM]_Dephisio
I moved the php part on another file and then I've changed this:
PHP Code:
< form action = "signup.php" class= "page_form" method = "post" accept - charset = "utf-8" >
But still doesn't work. I got this error:
Failure to create your account. Please read the information below fields.
I also tried to delete RowID but don't work
UserUID is auto-increment?
01/29/2018, 16:08
#10
elite*gold: 0
Join Date: Apr 2015
Posts: 70
Received Thanks: 47
I tried this:
PHP Code:
USE [ PS_UserData ] GO ALTER TABLE [ dbo ].[ Users_Master ] DROP CONSTRAINT [ DF_Users_Master_IsNew ] GO ALTER TABLE [ dbo ].[ Users_Master ] DROP CONSTRAINT [ DF_Users_Master_Point ] GO ALTER TABLE [ dbo ].[ Users_Master ] DROP CONSTRAINT [ DF_Users_Master_JoinDate ] GO /****** Object: Table [dbo].[Users_Master] Script Date: 1/29/2018 7:07:38 AM ******/ DROP TABLE [ dbo ].[ Users_Master ] GO /****** Object: Table [dbo].[Users_Master] Script Date: 1/29/2018 7:07:38 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [ dbo ].[ Users_Master ]( [ UserUID ] [ int ] IDENTITY ( 1 , 1 ) NOT NULL , [ UserID ] [ varchar ]( 18 ) NOT NULL , [ Pw ] [ varchar ]( 12 ) NOT NULL , [ JoinDate ] [ smalldatetime ] NOT NULL , [ Admin ] [ bit ] NOT NULL , [ AdminLevel ] [ tinyint ] NOT NULL , [ UseQueue ] [ bit ] NOT NULL , [ Status ] [ smallint ] NOT NULL , [ Leave ] [ tinyint ] NOT NULL , [ LeaveDate ] [ smalldatetime ] NULL , [ UserType ] [ char ]( 1 ) NOT NULL , [ UserIp ] [ varchar ]( 15 ) NULL , [ ModiIp ] [ varchar ]( 15 ) NULL , [ ModiDate ] [ datetime ] NULL , [ Point ] [ int ] NOT NULL , [ Enpassword ] [ char ]( 32 ) NULL , [ Birth ] [ varchar ]( 8 ) NULL , [ IsNew ] [ bit ] NULL , [ Shoutbox ] [ varchar ]( 18 ) NULL , [ Email ] [ varchar ]( max ) NULL , [ Skype ] [ varchar ]( max ) NULL , [ MainCharID ] [ int ] NULL , [ Sign ] [ varchar ]( max ) NULL , PRIMARY KEY CLUSTERED ( [ UserUID ] ASC ) WITH ( PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [ PRIMARY ] ) ON [ PRIMARY ] TEXTIMAGE_ON [ PRIMARY ] GO ALTER TABLE [ dbo ].[ Users_Master ] ADD CONSTRAINT [ DF_Users_Master_JoinDate ] DEFAULT ( getdate ()) FOR [ JoinDate ] GO ALTER TABLE [ dbo ].[ Users_Master ] ADD CONSTRAINT [ DF_Users_Master_Point ] DEFAULT (( 0 )) FOR [ Point ] GO ALTER TABLE [ dbo ].[ Users_Master ] ADD CONSTRAINT [ DF_Users_Master_IsNew ] DEFAULT (( 1 )) FOR [ IsNew ] GO
but still nothing
01/29/2018, 17:33
#11
elite*gold: 0
Join Date: Mar 2013
Posts: 850
Received Thanks: 409
Okay,
i found the problem. I edit your query and post it here
CREATE TABLE [dbo].[Users_Master](
[UserUID] [int] IDENTITY(1,1) NOT NULL,
[UserID] [varchar](18) NOT NULL,
[Pw] [varchar](12) NOT NULL,
[JoinDate] [smalldatetime] NOT NULL,
[Admin] [bit] NOT NULL,
[AdminLevel] [tinyint] NOT NULL,
[UseQueue] [bit] NOT NULL,
[Status] [smallint] NOT NULL,
[Leave] [tinyint] NOT NULL,
[LeaveDate] [smalldatetime] NULL,
[UserType] [char](1) NOT NULL,
[UserIp] [varchar](15) NULL,
[ModiIp] [varchar](15) NULL,
[ModiDate] [datetime] NULL,
[Point] [int] NOT NULL,
[Enpassword] [char](32) NULL,
[Birth] [smalldatetime] NULL,
[IsNew] [bit] NULL,
[Shoutbox] [varchar](18) NULL,
[Email] [varchar](max) NULL,
[Skype] [varchar](max) NULL,
[MainCharID] [varchar](18) NULL,
[Sign] [varchar](max) NULL)
This query should work now.
The query wasn´t able to put smalldatetime from Birth into a varchar(8) value.
Execute this query and It should work fine.
Regards
01/29/2018, 20:15
#12
elite*gold: 0
Join Date: Apr 2015
Posts: 70
Received Thanks: 47
****. Thank u so much haha u're nice
01/29/2018, 20:16
#13
elite*gold: 0
Join Date: Mar 2013
Posts: 850
Received Thanks: 409
No problem^^
Similar Threads
Register page: Field 'web_ip' doesn't have a default value?
05/28/2017 - Metin2 Private Server - 4 Replies
Hello,
Does anyone know, how to fix error: Field 'web_ip' doesn't have a default value?
Thank you!
[Tiny release] Secure and cute register/changepass script (Using abrasive work)
04/17/2016 - Shaiya PServer Guides & Releases - 4 Replies
Hello,
I have make some modification to abrasive script (http://www.elitepvpers.com/forum/shaiya-pserver-g uides-releases/1987977-release-secure-php-web-regi stration-script-mssql-odbc.html) to get email field and BodySalvage for design.
Sorry but i built it in french but you can easily translate it via google traduction
SS:
http://i.epvpimg.com/TXhif.jpg
pvp server register button no funciona help - register button does not work help
12/02/2014 - DarkOrbit - 1 Replies
He instalado el servidor
register button
no funciona
¡ayuda
**********************
I installed server
register button
does not work
help
**********************
how to make register.php work and client work at the same time
07/04/2014 - Dekaron Private Server - 11 Replies
Prior to my tut I am assuming you already checked this steps:
1. Followed Warmongers Ultimate Dekaron Server Setup
2. That you had succesfully downloaded and implement Silkbotters web registration php's and installed XAMPP server
3. That you already edited all the .ini in your htdocs folder with localhost IP 127.0.0.1, (yup, including Login server config.ini)
NOW this is what I learned:
1. When you setup your system DSN which you named "account" with log-in and password = account, at the...
All times are GMT +2. The time now is 14:10 .