Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 03:21

  • Please register to post and access all features, it's quick, easy and FREE!

 

Little Php Problem

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2012
Posts: 24
Received Thanks: 2
Little Php Problem


Hey was working on a register page for rappelz and got a little stuck. I believe the problem lies obviously in the php script but Idk what. I was reading the w3schools site to see if i can fix it but nothing . I tested the insert statement in my sql database just to make sure it was working and well yes it is. The problem is that when i click create account nothing happens. Any help will be greatly appreciated.



ShaolinSHowdown is offline  
Old   #2
 
elite*gold: 0
Join Date: Mar 2011
Posts: 92
Received Thanks: 50
Exampel php 5.4
Code:
<?php
session_start();
header("Content-type: text/plain; charset=windows-1251");
include_once("config/db.php");
include_once("query/accounts_character.php");
include("_lang/Russian/global.php");
$errors = array();
if($_POST['fromAjax'])
{
//Длинна логина
if((!$_POST["name"]) || strlen($_POST["name"])<3 || strlen($_POST["name"])>20)
{
$errors['name']= $lang_registration_error['Login_Name_101'];
}
//символы логина
else if(preg_match("/[^0-9a-zA-Z]/i", $_POST["name"]))
{
$errors['name']= $lang_registration_error['Login_Name_102'];
}
//Валидность емаила
else if(!$_POST['email'] || !preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $_POST['email']))
{
	$errors['email']= $lang_registration_error['Login_Email_101'];
}
//Длинна пароля
else if(!$_POST['pass'] || strlen($_POST['pass'])<5)
{
	$errors['pass']= $lang_registration_error['Login_Pw_101'];
}
//Символы пароля
else if(preg_match("/[^0-9a-zA-Z]/i", $_POST['pass']))
{
	$errors['pass']= $lang_registration_error['Login_Pw_102'];
}

//Длинна повтора пароля
else if(!$_POST['pass2'] || strlen($_POST['pass2'])<5)
{
	$errors['pass2']= $lang_registration_error['Login_Pw_103'];
}
//Символы повтора пароля
else if(preg_match("/[^0-9a-zA-Z]/i", $_POST['pass2']))
{
	$errors['pass2']= $lang_registration_error['Login_Pw_102'];
}
//Сравнение паролей
else if($_POST['pass']!=$_POST['pass2'])
{
	$errors['pass']= $lang_registration_error['Login_Pw_104'];
	$errors['pass2']= $lang_registration_error['Login_Pw_104'];
}
//Символы капатчи

else if(preg_match("/[^0-9a-zA-Z]/i", $_POST['code']))
{
	$errors['captcha']= $lang_registration_error['Login_Captcha_102'];
}
else if ($_SESSION["captcha"] != strtolower($_POST['code']))
			{
			$errors['captcha'] = $lang_registration_error['Login_Captcha_103'];
			}		
//Сравнение капатчи
else if(!$_POST['code'] || strlen($_POST['code'])<>5)
{
	$errors['captcha']= $lang_registration_error['Login_Captcha_101'];
}

else{
$password = $_POST['pass'];
$password = MyMd5($MdKey,$password);
$stmt = $connect->prepare("SELECT $col_login FROM  $db_Auth.dbo.$tb_accounts where $col_login = ?");
$stmt->execute(array($_POST['name']));
$row = $stmt->fetch();
$login_name_count = count($row[0]);
if(!$stmt)
{
$errors['name'] = $lang_registration_error['Login_error_base'];
}
else if ($login_name_count != 0)
{
$errors['name'] = $lang_registration_error['Login_Name_103'];
}

$stmt = $connect->prepare("SELECT $col_email FROM  $db_Auth.dbo.$tb_accounts where $col_email = ?");
$stmt->execute(array($_POST['email']));
$row = $stmt->fetch();
$login_email_count = count($row[0]);
if(!$stmt)
{
$errors['email']= $lang_registration_error['Login_error_base'];
}
else if ($login_email_count != 0)
{
$errors['email'] = $lang_registration_error['Login_Email_103'];
}	
}
// Checking whether the request was sent via AJAX
// (we manually send the fromAjax var with the AJAX request):

	if(count($errors))
	{
		$errString = array();
		foreach($errors as $k=>$v)
		{
			// The login_name of the field that caused the error, and the
			// error text are grouped as key/value pair for the JSON response:
			$errString[]='"'.$k.'":"'.$v.'"';
			
		}
		
		// JSON error response:
		die	('{"status":0,'.join(',',$errString).'}');
	}
	else{

	// JSON success response. Returns the redirect URL:
	$stmt = $connect->query("USE $db_Auth");
	$stmt = $connect->prepare("exec insert_account ?,?,?");
	$stmt->execute(array($_POST['name'],$password,$_POST['email']));	
	echo '{"status":1,"MSG":"'.$lang_registration['Text_regestration_final'].'"}';
	$connect = NULL;
	exit;
	}
}

// If the request was not sent via AJAX (probably JavaScript
// has been disabled in the visitors' browser):

if(count($errors))
{
	echo '<h2>'.join('<br /><br />',$errors).'</h2>';
	exit;
}

// Directly redirecting the visitor:

//header("Location: ".$redirectURL);
?>


rastamannns is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
[Problem]Habe ein Problem und zwar spinnt mein VPC etwas(ohne Grund)?!
Also wie schon gesagt meins Server spinnt wodurch kiks usw. kommen :( ich lade euch die Screens in den Anhang, mit der Hoffnung, dass ihr mir helfen...
10 Replies - Metin2 PServer - Discussions / Questions



All times are GMT +2. The time now is 03:21.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.