Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help!!!!! URGENT

    okay, I tired, please one soul help me with this code:

    ERROR: Parse error: syntax error, unexpected T_STRING in C:\Site\htdocs\Tibia\savenewchar.php on line 95
    PHP Code:
    <?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) < || 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(idnameaccount_idgroup_idsexvocationexperiencelevelmaglevelhealthhealthmaxmanamanamaxmanaspentsouldirectionlookbodylookfeetlookheadlooklegslooktypelookaddonsposxposyposzcaplastloginlastlogoutstaminaunderwaterneedtobeteleportedispromotedhavepromotionhaveoutfit1haveoutfit2haveoutfit3haveoutfit4haveaddon1haveaddon2haveaddon3haveaddon4haveaddon5haveaddon6haveaddon7haveaddon8haveaddon9haveaddon10haveaddon11haveaddon12haveaddon13haveaddon14haveaddon15tradeticksblessingsbless1bless2bless3bless4bless5lastipsaveconditionsredskulltimeredskullguildnickrank_idtown_idvalues('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(idnameaccount_idgroup_idsexvocationexperiencelevelmaglevelhealthhealthmaxmanamanamaxmanaspentsouldirectionlookbodylookfeetlookheadlooklegslooktypelookaddonsposxposyposzcaplastloginlastlogoutstaminaunderwaterneedtobeteleportedispromotedhavepromotionhaveoutfit1haveoutfit2haveoutfit3haveoutfit4haveaddon1haveaddon2haveaddon3haveaddon4haveaddon5haveaddon6haveaddon7haveaddon8haveaddon9haveaddon10haveaddon11haveaddon12haveaddon13haveaddon14haveaddon15tradeticksblessingsbless1bless2bless3bless4bless5lastipsaveconditionsredskulltimeredskullguildnickrank_idtown_idvalues('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(idnameaccount_idgroup_idsexvocationexperiencelevelmaglevelhealthhealthmaxmanamanamaxmanaspentsouldirectionlookbodylookfeetlookheadlooklegslooktypelookaddonsposxposyposzcaplastloginlastlogoutstaminaunderwaterneedtobeteleportedispromotedhavepromotionhaveoutfit1haveoutfit2haveoutfit3haveoutfit4haveaddon1haveaddon2haveaddon3haveaddon4haveaddon5haveaddon6haveaddon7haveaddon8haveaddon9haveaddon10haveaddon11haveaddon12haveaddon13haveaddon14haveaddon15tradeticksblessingsbless1bless2bless3bless4bless5lastipsaveconditionsredskulltimeredskullguildnickrank_idtown_idvalues('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(idnameaccount_idgroup_idsexvocationexperiencelevelmaglevelhealthhealthmaxmanamanamaxmanaspentsouldirectionlookbodylookfeetlookheadlooklegslooktypelookaddonsposxposyposzcaplastloginlastlogoutstaminaunderwaterneedtobeteleportedispromotedhavepromotionhaveoutfit1haveoutfit2haveoutfit3haveoutfit4haveaddon1haveaddon2haveaddon3haveaddon4haveaddon5haveaddon6haveaddon7haveaddon8haveaddon9haveaddon10haveaddon11haveaddon12haveaddon13haveaddon14haveaddon15tradeticksblessingsbless1bless2bless3bless4bless5lastipsaveconditionsredskulltimeredskullguildnickrank_idtown_idvalues('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.
    Last edited by firepages; 03-12-2007 at 10:14 AM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fou-Lu View Post
    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

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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

    [php]put php code here[/php]

    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.
    Last edited by _Aerospace_Eng_; 03-12-2007 at 07:07 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    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

    [php]put php code here[/php]

    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.
    Last edited by Nurv; 03-12-2007 at 07:24 AM.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    your forgetting to add a lot of ""s in your script your opening them butnot closing them

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    PHP Code:
    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.
    PHP Code:
    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());


    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,046
    Thanks
    19
    Thanked 42 Times in 42 Posts
    and in this line
    PHP Code:
    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>"

  • #10
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Good call on both mates!
    The php colouring sure helps, but err... still missing the indentation
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #11
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    ha

    i agree


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •