5
« Įrašytas: 2011-03-23 16:11:04 pm »
Nelabai aš moku ir domėjausi šitais doctype.
Įsirašiau eilutę taip:
<?php
include('Config/Config.php');
require_once('reCaptcha/recaptchalib.php');
$username = $_POST["username"];
$password = $_POST["pass1"];
$password2 = $_POST["pass2"];
$captcha = $_GET["recaptcha_response_field"];
$accountpath = $accountfolderpath;
$path = $accountpath . $username . '.ini';
if (file_exists($path)) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Username</b> you have requested already exists, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if(strlen($_POST['username']) < 6) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Username</b> can only contain latin letters and numbers with a <b>minimum of 6 characters - Non capitalised</b>, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if(preg_match('/[^0-9A-Za-z]/',$password)) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Password</b> can only contain latin letters and numbers, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if(preg_match('/[^0-9A-Za-z]/',$username)) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Username</b> can only contain latin letters and numbers, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if ($password != $password2) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Passwords</b> you have entered doesnt match, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if ($password == $username) {
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Sorry, the <b>Password and Username</b> cannot match, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else if ($password == '' || $password2 == '' || $username == '' ) {
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>". $errorpagetitle ."</title>
</head>
<div id="headerimg"></div>
<div class="formWrapper">
<form>
<div class="fieldWrapper">
Sorry, the <b>Password </b>or <b>Username</b> field cannot be left blank, <a href="index.php">Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id="bottomimg"></div>
</html>
';
}
else if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
$myFile = $path;
$fh = fopen($myFile, 'w') or die("can't find Directory");
$stringData = "[account]\n";
fwrite($fh, $stringData);
$stringData = "password=".$password;
fwrite($fh, $stringData);
fclose($fh);
echo "
<html>
<head>
<title>LTSRO.EU Account - Succesfully Registered!</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Account succesfully Registered <a href='http://ltsro.eu/'>Click here</a> to return to main page!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
else {
$error = $resp->error;
echo "
<html>
<head>
<title>". $errorpagetitle ."</title>
<link rel='stylesheet' type='text/css' href='css/style.css' />
</head>
<div id='headerimg'></div>
<div class='formWrapper'>
<form>
<div class='fieldWrapper'>
Invalid <b>reCaptcha</b> Code entered, <a href='index.php'>Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id='bottomimg'></div>
</html>
";
}
}
?>
>
JAI KONKREČIAI TAI DADĖJAU TAIP:
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>". $errorpagetitle ."</title>
</head>
<div id="headerimg"></div>
<div class="formWrapper">
<form>
<div class="fieldWrapper">
Sorry, the <b>Password </b>or <b>Username</b> field cannot be left blank, <a href="index.php">Click here</a> to return to previous page and try again!
</div>
</form>
</div>
<div id="bottomimg"></div>
</html>
';
}
else if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
$myFile = $path;
$fh = fopen($myFile, 'w') or die("can't find Directory");
$stringData = "[account]\n";
fwrite($fh, $stringData);
$stringData = "password=".$password;
fwrite($fh, $stringData);
fclose($fh);
Bet tas pats š. Gal galite įdėti ją ten kur turi būti ir paaiškinti kodėl taip turi būti?