Jump to content

Recommended Posts

I need update help: Code is

<?php
//Do not allow the page to be called directly.
if(basename($_SERVER['PHP_SELF']) == "homego.php") {
header("Location: error403.php");
exit;
}
$clan_id_var = $_GET['va'];
$query="select * from `air__".$clan_id_var."`";
$rt=mysql_query($query) or die('The Virtual Airline IATA ' . $clan_id_var . ' Does Not Exist In our Database Sorry');
//Make sure the user is logged in.
global $valid_user;
if(session_is_registered("valid_user")) {
//If no data is posted, show the default form.
if(!$_POST) {
include("?va=<?php echo $clan_id_var; ?>&info=home");
exit;
}
if($valid_user == $nt[ceo]) {
echo ''; }
else {
echo 'You Are Not An Administrator Of This Airline!';
}
//If data is posted, validate.
if($_POST) {

if($demo && $valid_user == "admin") {
include("?va=<?php echo $clan_id_var; ?>&info=home");
exit;
}
//If no errors, change password in database.
if(!$pass_error) {
$connection = @mysql_connect("$db_host", "$db_user", "$db_pass") or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");

$sql='UPDATE air__.$clan_id_var SET 1 = "$nt[1]"';

$result = @mysql_query($sql,$connection) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
?>
                        <table cellpadding="4" cellspacing="0">
                            <tr>
                                <td>
                                    <p><span class="success"><?php echo $lang['pwchange'] ?></span></p>
                                </td>
                            </tr>
                        </table>

<?php
include("?va=<?php echo $clan_id_var; ?>&info=home");
exit;
}
}
}
else
//If not logged in, show error.
{
include("?va=<?php echo $clan_id_var; ?>&info=unverified");
}
?>

But for some reason the code will not update and I get this error:

 

A fatal MySQL error occured.

Query: select * from `air__DEMO`

Error: (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 = "$nt[1]"' at line 1

 

So if someone could help me it would be appreciated.

 

PS: The colum I am trying to update is called '1'

Link to comment
https://forums.phpfreaks.com/topic/62967-solved-cms/
Share on other sites

Try getting some sort of SQL sandbox, phpMyAdmin if you have it, and enter in that query and see what happens.

Also, this line kind of got my attention (since it stopped the highlighter from working after that point):

include("?va=<?php echo $clan_id_var; ?>&info=home");

If you're actually sending code by a GET/POST variable to be executed by that other script, then I gotta say that that's a really bad idea. This could allow people to inject code into your script that really shouldn't be run.

Link to comment
https://forums.phpfreaks.com/topic/62967-solved-cms/#findComment-313568
Share on other sites

Yes my connection is fine I am just getting this error:

 

A fatal MySQL error occured.

Query: select * from `air__DEMO`

Error: (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 = "$nt[1]"' at line 1

Link to comment
https://forums.phpfreaks.com/topic/62967-solved-cms/#findComment-313576
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.