...

View Full Version : Help!!!!! URGENT



Nurv
03-12-2007, 07:24 AM
okay, I tired, please one soul help me with this code: :confused:

ERROR: Parse error: syntax error, unexpected T_STRING in C:\Site\htdocs\Tibia\savenewchar.php on line 95


<?php
session_start();

$account = $_SESSION['account'];
$password = $_SESSION['password'];

if ((!isset($account) && isset($password) && $account != null && $account != "" && $password != null && $password != ""))
header("Location: acc_login.php");
else {
include ('config.php');

include ('top.inc.php');
connect_db();
ob_start();

$errors = 0;

$acc = "";
$pass = "";
$acc = $_SESSION['account'];
$pass = $_SESSION['password'];

if ($acc != "" && $acc != null && $pass != "" && $pass != null) {

$namein = "";
$vocin = "";
$sexin = "";

$namein = $_POST['name'];
$vocin = $_POST['voc'];
$sexin = $_POST['sex'];
$check = mysql_query("SELECT * FROM players WHERE name = '".addslashes($namein)."' LIMIT 1") or die(mysql_error());


if ($namein == "") {
echo "<h1>Error:</h1><p>Your player name can't be empty!</p>";
include ('footer.inc.php');
die;
}

if ($namein != "" && $sexin != "" && $vocin != "") {

$temp = strspn("$namein", "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM -");

if (!preg_match("/^[a-zA-Z][a-zA-Z ]*$/", $namein)) {
echo ('<h1>Error:</h1><p>Name contains illegal characters!<p>');
include ('footer.inc.php');
die;
}
if (preg_match("/^gm/i", $namein)) {
echo ('<h1>Error:</h1><p>Dont even try namefake a GM!<p>');
include ('footer.inc.php');
die;
}
if (preg_match("/^gamemaster/i", $namein)) {
echo ('<h1>Error:</h1><p>Dont even try namefake a GM!<p>');
include ('footer.inc.php');
die;
}
if (preg_match("/^god/i", $namein)) {
echo ("<h1>Error:</h1><p>Dont even try namefake a GOD!<p>");
include ('footer.inc.php');
die;
}


if ($temp != strlen($namein)) {
header("Location: create_character.php?result=char_failed&error=malformed_name");
$errors++;
}
elseif(mysql_num_rows($check) == 1) {
echo '<h1>Sorry!</h1><p>The character name is taken! Please go <a href="create_character.php">back</a>.</p>';
include ('footer.inc.php');
die;
}
elseif (strlen($namein) < 2 || strlen($namein) > 20) {
header("Location: create_character.php?result=char_failed&error=wrong_length");
$errors++;
}

}

if ($errors == 0) {




if($vocin == 0) { // No Vocation
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4') or die(mysql_error());

}


else if($vocin == 1) { // Sorcerer
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4')") or die(mysql_error());



}
else if($vocin == 2) {
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4')") or die(mysql_error());



}
else if($vocin == 3) {
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4')") or die(mysql_error());



}
else if($vocin == 4) { // Knight settings.
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4')") or die(mysql_error());



}
}

else {
$errors++;
}

}




if($errors == 0) {
echo "<h1>Congratulations!</h1><p>Successfully created character $namein.<br />Please click <a href=\"account_home.php\">here </a>to go back home!</p>";
}
}
include ('footer.inc.php');
?>

Ty.

Fou-Lu
03-12-2007, 07:37 AM
You need to wrap those in php tags so we can view them.
Anyway, check your queries:
values('NULL,'$namein'
unclosed quotation. Null is not a string value though btw.
As for the queries themselves, I'd change it so that it is dynamically built so you needn't worry about rewritting the query every time.
That may fix your problem, it may not. Wrap it in php tags with the formatting, and we can look at it again if it doesn't solve the problem.

Nurv
03-12-2007, 07:55 AM
You need to wrap those in php tags so we can view them.
Anyway, check your queries:
values('NULL,'$namein'
unclosed quotation. Null is not a string value though btw.
As for the queries themselves, I'd change it so that it is dynamically built so you needn't worry about rewritting the query every time.
That may fix your problem, it may not. Wrap it in php tags with the formatting, and we can look at it again if it doesn't solve the problem.

don't work! =(

Parse error: syntax error, unexpected T_STRING in C:\Site\htdocs\Tibia\savenewchar.php on line 95

_Aerospace_Eng_
03-12-2007, 08:00 AM
I don't think you listened to the part when Fou-Lu said to put your code in php tags. Read this
http://www.codingforums.com/misc.php?do=bbcode


put php code here

Check your quotes on line 90. Also you seem to have a lot of NULL values in there with spaces in them for example you have some that look like this NU LL or NUL L.

Nurv
03-12-2007, 08:18 AM
I don't think you listened to the part when Fou-Lu said to put your code in php tags. Read this
http://www.codingforums.com/misc.php?do=bbcode


put php code here

Check your quotes on line 90. Also you seem to have a lot of NULL values in there with spaces in them for example you have some that look like this NU LL or NUL L.

in the original archive it's correct! an error of posting.

Fou-Lu
03-12-2007, 08:59 AM
Yes, I didn't mention the null breaks cause I wasn't certain if line wrapping was the cause.
With this as well, my count may be off due to the lack of indentation *cough*, but it appears you have an extra closing brace at the bottom that doesn't have a corresponding opening brace.

rafiki
03-12-2007, 05:57 PM
your forgetting to add a lot of ""s in your script your opening them butnot closing them

_Aerospace_Eng_
03-12-2007, 06:00 PM
I told you what the problem was. You are missing a " on line 90. Notice in the php you posted. Look at the syntax highlighting. Any red text is a string. Blue text represents functions or variables. This is line 90

if($vocin == 0) { // No Vocation
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4') or die(mysql_error());

}
You are missing a " after the '4' in your mysql query.

if($vocin == 0) { // No Vocation
mysql_query("INSERT INTO players(id, name, account_id, group_id, sex, vocation, experience, level, maglevel, health, healthmax, mana, manamax, manaspent, soul, direction, lookbody, lookfeet, lookhead, looklegs, looktype, lookaddons, posx, posy, posz, cap, lastlogin, lastlogout, stamina, underwater, needtobeteleported, ispromoted, havepromotion, haveoutfit1, haveoutfit2, haveoutfit3, haveoutfit4, haveaddon1, haveaddon2, haveaddon3, haveaddon4, haveaddon5, haveaddon6, haveaddon7, haveaddon8, haveaddon9, haveaddon10, haveaddon11, haveaddon12, haveaddon13, haveaddon14, haveaddon15, tradeticks, blessings, bless1, bless2, bless3, bless4, bless5, lastip, save, conditions, redskulltime, redskull, guildnick, rank_id, town_id) values('NULL','$namein','$acc','0','$sexin','0','4200','8','0','185','185','35','35','NULL','NULL',' N ULL','136','10','10','10','128','703','600','7','400','NULL','NULL','NULL','NULL','NULL','NULL','NUL L','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL' ,'NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL','NULL',' NULL','NULL','NULL','NULL','NULL','4'") or die(mysql_error());

}

rafiki
03-12-2007, 06:09 PM
and in this line

echo "<h1>Congratulations!</h1><p>Successfully created character $namein.<br />Please click <a href="account_home.php\">here </a>to go back home!</p>";
//needs to escape the ""s in a href
echo "<h1>Congratulations!</h1><p>Successfully created character $namein.<br />Please click <a href=\"account_home.php\">here </a>to go back home!</p>";

Fou-Lu
03-13-2007, 01:41 AM
Good call on both mates!
The php colouring sure helps, but err... still missing the indentation :D

the-dream
03-13-2007, 02:09 AM
ha

i agree



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum