Results 1 to 3 of 3

Thread: unexpected T_LNUMBER?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    1

    Unhappy unexpected T_LNUMBER?

    I can't figure this out, I keep getting this error:

    Parse error: syntax error, unexpected T_LNUMBER in /home/.zebediah/username/mysite.com/myDIR/install_db.php on line 58

    Here's the php file(toned down)... Any ideas on what's wrong?(I got this php file with alot of errors, and I've been debugging it for while now, but I can't figure this one out)

    I also highlighted line 58(it's not line 58 in this pasted version)

    <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
    <!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>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>

    <body>
    <form name="form1" id="form1" method="post" action="">
    <p align="center">
    <label>Install Password
    <input type="password" name="textfield" />
    </label>
    </p>
    <p align="center">
    <label>
    <input name="submit" type="submit" id=" submit" value="install" />
    </label>
    </p>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>

    <?php
    include('const.php') or die('damn const.php file is missing, kicking you out of the install process;');

    $link = @mysql_connect($dbhost, $dbuser, $dbpass) or die('cannot find the database, captain');
    mysql_select_db($dbname) or die('cannot select the database');

    //check the password

    if ($installpwd == $textfield)
    {

    mysql_query('CREATE TABLE '.$clanForumdb.' (
    num int(11) NOT NULL default '0',
    name text NOT NULL,
    PRIMARY KEY (num)
    )') or die('can forum db error, install aborted');

    All of the vars are set in that other php file... Does anyone know what's wrong?

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: unexpected T_LNUMBER?

    You need to escape the quotes in your string. There are however more important things you should be worrying about as your script has several security issues. I would strongly advise you do not publish it on the Internet until you have resolved these:
    1. You are using register_globals (it makes variables from forms, the url and cookies global variables). First, do not use it as it is deprecated, second it is very easy to fall into the trap of writing code which can be exploited when it is on. Go to your php.ini and change the line register_globals=on to off.

      An attacker to use this to poison the data in your script if you leave it on.
    2. Second you are not escaping variables which are to go into SQL queries. If you do not do this an attacker could inject SQL into those variables and reveal data from other tables or execute code on the server. Have a look at the mysql_escape_string function and ensure that any data from an external source passes through this function before it goes into an SQL query.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: unexpected T_LNUMBER?

    Also, look at using PDO (PHP 5) or MDB2 (PHP 4) or at the very least mysqli, all of which provide support for parameterised commands, which are vastly superior to escaping data.

Posting Permissions

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



Click Here to Expand Forum to Full Width