Jump to content

unexpected "=" on page...


mizukun

Recommended Posts

here's my page

 

<?php
// process the script only if the form has been submitted
if (array_key_exists('reset', $_POST)) {
  // start the session
  include('config2.php'); // Change config2.php to the name of your config.php if u want
  $username = trim($_POST['username']);
  $password = trim($_POST['password']);
  $username = mysql_real_escape_string($username);
  $char = trim($_POST['char']);
  $mesocheck = mysql_query('SELECT * FROM meso FROM characters');
  $result = mysql_query("SELECT meso, accountid FROM characters WHERE name = '$char' LIMIT 1");
  list($meso, $accountid) = mysql_fetch_row($result);

  $result = mysql_query("SELECT id, password, salt FROM accounts WHERE name = '$username' LIMIT 1");
  list($id, $realpass, $salt) = mysql_fetch_row($result);

  $sql = "SELECT * FROM accounts WHERE name = '$username'";
  $result = mysql_query($sql);
  $row = mysql_fetch_assoc($result);
    
if($realpass == hash('sha512',$password.$salt) && $accountid == $id && $meso > 50000000 && loggedin = 0) {
     mysql_query("UPDATE accounts SET nxcash = nxcash + 25000 WHERE name = '$username' LIMIT 1");
     mysql_query("UPDATE characters SET meso = meso - 5000000 WHERE name = '$char' LIMIT 1");
     echo "You have payed 50 mil from $char to get 25k NX for $username !";
} else
     echo "There was an error getting you NX. Either 1. You do not have enough money.  2. You do not have the char you listed on that account. 3.  You are logged in.";    }
  // if no match, destroy the session and prepare error message
  else {
    $message[] = 'Please Type Your Info Correctly..';
    }
?>
<!-- start content -->
       <div align="center"> <div class='welcome'><br>Welcome to the NX Cash shop!</br>
<br>50,000,000 mesos for 25,000 NX!</br> 
<br>Make sure you are logged off during this process!</br> 
<br>No refunds for your silly mistakes!</br></div> </div>
          <div align="center">
          <div class="display">
<?php
if (isset($message)) {
  echo '<ul>';
  foreach ($message as $item) {
    echo "<li>$item</li>";
    }
  echo '</ul>';
  }
?>
           </div>
              <form id="form1" name="form1" method="post" action="">
                    <table cellspacing="0" cellpadding="5" width="100%">
                  <tr>
                            <td width="50%" align="right" class="list">Username :</td>
                          <td class="list"><input id="username" type="text" name="username" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td width="50%" align="right" class="list">Password :</td>
                          <td class="list"><input id="password" type="password" name="password" maxlength="20" /></td>
                        </tr>
                        <tr>
                            <td width="50%" align="right" class="list">Character paying 100 mil :</td>
                          <td class="list"><input id="char" type="text" name="char" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td align="right" colspan="2"><input id="reset" name="reset" type="submit" value="Buy 25k NX!" /></td>
                        </tr>
                    </table>
            </form>
            </div>
<!-- end content -->
</div>

 

when ever i click on that page i get

Parse error: syntax error, unexpected '=' in C:\wamp\www\nx.php on line 2

 

i even tried to run it by it self. but it still happens.

 

Link to comment
https://forums.phpfreaks.com/topic/111005-unexpected-on-page/
Share on other sites

Please put your code in code tags, not quote tags.

<?php
// process the script only if the form has been submitted
if (array_key_exists('reset', $_POST)) {
  // start the session
  include('config2.php'); // Change config2.php to the name of your config.php if u want
  $username = trim($_POST['username']);
  $password = trim($_POST['password']);
  $username = mysql_real_escape_string($username);
  $char = trim($_POST['char']);
  $mesocheck = mysql_query('SELECT * FROM meso FROM characters');
  $result = mysql_query("SELECT meso, accountid FROM characters WHERE name = '$char' LIMIT 1");
  list($meso, $accountid) = mysql_fetch_row($result);

  $result = mysql_query("SELECT id, password, salt FROM accounts WHERE name = '$username' LIMIT 1");
  list($id, $realpass, $salt) = mysql_fetch_row($result);

  $sql = "SELECT * FROM accounts WHERE name = '$username'";
  $result = mysql_query($sql);
  $row = mysql_fetch_assoc($result);
   
if($realpass == hash('sha512',$password.$salt) && $accountid == $id && $meso > 50000000 && loggedin = 0) {
     mysql_query("UPDATE accounts SET nxcash = nxcash + 25000 WHERE name = '$username' LIMIT 1");
     mysql_query("UPDATE characters SET meso = meso - 5000000 WHERE name = '$char' LIMIT 1");
     echo "You have payed 50 mil from $char to get 25k NX for $username !";
} else
     echo "There was an error getting you NX. Either 1. You do not have enough money.  2. You do not have the char you listed on that account. 3.  You are logged in.";    }
  // if no match, destroy the session and prepare error message
  else {
    $message[] = 'Please Type Your Info Correctly..';
    }
?>
<!-- start content -->
       <div align="center"> <div class='welcome'>
Welcome to the NX Cash shop!</br>

50,000,000 mesos for 25,000 NX!</br>

Make sure you are logged off during this process!</br>

No refunds for your silly mistakes!</br></div> </div>
          <div align="center">
          <div class="display">
<?php
if (isset($message)) {
  echo '<ul>';
  foreach ($message as $item) {
    echo "<li>$item</li>";
    }
  echo '</ul>';
  }
?>
           </div>
              <form id="form1" name="form1" method="post" action="">
                    <table cellspacing="0" cellpadding="5" width="100%">
                  <tr>
                            <td width="50%" align="right" class="list">Username :</td>
                          <td class="list"><input id="username" type="text" name="username" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td width="50%" align="right" class="list">Password :</td>
                          <td class="list"><input id="password" type="password" name="password" maxlength="20" /></td>
                        </tr>
                        <tr>
                            <td width="50%" align="right" class="list">Character paying 100 mil :</td>
                          <td class="list"><input id="char" type="text" name="char" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td align="right" colspan="2"><input id="reset" name="reset" type="submit" value="Buy 25k NX!" /></td>
                        </tr>
                    </table>
            </form>
            </div>
<!-- end content -->
</div>

 

Now I'll be able to look at it, lol. 

 

P.S: Pfft, Maplestory private servers?  =/  My brother plays that game.

Link to comment
https://forums.phpfreaks.com/topic/111005-unexpected-on-page/#findComment-569586
Share on other sites

DarkWater, stop acting silly and be nice. :P

 

I fixed it for you

<?php
// process the script only if the form has been submitted
if (array_key_exists('reset', $_POST)) {
  // start the session
  include('config2.php'); // Change config2.php to the name of your config.php if u want
  $username = trim($_POST['username']);
  $password = trim($_POST['password']);
  $username = mysql_real_escape_string($username);
  $char = trim($_POST['char']);
  $mesocheck = mysql_query('SELECT * FROM meso FROM characters');
  $result = mysql_query("SELECT meso, accountid FROM characters WHERE name = '$char' LIMIT 1");
  list($meso, $accountid) = mysql_fetch_row($result);

  $result = mysql_query("SELECT id, password, salt FROM accounts WHERE name = '$username' LIMIT 1");
  list($id, $realpass, $salt) = mysql_fetch_row($result);

  $sql = "SELECT * FROM accounts WHERE name = '$username'";
  $result = mysql_query($sql);
  $row = mysql_fetch_assoc($result);
    
if(($realpass == hash('sha512',$password.$salt)) && ($accountid == $id) && ($meso > 50000000) && (loggedin == 0)) {
     mysql_query("UPDATE accounts SET nxcash = nxcash + 25000 WHERE name = '$username' LIMIT 1");
     mysql_query("UPDATE characters SET meso = meso - 5000000 WHERE name = '$char' LIMIT 1");
     echo "You have payed 50 mil from $char to get 25k NX for $username !";
} else
     echo "There was an error getting you NX. Either 1. You do not have enough money.  2. You do not have the char you listed on that account. 3.  You are logged in.";    }
  // if no match, destroy the session and prepare error message
  else {
    $message[] = 'Please Type Your Info Correctly..';
    }
?>
<!-- start content -->
       <div align="center"> <div class='welcome'>
Welcome to the NX Cash shop!</br>

50,000,000 mesos for 25,000 NX!</br> 

Make sure you are logged off during this process!</br> 

No refunds for your silly mistakes!</br></div> </div>
          <div align="center">
          <div class="display">
<?php
if (isset($message)) {
  echo '<ul>';
  foreach ($message as $item) {
    echo "<li>$item</li>";
    }
  echo '</ul>';
  }
?>
           </div>
              <form id="form1" name="form1" method="post" action="">
                    <table cellspacing="0" cellpadding="5" width="100%">
                  <tr>
                            <td width="50%" align="right" class="list">Username :</td>
                          <td class="list"><input id="username" type="text" name="username" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td width="50%" align="right" class="list">Password :</td>
                          <td class="list"><input id="password" type="password" name="password" maxlength="20" /></td>
                        </tr>
                        <tr>
                            <td width="50%" align="right" class="list">Character paying 100 mil :</td>
                          <td class="list"><input id="char" type="text" name="char" maxlength="12"></td>
                        </tr>
                        <tr>
                          <td align="right" colspan="2"><input id="reset" name="reset" type="submit" value="Buy 25k NX!" /></td>
                        </tr>
                    </table>
            </form>
            </div>
<!-- end content -->
</div>

Link to comment
https://forums.phpfreaks.com/topic/111005-unexpected-on-page/#findComment-569589
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.