Jump to content

Another form problem


blink359

Recommended Posts

The error is: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/nathan/unstuck.php on line 16

 

from my form:

<?php
include("config.php");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$user = $_POST['user'];
$pass = $_POST['pass'];
$character = $_POST['character'];
{     
     if(!$user || !$pass || !$character)
     {
         $problemMessage = "Please fill in all required fields";
         $success = false;
     }
     if($success);
     {
         $result = mysql_query "SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'";
         or die(mysql_error());
         $numrows = mysql_num_rows($result);
     }
 else
 {
         die("Account name or password is incorrect");
     }

     $result = mysql_query "update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'" or die(mysql_error());
     echo "Character '".$character."' has been unstuck!";
     mysql_close();
?>
<html>
<head>
<title>Auto Unstucker</title>
</head>
<body>
<center>
<form name=myform method=post action='unstucker.php'>
<center><h1>Character Unstucker</h1></center>
Account Name:<input type=text name=account value=''><br>
Character Name:<input type=text name=character value=''><br>
Password:<input type=password name=password value=''><br>
<br><input type=submit name=submit value=Unstuck><br>
</form>
</body>
</html>

Link to comment
Share on other sites

<?php
include("config.php");
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$user = $_POST['user'];
$pass = $_POST['pass'];
$character = $_POST['character'];
    
     if(!$user || !$pass || !$character)
     {
         $problemMessage = "Please fill in all required fields";
         $success = false;
     }
     if($success)
     {
         $result = mysql_query "SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'"
         or die(mysql_error());
         $numrows = mysql_num_rows($result);
     }
 else
 {
         die("Account name or password is incorrect");
     }

     $result = mysql_query "update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'" or die(mysql_error());
     echo "Character '".$character."' has been unstuck!";
     mysql_close();
?>
<html>
<head>
<title>Auto Unstucker</title>
</head>
<body>
<center>
<form name=myform method=post action='unstucker.php'>
<center><h1>Character Unstucker</h1></center>
Account Name:<input type=text name=account value=''><br>
Character Name:<input type=text name=character value=''><br>
Password:<input type=password name=password value=''><br>
<br><input type=submit name=submit value=Unstuck><br>
</form>
</body>
</html>

still Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/nathan/unstuck.php on line 16

Link to comment
Share on other sites

    }

 

    $result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'"); or die(mysql_error());

    $numrows = mysql_num_rows($result);

    }

 

Parse error: syntax error, unexpected T_LOGICAL_OR in /var/www/nathan/unstuck.php on line 24

Link to comment
Share on other sites

Do you not understand what I did to fix that issue?

 

I mean come on now...

 

$result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'") or die(mysql_error());
     $numrows = mysql_num_rows($result);

 

I would hope that you are able to fix the others yourself, given that all I did was remove the semicolon before the or die statement.

Link to comment
Share on other sites

<?php
$dbhost = "localhost"; 
$dbuser = "nathan"; 
$dbpass = "your_password"; 
$dbname = "logon"; 
mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$user = $_POST['user'];
$pass = $_POST['pass'];
$character = $_POST['character'];
    
     if(!$user || !$pass || !$character)
     {
         $problemMessage = "Please fill in all required fields";
         $success = false;
     }
     if($success)
     {
         $result = mysql_query("SELECT acct FROM accounts WHERE login = '".$account."' AND password = '".$password."'") or die(mysql_error());
         $numrows = mysql_num_rows($result);
     }
 else
 {
         die("Account name or password is incorrect");
     }

     $result = mysql_query("update characters SET positionX = 16237, positionY = 16396, positionZ = 60, mapId = 1, zoneId = 0, deathstate = 0 WHERE name = '".$character."'") or die(mysql_error());
     $numrows = mysql_num_rows($result);
     
     echo "Character '".$character."' has been unstuck!";
     mysql_close();
?>
<html>
<head>
<title>Auto Unstucker</title>
</head>
<body>
<center>
<form name=myform method=post action='unstucker.php'>
<center><h1>Character Unstucker</h1></center>
Account Name:<input type=text name=account value=''><br>
Character Name:<input type=text name=character value=''><br>
Password:<input type=password name=password value=''><br>
<br><input type=submit name=submit value=Unstuck><br>
</form>
</body>
</html>

its now just          die("Account name or password is incorrect");

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.