PHP - Apache Forbidden Error On Update
Hello,
I have a site that i built about 2 years ago, and has worked fine with often usage since. Today, I get the Forbidden error on the executed document when going to edit a record. Funny thing is, i can insert into the textarea anything except the code that i am using, which is an iframe. Perms are 755 and as i have said, this has worked fine up until today... any thoughts? thanks for you help Joe. Similar TutorialsCode: [Select] http://localhost/link.php?course=fitness link.php Code: [Select] <?php $course=$_GET[course]; echo "$course"; ?> I install the new apache it come out with this error "Use of undefined constant course - assumed 'course' in C:\xampp\htdocs\link.php on line 2". Previouly it is working fine on old one. Why it happened on new apache? I am working from my home computer using windows 8.1. I downloaded Xampp, installed notepad++ and created a simple echo statement using PHP. I then placed the statment into the htdocs file. Then I went to my browser and entered the path as localhost:81/invoice.php (I used 81 because 80 is used for another application). I also changed all of the locations where it defaulted to 80 (using the find function, so I know I covered them all). I still recieved this message below. I know they are seeing each other for two reasons.. 1. I get another error message when I make up a fake file path in localhost folder. 2. The error is a 404. Also, I can see Xampp dashboard at localhost:81/xampp. I am stumped. Could it be my security settings or the fact that I am on a home server? Also, could it be problem with having mysql and microsoft sql server 2008 R2 on the same machine? Any help would be awesome. Also, yes my Xampp is started up (Apache and Mysql). Thanks.
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404 localhost Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 Edited by Butterbean, 18 December 2014 - 11:16 PM. Hi there, I'm a .net developer and I've inherited a partially complete php project. I'm trying get part of it running on my pc and am running into some issues due to my fairly limited knowledge with php/apache web server. I'm using Windows Vista, I have Apache HTTP server 2.2 running and am using PHP 5.2.17. The aim is to send some data to the web server. I'm using this function below - public static function push_data($data) { $data = base64_encode(gzdeflate(ot::encrypt(serialize($data), otCRYPT_KEY), 9)); $data = http_build_query(array(otDATA_KEY => $data)); $opts = array ( 'http' => array ( 'method' => 'POST', 'header'=> "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n", 'content' => $data ) ); $ctx = stream_context_create($opts); return file_get_contents(otDATA_URL, 0, $ctx); } And am getting this message back - PHP Warning: file_get_contents(http://localhost/Epointment/ot/backend/data.php): failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host failed to respond. I've echoed $ctx and get Resource ID #15 and echoed otDATA_URL and get http://localhost/Epointment/ot/backend/data.php, which is correct. I've run a test php script actually on the web server and it works, so at least I know the server is running and PHP works on it. I'm not sure if this is an issue with the Apache settings or the PHP script or php.ini settings thanks for any help, This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=351056.0 I have been pulling my hair out for the lasy 3 hours i am trying to update a MySql table but i cant get it too work, i just keep getting MySql error #1064 - You have an error in your SQL syntax; if i just update 1 field it works fine but if i try to update more than 1 field it dosent work, Help Please! <?php $root = $_SERVER['DOCUMENT_ROOT']; require("$root/include/mysqldb.php"); require("$root/include/incpost.php"); $con = mysql_connect("$dbhost","$dbuser","$dbpass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$dbame", $con); mysql_query("UPDATE Reg_Profile_p SET build='$build' col='$col' size='$size' WHERE uin = '$uinco'"); ?> This is the error I got Forbidden You don't have permission to access /LoginSystem/< on this server. In the url http://localhost/LoginSystem/%3C?%20echo%20$_SERVER[%27PHP_SELF%27];?%3E Code: [Select] <?php /* This script was downloaded at: LightPHPScripts.com Please support us by visiting out website and letting people know of it. Produced under: LGPL */ /* Start session */ if($startSession == TRUE){ session_start();} /* Config file */ include('config.php'); /* Check for submition */ if($_POST['submitID'] == 2){ /* Connect to database & query */ if($connectDatabase == TRUE){$action=TRUE;include('connect.php');} /* sanitize and check info */ $userName = mysql_real_escape_string($_POST['userName'],$dbc); $password = mysql_real_escape_string($_POST['password'],$dbc); if($userName == NULL) { $message = 'Please enter username.';} if($message == NULL && $password == NULL){ $message = 'Please enter password.';} if($message == NULL && $password != $_POST['password2']){ $message = 'Passwords do not match.';} if($message == NULL) { $userQuery = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM `$tableName` WHERE `$userNameField`='$userName'")); if($userQuery[0] > 0){ $message = 'This username already exists. Please select another.'; } else { /* Add user */ $addUser = mysql_query("INSERT INTO `$tableName` (`$userNameField`,`$userPasswordField`) VALUES ('$userName','$password')"); if($addUser) { /* Disconnect from database */ if($connectDatabase == TRUE){$action=FALSE;include('connect.php');} /* Log use in */ $_SESSION['isLoged'] = 'yes'; $_SESSION['userName'] = $userName; /* add cookies ?*/ /* expire in 1 hour */ if($useCookies == TRUE) { setcookie("isLoged", 'yes', time()+logedInFor, "/", ".$domainName", 1); setcookie("userName", $userName, time()+logedInFor, "/", ".$domainName", 1); } /* Redirect to login page */ header("Location: $loginPage"); exit(); } else { $message = 'Internal error. Please contact administrator.'; } } } /* Disconnect from database */ if($connectDatabase == TRUE){$action=FALSE;include('connect.php');} } ?> <!-- /* This script was downloaded at: LightPHPScripts.com Please support us by visiting out website and letting people know of it. Produced under: LGPL */ --> <?php /* Display error messages */ if($message != NULL){?> <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFCCCC"> <tr> <td><div align="center"><strong><font color="#FF0000"><?=$message;?></font></strong></div></td> </tr> </table> <?php } ?> <form action="<? echo $_SERVER['PHP_SELF'];?>" method="post" name="register" id="register" style="display:inline;"> <table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#99CC33"> <tr bgcolor="#99CC99"> <td colspan="2"><div align="center"><strong>Please enter registration information: </strong></div></td> </tr> <tr> <td width="47%"><strong>Username:</strong></td> <td width="53%"><input name="userName" type="text" id="userName"></td> </tr> <tr> <td><strong>Password:</strong></td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td><strong>Re-enter password: </strong></td> <td><input name="password2" type="password" id="password2" /></td> </tr> <tr> <td colspan="2"><div align="center"><font face="Georgia, Times New Roman, Times, serif"><strong> <input name="Submit" type="submit" id="Submit" value="Register"> <input name="submitID" type="hidden" id="submitID" value="2"> </strong></font> </div></td> </tr> <tr> <td colspan="2"><div align="right"><a href="http://lightphpscripts.com" target="_blank"><font size="1">Powered by LPS</font></a> </div></td> </tr> </table> </form> This topic has been moved to Apache HTTP Server. http://www.phpfreaks.com/forums/index.php?topic=315259.0 Hi all me again thank god for sites like this here is my prob i have a page that edits then sends the info to a processing page to update the db but after i added a new bit i get a error Error: 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 'order = '6', bi = '1', print = '1', online = '1', short_details = 'asdasda', ful' at line 1 im using get in my forms till its all working so i can see what is being passed to the processing page here is my code the update page <? //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> <? include("protect/password_protect.php"); ?> <?php error_reporting(E_ALL); include ("../includes/db_config.php"); mysql_connect($db_hostname,$db_username,$db_password); @mysql_select_db($db_database) or die( "Unable to select database"); $query="SELECT * FROM `$db_table` WHERE `id` ='".$_GET['id']."'"; $result=mysql_query($query); $num=mysql_num_rows($result); mysql_close(); $i=0; while ($i < $num) { $id=mysql_result($result,$i,"id"); $order=mysql_result($result,$i,"order"); $pro_name=mysql_result($result,$i,"pro_name"); $short_details=mysql_result($result,$i,"short_details"); $full_details=mysql_result($result,$i,"full_details"); $bi=mysql_result($result,$i,"bi"); $print=mysql_result($result,$i,"print"); $online=mysql_result($result,$i,"online"); ?> <table width="515" height="315" > <form name="form1" method="get" action="runupdate.php?id=<? echo"$id"?>"> <tr> <th width="22%" scope="row"><p>Id</p></th> <td width="78%"><input class="udp" name="id" type="text" id="id" value="<? echo "$id" ?>" size="3" maxlength="3" readonly="readonly"> Ordering: <select name="order"> <option value="<? echo"$order"?>" selected>Is Now<? echo"$order"?></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> </td> </tr> <tr> <th scope="row"><p>Project Name</p></th> <td><input class="udp" name="pro_name" type="text" id="pro_name" value="<? echo "$pro_name" ?>" size="40" MAXLENGTH="40"></td> </tr> <tr> <th scope="row"><p>Category</p></th> <td> Brand Identity:<input <?php if (!(strcmp("$bi",1))) {echo "checked=\"checked\"";} ?> name="bi" type="checkbox" value="1" /> Print:<input <?php if (!(strcmp("$print",1))) {echo "checked=\"checked\"";} ?> name="print" type="checkbox" value="1" /> Online:<input <?php if (!(strcmp("$online",1))) {echo "checked=\"checked\"";} ?> name="online" type="checkbox" value="1" /></td> </tr> <tr> <th scope="row"><p>Short Details</p></th> <td><input class="udp" name="short_details" type="text" value="<? echo "$short_details" ?>" size="50" MAXLENGTH="60"/></td> </tr> <tr> <th height="163" valign="top" scope="row"><p>Full Details</p></th> <td><textarea class="udp" name="full_details" cols="50" rows="10" id="full_details"><? echo "$full_details"?> </textarea> <input class="udp" type="submit" name="Update" id="Update" value="Update" /></td> </tr> <tr> <th scope="row"> </form></th> </tr> </table> <? $i++; } ?> and this is the processing page can any one help with the sql injection protection here please just an example will do thanks. <?php error_reporting(E_ALL); include ("../includes/db_config.php"); $con = mysql_connect($db_hostname,$db_username,$db_password); @mysql_select_db($db_database) or die( "Unable to select database"); $bi=mysql_result($result,$i,"bi"); $print=mysql_result($result,$i,"print"); $online=mysql_result($result,$i,"online"); $ud_pn=$_GET['pro_name']; $ud_sd=$_GET['short_details']; $ud_fd=$_GET['full_details']; $ud_bi=$_GET['bi']; $ud_print=$_GET['print']; $ud_online=$_GET['online']; $ud_order=$_GET['order']; //// when i add order = '$ud_order' to the query it errors and i dont no why as it is layed out the same as pro_name and bi and print ect. $query = "UPDATE $db_table SET pro_name = '$ud_pn', order = '$ud_order', bi = '$ud_bi', print = '$ud_print', online = '$ud_online', short_details = '$ud_sd', full_details = '$ud_fd' WHERE id = '".$_GET['id']."'"; if (!mysql_query($query,$con)) { die('Error: ' . mysql_error()); } echo "$ud_pn record updated<p>With:<p>Short Details:<p>$ud_sd<p>Full Details:<p>$ud_fd<p>Category:<p>Brand Identity:$ud_bi</br> Print:$ud_print</br> Online:$ud_online</br><p> Ordering:$ud_order</br> "; mysql_close($con) ?> Hello guys, I have these lines of code echo $_POST['uteamid']; $iddquery1 = mysql_query("Select Driver_ID from Driver where Driver_Name='".$temp."'"); $result = mysql_fetch_assoc($iddquery1); $idquery2 =mysql_query("Select Driver_ID from Driver where Driver_Name='".$_POST['DriverSubst']."'"); $resultidquery2 = mysql_fetch_assoc($idquery2); $replaceid = $result['Driver_ID']; echo $replaceid; $updatequery2 = "Update Team_Driver SET Driver_ID = '".$resultidquery2['Driver_ID']."' where UTeam_ID='".$_POST['uteamid']."' and Driver_ID='".$replaceid."'"; echo $updatequery2; Output of the query is: 5 1 Update Team_Driver SET Driver_ID = '2' where UTeam_ID='5' and Driver_ID='' Why is that last Driver_ID = null? wen it should be 1..and its echoing 1 right before that line. Any help will be appreciated Is there any visible error in my code? Code: [Select] if (isset($_POST['country'], $_POST['state'], $_POST['city'])) { if ($_POST['state'] = '') { $details = $_POST['city'].', '.$_POST['country']; update_user_location($details); } else { $details = $_POST['city'].', '.$_POST['state']; update_user_location($details); } } Code: [Select] function update_user_location($details) { global $user_info; $details = mres($details); mysql_query("INSERT INTO `user_actions` (`user_id`, `action_id`, `time`, `details`) VALUES (${user_info['uid']}, 1, NOW(), {$details})"); } I can't find the error, someone help me please.
$conn = mysql_connect("localhost","root","Pass"); $err_db = mysql_select_db('bd_amics'); $sql = ("INSERT INTO `'".$_SESSION["use"][14]."'` (ID,Amic,PubID) VALUES ('".$_SESSION["person"][14]."', "1", '".$_SESSION["person"][15]."')"); mysql_query("SET NAMES utf8"); mysql_query($sql, $conn); mysql_close(); $conn3 = mysql_connect("localhost","root","Pass"); $err_db3 = mysql_select_db('bd_amics'); $sql3 = ("UPDATE `'".$_SESSION["person"][14]."'` SET Amic="2" WHERE ID='".$_SESSION["use"][14]); mysql_query("SET NAMES utf8"); mysql_query($sql3, $conn3); mysql_close(); ive tried to write the $sql in so many ways and this looks the best and its still not working and ive checked the correct syntax but still. this is how i wrote: $sql2 = "UPDATE `tvchaty`.`episodes` SET `showid` = ".($showid).", `epname` = ".($epname).", `season` = ".($season).", `episode` = ".($episode).", `info` = ".($info).", `airdate` = ".($airdate).", `directwatch` = ".($directwatch)." WHERE `episodes`.`id` = ".($id)." LIMIT 1;"; this is the error: 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 'Prideses, `season` = 6, `episode` = 11, `info` = , `airdate` = 2010-11-01, `dire' at line 1 what could be the problem? tnx.... Code: [Select] //Update the ranks if (isset($_POST['update'])){ $ids = implode(",", array_map('intval', $_POST['m'])); $ranks = implode(",", array_map('intval', $_POST['ranks'])); if ($ids < 1) message("Incorrect Data"); if ($ranks < 0) message("Incorrect Data"); foreach ($_POST['ranks'] as $muffins){ $db->query('UPDATE friends set rank = '.$muffins.' WHERE friend_id = '.$_POST['m'].' AND user_id = '.$pun_user['id'].'') or error('Unable to remove users from online list', __FILE__, __LINE__, $db->error()); } redirect("s.php?section=Friends","Thanks, Ranks Updated"); } friend_id = becomes blank? the $muffins work and each rank is showed respectivaly, but how can I join in another array in the loop? I tried another foreach in the loop, but it just made me run double the queries. Any idea? $muffins is working fine and $_POST['m'] is giving no results i need to have 2 dynamic arrays in that forloop, the $ranks and the $ids Trying to get this to work but I know I'm missing something here. It's a form that is meant to update a record in DB. I am getting errore reference to first if (mysql_num_rows($result) == 1) in code and error message: Error has occurred. $connection = mysql_connect("xxxxxxxx","xxxxxx","xxxxxx"); if (!$connection) { die("Error connecting to database " . mysql_error()); } if (isset($_POST['submitted'])) $name = $_POST['name']; $email = $_POST['email']; $PHOTOGRAPHERID = $_POST['PHOTOGRAPHERID']; $query = "SELECT * FROM Photographers WHERE PHOTOGRAPHERID = $PHOTOGRAPHERID"; $result = mysql_query($query); if (mysql_num_rows($result) == 1){ // Make the query. $query = "UPDATE Photographers SET name='$name',email='$email' WHERE PHOTOGRAPHERID=$PHOTOGRAPHERID"; $result = @mysql_query ($query); // Run the query. if (mysql_affected_rows() == 1) { // If it ran OK. header("Location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/"."search.php"); } else { // If it did not run OK. echo '<h1 id="mainhead">System Error</h1> <p class="error">The name could not be edited due to a system error. We apologize for any inconvenience.</p>'; // Public message. echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message. exit(); } } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">Error has occurred.</p>'; } $query = "SELECT name, email FROM Photographer WHERE PHOTOGRAPHERID=$PHOTOGRAPHERID"; $result = @mysql_query ($query); // Run the query. // Create the form. echo '<h2>Edit a User</h2> <form action="update.php" method="post"> <p>Name: <input type="text" name="name" size="60" maxlength="60" value="' . $row[0] . '" /></p> <p>Email: <input type="text" name="email" size="60" maxlength="60" value="' . $row[1] . '" /></p> <p><input type="submit" name="submit" value="Submit" /></p> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="PHOTOGRAPHERID" value="' . $id . '" /> </form>'; This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=325938.0 I am running an UPDATE query which runs successfully, but my code throws an error saying that the UPDATE did not occur?! Specifically, I get a "MEMBER_UPDATE_FAILED_2126" Here is my code... // ************************ // Update Last Activity. * // ************************ if ((isset($_SESSION['loggedIn'])) && ($_SESSION['loggedIn'] == TRUE)){ // Initialize variables. $loggedIn = 1; $memberID = 19; // For Test Purposes // $memberID = (isset($_SESSION['memberID']) ? $_SESSION['memberID'] : ''); // ************************ // Update Member Record. * // ************************ // Connect to the database. require_once(WEB_ROOT . 'private/mysqli_connect.php'); // Build query. $q = "UPDATE member SET logged_in=?, last_activity=now() WHERE id=? LIMIT 1"; // Prepare statement. $stmt = mysqli_prepare($dbc, $q); // Bind variables to query. mysqli_stmt_bind_param($stmt, 'ii', $loggedIn, $memberID); // Execute query. mysqli_stmt_execute($stmt); // Verify Update. if (mysqli_stmt_affected_rows($stmt)!==1){ // Update Failed. $_SESSION['resultsCode'] = 'MEMBER_UPDATE_FAILED_2126'; // Redirect to Display Outcome. header("Location: " . BASE_URL . "/members/results.php"); // End script. exit(); }//End of UPDATE MEMBER RECORD // Close prepared statement. mysqli_stmt_close($stmt); // Close the connection. mysqli_close($dbc); }//End of UPDATE LAST ACTIVITY This was working earlier, so what is going on?! Thanks, Debbie <?php //COOKIE CHECKER if (isset($_COOKIE["person"])){ if (filter_var($_COOKIE["person"], FILTER_VALIDATE_INT)){ $user_id = $_COOKIE["person"]; //DATABASE CONNECTION VARIABLES $myserver ="localhost"; $myname = "username"; $mypassword = "password"; $mydb ="dbname"; /*SQL CONNECTION*/ // Create connection $conn = new mysqli($myserver, $myname, $mypassword, $mydb); // Check connection if ($conn->connect_error) { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY> <H1>Decline of the Han - Three Kingdoms</H1>'; die("Connection failed: " . $conn->connect_error); echo '</BODY> </HTML>'; } else { //COUNT USER $cquery = "SELECT COUNT(*) AS usercheck FROM Players WHERE ID = ?"; $cid = $conn->prepare($cquery); $cid->bind_param('i', $user_id); $cid->execute(); $cid->bind_result($usercheck); $cid->fetch(); if ($usercheck ==1){ if (isset($_POST["profile"])){ if(!filter_var($_POST["profile"], FILTER_SANITIZE_STRING)){ echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">Unable to filter bio <a href="biography.php">return</a></P>'; echo '</BODY> </HTML>'; } else { $profile = $_POST["profile"]; $sql = "UPDATE Player_Data SET Bio =? WHERE ID=?"; $q = $conn->prepare($sql); $q->bind_param("si", $profile, $user_id); $q->execute(); echo '<P>Biography altered <a href="biography.php">return</a></P>'; //close connection $conn->close(); } } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">'.$usercheck.' '.$user_id.'</P>'; echo '<P class="error">No such user found!</P>'; //close connection $conn->close(); //foot echo '</BODY> </HTML>'; } //end connection check } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">ERROR invalid cookie!</P>'; echo '</BODY> </HTML>'; } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">No cookie detected!<br><a href="login.php">login</a></P>'; echo '</BODY> </HTML>'; } ?>I have an error in the update, but I am not seeing where I made it. Its annoying because the update won't execute and anything beyond the update isn't visible in the html source code in the browser, so it is likely to be a syntax error, but where? Hey i keep getting undefined index error when i submit the editing page I cant figure out what the problem is I have checked if i have miss spelled anything from the mysql table and i haven't please help everything exist in mysql but still im getting this error and not letting me update it Notice: Undefined index: uruklink in D:\wamp\www\admin\edit.php on line 8 Notice: Undefined index: ketabsetlink in D:\wamp\www\admin\edit.php on line 9 <?php include "../configdb.php"; $id = $_GET['id']; if(isset($_POST['submit'])) { //global variables $uruklink = $_POST['uruklink']; $ketabsetlink = $_POST['ketabsetlink']; //run the query which adds the data gathered from the form into the database $result = mysql_query("UPDATE softlinks SET uruklink='$uruklink', ketabsetlink='$ketabsetlink' WHERE id='$id' ",$connect); echo "<b>Your Page have been edited successfully"; // echo "<meta http-equiv=Refresh content=2;url=index.php>"; } elseif($id) { $result = mysql_query("SELECT * FROM softlinks WHERE id='$id' ",$connect); while($row = mysql_fetch_assoc($result)) { $uruklink = $row['uruklink']; $ketabsetlink = $row['ketabsetlink']; ?> <h3>::Edit Page</h3> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?id=<?php echo $row['id']?>"> <input type="hidden" name="id" value="<?php echo $row['id']?>"> <input name="name" size="40" maxlength="255" value="<?php echo $uruklink; ?>"> <input name="footer" size="40" maxlength="255" value="<?php echo $ketabsetlink; ?>"> <input type="submit" name="submit" value="Submit"> <?php } } ?> <?php //COOKIE CHECKER if (isset($_COOKIE["person"])){ if (filter_var($_COOKIE["person"], FILTER_VALIDATE_INT)){ $user_id = $_COOKIE["person"]; //DATABASE CONNECTION VARIABLES $myserver ="localhost"; $myname = "username"; $mypassword = "password"; $mydb ="dbname"; /*SQL CONNECTION*/ // Create connection $conn = new mysqli($myserver, $myname, $mypassword, $mydb); // Check connection if ($conn->connect_error) { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY> <H1>Decline of the Han - Three Kingdoms</H1>'; die("Connection failed: " . $conn->connect_error); echo '</BODY> </HTML>'; } else { //COUNT USER $cquery = "SELECT COUNT(*) AS usercheck FROM Players WHERE ID = ?"; $cid = $conn->prepare($cquery); $cid->bind_param('i', $user_id); $cid->execute(); $cid->bind_result($usercheck); $cid->fetch(); if ($usercheck ==1){ if (isset($_POST["profile"])){ if(!filter_var($_POST["profile"], FILTER_SANITIZE_STRING)){ echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">Unable to filter bio <a href="biography.php">return</a></P>'; echo '</BODY> </HTML>'; } else { $profile = $_POST["profile"]; $sql = "UPDATE Player_Data SET Bio =? WHERE ID=?"; $q = $conn->prepare($sql); $q->bind_param("si", $profile, $user_id); $q->execute(); echo '<P>Biography altered <a href="biography.php">return</a></P>'; //close connection $conn->close(); } } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">'.$usercheck.' '.$user_id.'</P>'; echo '<P class="error">No such user found!</P>'; //close connection $conn->close(); //foot echo '</BODY> </HTML>'; } //end connection check } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">ERROR invalid cookie!</P>'; echo '</BODY> </HTML>'; } } else { echo '<!DOCTYPE HTML> <HTML> <HEAD> <TITLE>test</TITLE> </HEAD> <BODY>'; echo '<P class="error">No cookie detected!<br><a href="login.php">login</a></P>'; echo '</BODY> </HTML>'; } ?>I have an error in the update, but I am not seeing where I made it. Its annoying because the update won't execute and anything beyond the update isn't visible in the html source code in the browser, so it is likely to be a syntax error, but where? |