ronnie88 Posted July 29, 2008 Share Posted July 29, 2008 all i get is query failed. Yes database is correct <?php session_start(); include 'database.php'; $key = $_POST['key']; $usa = $_POST['name']; if(!strstr($_SERVER['HTTP_REFERER'],"greatdiscountedgames.com/site_flash/admin.php")) { echo "ERROR: YOU CANNOT ACCESS THIS FILE MANUALLY"; } else { $query = "UPDATE info SET key = '$key' WHERE username = '$usa'"; mysql_query($query) or die('Error, query failed'); header('Location: http://www.greatdiscountedgames.com/admin.php'); } ?> and the form <?php if($_SESSION['username'] == ronnie) { ?><form action="reginsert.php" method="post">" <br><tr><td>Name:</td><td><input type="text" name="name" maxlength="25"></td> <tr><td>Registration Code:</td><td><input type="text" name="key" maxlength="25"></td><br> <td><input name="add" type="submit" id="add" value="Set Registration Key"></td> <form></tr> <? } else{ echo "YOU ARE NOT AN ADMIN!"; } ?> Quote Link to comment Share on other sites More sharing options...
Goldeneye Posted July 29, 2008 Share Posted July 29, 2008 $query = "UPDATE info SET key = '$key' WHERE username = '$usa'"; mysql_query($query) or die(mysql_error()); Try that, and give us the error that it returns. Quote Link to comment Share on other sites More sharing options...
ronnie88 Posted July 29, 2008 Author Share Posted July 29, 2008 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 'key = 'registrationkey' WHERE username = 'ronnie'' at line 1 ideas? thanks Quote Link to comment Share on other sites More sharing options...
peranha Posted July 29, 2008 Share Posted July 29, 2008 key is a reserver word in sql. you will need to add backticks to it, or change it. `key` the key with the ~ line beside the 1. Quote Link to comment Share on other sites More sharing options...
ronnie88 Posted July 29, 2008 Author Share Posted July 29, 2008 thanks but now i am having another problem.... I submit the form and i get this: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/great/public_html/admin.php on line 77 entire code: <?php session_start(); include("database.php"); if($_SESSION['username']) { $query = "SELECT * FROM info WHERE username='{$_SESSION['username']}'"; $result = mysql_query($query); $row = mysql_fetch_row($result); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>GreatDiscountedGames Admin Page</title> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="style.css" type="text/css" rel="stylesheet"> <body id="page1"> <table style="width:766px" align="center"> <tr> <td><? if ((isset($_SESSION['username'])) && ($_SESSION['username'] != "")) { echo "· Welcome <b>$_SESSION[username]</b>, you are logged in. <a href=\"logout.php\">Logout</a>"; } else { echo "<b><a href='index.php'>Login</a> | <a href='register2.php'>Register</a></b>"; } ?> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,24" width="766" height="433"> <param name="movie" value="flash/header_v8.swf?button=1"> <param name="quality" value="high"> <param name="menu" value="false"> <!--[if !IE]> <--> <object data="flash/header_v8.swf?button=1" width="766" height="433" type="application/x-shockwave-flash"> <param name="quality" value="high"> <param name="menu" value="false"> <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer"> FAIL (the browser should render some flash content, not this). </object> <!--> <![endif]--> </object> </td> </tr> <tr> <td style="height:375px"> <table> <tr> <td> <table style="height:207px"> <tr> <td style="width:36px"></td> <td class="col1"> <br style="line-height:6px"> <img src="images/t1_1.gif" alt="">NEWS<br> <br style="line-height:16px"> <ul> <li> <a href="#"><span>2008-08-03 /</span> GREATDISCOUNTEDGAMES IS OPEN!</a></li> <li> <a href="http://www.sup-clan.com"><span>2008-08-03 /</span> CLIENT .:SUP:. Completed</a></li> </ul> <div class="right"><a href="#"><img src="images/view_archive.gif" alt="" border="0"></a></div> </td> <td class="col2" > <br style="line-height:6px"> <img src="images/t1_2.gif" alt=""><br> <br style="line-height:19px"> <? include("admin2.php"); ?> <td style="width:30px"></td> </tr> </table> </td> </tr> <tr> <td class="border"></td> </tr> <tr> <td class="block"> <table> <tr> <td style="height:28px"></td> </tr> <tr> <td> <table style="height:101px"> <tr> <td class="newsletter"> <div> <img src="images/t1_3.gif" alt=""><br> <br style="line-height:7px"> <? include("login2.php"); ?> <br> </div> </td> <td style="width:36px"></td> <td style="width:383px"> <img src="images/t1_4.gif" alt=""><br> <br style="line-height:18px"> <img src="images/lapka.gif" alt="" align="left" style="margin-top:3px"> <div style="margin-left:22px"> <strong>Quote by .:SUP:.</strong> I ask Ronnie aka Vital to make a multiplayer map for my clan called SUP <a href="http://www.SUP-Clan.com">Link</a>, he had it completed within 8 hours! Fast easy and reliable.<img src="images/lapka1.gif" style="vertical-align:middle" alt=""> <br><br><br><strong>ScreenShots</strong><br><br> <a href="images/cell1.jpg"><img src="images/cell1.jpg" width="200" height="85"></a> <br> <a href="images/cell2.jpg"><img src="images/cell2.jpg" width="200" height="85"></a> </div> </td> <td style="width:30px"></td> </tr> </table> </form> </td> </tr> <tr> <td class="col3"> <div class="right"> <a href="#"><img src="images/learn_more.gif" alt="" border="0"></a> </div> </td> </tr> </table> </td> </tr> <tr> <td class="border"></td> </tr> </table> </td> </tr> <tr> <td class="footer"><img src="images/imagination.gif" alt=""><img src="images/line.gif" alt=""><a href="admin.php">Admin Login</a></td> </tr> </table> </body> </html> the admin2.php <?php if($_SESSION['username'] == ronnie) { ?> <form action="reginsert.php" method="post">" <br><tr><td>Name:</td><td><input type="text" name="name" maxlength="25"></td> <tr><td>Registration Code:</td><td><input type="text" name="key" maxlength="25"></td><br> <td><input name="add" type="submit" id="add" value="Set Registration Key"></td> <form></tr> <? } else{ echo "YOU ARE NOT AN ADMIN!"; } ?> the reginsert.php <?php session_start(); include 'database.php'; $regis = $_POST['regis']; $usa = $_POST['name']; if(!strstr($_SERVER['HTTP_REFERER'],"greatdiscountedgames.com/site_flash/admin.php")) { echo "ERROR: YOU CANNOT ACCESS THIS FILE MANUALLY"; } else { $query = "UPDATE info SET regis = '$regis' WHERE username = '$usa'"; mysql_query($query) or die(mysql_error()); header('Location: http://www.greatdiscountedgames.com/admin.php'); } ?> line 77 of admin.php include("admin2.php"); Quote Link to comment Share on other sites More sharing options...
ronnie88 Posted July 29, 2008 Author Share Posted July 29, 2008 I've also tried just placing the admin2.php code straight into the admin.php still error on 77 Quote Link to comment Share on other sites More sharing options...
ronnie88 Posted July 29, 2008 Author Share Posted July 29, 2008 friendly bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.