Mod-Jay Posted September 6, 2010 Share Posted September 6, 2010 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 '=1' at line 1 Code: <?php session_start(); include "includes/connect.php"; include "includes/config.php"; if(isset($_SESSION['admin2'])){ include 'includes/getuserinfo.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dashboard | Modern Admin</title> <link rel="stylesheet" type="text/css" href="css/960.css" webstripperwas="css/960.css" /> <link rel="stylesheet" type="text/css" href="css/reset.css" webstripperwas="css/reset.css" /> <link rel="stylesheet" type="text/css" href="css/text.css" webstripperwas="css/text.css" /> <?php if($acptheme == '') { echo '<meta http-equiv=Refresh content=0;url="nocss.php">'; } else { echo '<link rel="stylesheet" type="text/css" href="css/'.$acptheme.'.css" webstripperwas="css/<?php echo $acptheme ?>.css" />'; } ?> <link type="text/css" href="css/smoothness/ui.css" webstripperwas="css/smoothness/ui.css" rel="stylesheet" /> <script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" webstripperwas="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script> <script type="text/javascript" src="js/blend/jquery.blend.js" webstripperwas="js/blend/jquery.blend.js" ></script> <script type="text/javascript" src="js/ui.core.js" webstripperwas="js/ui.core.js" ></script> <script type="text/javascript" src="js/ui.sortable.js" webstripperwas="js/ui.sortable.js" ></script> <script type="text/javascript" src="js/ui.dialog.js" webstripperwas="js/ui.dialog.js" ></script> <script type="text/javascript" src="js/ui.datepicker.js" webstripperwas="js/ui.datepicker.js" ></script> <script type="text/javascript" src="js/effects.js" webstripperwas="js/effects.js" ></script> <script type="text/javascript" src="js/flot/jquery.flot.pack.js" webstripperwas="js/flot/jquery.flot.pack.js" ></script> <![if IE]> <script language="javascript" type="text/javascript" src="js/flot/excanvas.pack.js" webstripperwas="js/flot/excanvas.pack.js" ></script> <![endif]> <![if IE 6]> <link rel="stylesheet" type="text/css" href="css/iefix.css" webstripperwas="css/iefix.css" /> <script src="js/pngfix.js" webstripperwas="js/pngfix.js" ></script> <script> DD_belatedPNG.fix('#menu ul li a span span'); </script> <![endif]> <script id="source" language="javascript" type="text/javascript" src="js/graphs.js" webstripperwas="js/graphs.js" ></script> </head> <body> <!-- WRAPPER START --> <div class="container_16" id="wrapper"> <!-- HIDDEN COLOR CHANGER --> <div style="position:relative;"> </div> <?php include 'inc/inc/logo.php'; include 'inc/inc/user.php'; ?> <!-- USER TOOLS END --> <div class="grid_16" id="header"> <!-- MENU START --> <div id="menu"> <ul class="group" id="menu_group_main"> <li class="item first" id="one"><a href="dashboard.php" class="main current"><span class="outer"><span class="inner dashboard">Dashboard</span></span></a></li> <li class="item middle" id="two"><a href="page.php" class="main"><span class="outer"><span class="inner content">Pages</span></span></a></li> <li class="item middle" id="three"><a href="#" class="main"><span class="outer"><span class="inner users">Users</span></span></a></li> <li class="item middle" id="four"><a href="#" class="main"><span class="outer"><span class="inner event_manager">Event Manager</span></span></a></li> <li class="item middle" id="five"><a href="#" class="main"><span class="outer"><span class="inner newsletter">Newsletter</span></span></a></li> <li class="item last" id="six"><a href="#" class="main"><span class="outer"><span class="inner settings">Settings</span></span></a></li> </ul> </div> <!-- MENU END --> </div> <div class="grid_16"> <!-- TABS START --> <div id="tabs"> <div class="container"> <ul> <li><a href="dashboard.html" class="current"><span>Dashboard elements</span></a></li> <li><a href="dash/news.php"><span>News</span></a></li> <li><a href="dash/topnews.php"><span>Top News</span></a></li> </ul> </div> </div> <!-- TABS END --> </div> <!-- CONTENT START --> <div class="grid_16" id="content"> <!-- TITLE START --> <div class="grid_9"> <h1 class="dashboard">Dashboard</h1> </div> <!--RIGHT TEXT/CALENDAR--> <div class="grid_6" id="eventbox"><a href="#" class="inline_calendar">You don't have any events for today! Yay!</a> <div class="hidden_calendar"></div> </div> <!--RIGHT TEXT/CALENDAR END--> <div class="clear"> </div> <!-- TITLE END --> <!-- #PORTLETS START --> <div id="portlets"> <!-- FIRST SORTABLE COLUMN START --> <div class="column" id="left"> <div class="portlet"> <div class="portlet-header">Insert News</div> <div class="portlet-content"> <p> </p> </div> </div> </div> <!-- FIRST SORTABLE COLUMN END --> <!-- SECOND SORTABLE COLUMN START --> <div class="column"> <!--THIS IS A PORTLET--> <div class="portlet"> <div class="portlet-header"><img src="images/icons/comments.gif" webstripperwas="images/icons/comments.gif" width="16" height="16" alt="Comments" />Change Theme</div> <div class="portlet-content"> <p class="info" id="success"><span class="info_inner">Change Theme To GEEN</span></p> <p class="info" id="error"><span class="info_inner">Change Theme To RED</span></p> <p class="info" id="info"><span class="info_inner">Change Theme To BLUE</span></p> </div> </div> <!--THIS IS A PORTLET--> <div class="portlet"> <div class="portlet-header"><img src="images/icons/feed.gif" webstripperwas="images/icons/feed.gif" width="16" height="16" alt="Feeds" />Current News </div> <div class="portlet-content"> <ul class="news_items"> <li>NEWS</li> <li>NEWS</li> <li>NEWS</li> <li>NEWS</li> <li>NEWS</li> </ul> <a href="#">» View all news items</a> </div> </div> </div> <!-- SECOND SORTABLE COLUMN END --> <div class="clear"></div> <!--THIS IS A WIDE PORTLET--> <div class="portlet"> <div class="portlet-header fixed"><img src="images/icons/user.gif" webstripperwas="images/icons/user.gif" width="16" height="16" alt="Latest Registered Users" /> Last Registered users Table Example</div> <div class="portlet-content nopadding"> <form action="" webstripperwas method="post"> <table width="100%" cellpadding="0" cellspacing="0" id="box-table-a" summary="Employee Pay Sheet"> <thead> <tr> <th width="34" scope="col"><input type="checkbox" name="allbox" id="allbox" onclick="checkAll()" /></th> <th width="136" scope="col">Name</th> <th width="102" scope="col">Username</th> <th width="109" scope="col">Date</th> <th width="129" scope="col">Location</th> <th width="171" scope="col">E-mail</th> <th width="123" scope="col">Phone</th> <th width="90" scope="col">Actions</th> </tr> </thead> <tbody> <tr class="footer"> <td colspan="4"><a href="#" class="edit_inline">Edit all</a><a href="#" class="delete_inline">Delete all</a><a href="#" class="approve_inline">Approve all</a><a href="#" class="reject_inline">Reject all</a></td> <td align="right"> </td> <td colspan="3" align="right"> </td> </tr> </tbody> </table> </form> </div> </div> <!-- END #PORTLETS --> </div> <div class="clear"> </div> <!-- END CONTENT--> </div> <div class="clear"> </div> <!-- This contains the hidden content for modal box calls --> <div class='hidden'> <div id="inline_example1" title="This is a modal box" style='padding:10px; background:#fff;'> <p><strong>This content comes from a hidden element on this page.</strong></p> <p><strong>Try testing yourself!</strong></p> <p>You can call as many dialogs you want with jQuery UI.</p> </div> </div> </div> <!-- WRAPPER END --> <!-- FOOTER START --> <div class="container_16" id="footer"> Website Administration by <a href="http://www.webgurus.biz" >WebGurus</a></div> <!-- FOOTER END --> </body> </html> <?php } else { echo 'You are not logged in as an administrator.'; } ?> Whats in Connect: <?php include 'config.php'; DEFINE ('DB_HOST', DB_HOST); // This will most likely stay the same. DEFINE ('DB_USER', DB_USER); // Insert your database username into the quotes. DEFINE ('DB_PASSWORD', DB_PASSWORD); // Insert your database password into the quotes. DEFINE ('DB_NAME', DB_NAME);// Insert your actual database name in the quotes. $con = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); //$con = mysql_connect(':/tmp/mysql', $dbuser, $dbpass); mysql_select_db(DB_NAME ,$con); include 'functions.php'; if (isset($_SESSION['user'])) { if($result = mysql_query("SELECT username, rights FROM users WHERE username='{$_SESSION['user']}'")); $n = mysql_fetch_assoc($result); if($n['banned'] == 1) { header("Location: logout.php"); } else { if($n['rights'] == 2) { $_SESSION['admin'] = $n['username']; $_SESSION['user'] = $n['username']; } elseif($n['rights'] == 1) { $_SESSION['mod'] = $n['username']; $_SESSION['user'] = $n['username']; } elseif($n['rights'] == 0) { $_SESSION['user'] = $n['username']; } } } Whats in Config.php: <?php DEFINE ('DB_HOST', 'localhost'); // This will most likely stay the same. DEFINE ('DB_USER', 'root'); // Insert your database username into the quotes. DEFINE ('DB_PASSWORD', ''); // Insert your database password into the quotes. DEFINE ('DB_NAME', 'school');// Insert your actual database name in the quotes. $dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MySQL: ' . mysql_error()); mysql_select_db (DB_NAME) OR die('Could not select the database: ' . mysql_error() ); ?> whats in Functions.php: <?php function ___($_) { return base64_decode($_); } function realEscape($string) { if(get_magic_quotes_gpc()) { return mysql_real_escape_string(stripslashes($string)); } else { return mysql_real_escape_string($string); } } function capitalize($value) { $capitalize = preg_replace('/[a-z]/ie', 'strtoupper($0);', $value, 1); return htmlspecialchars($capitalize); } function encrypt($value) { return md5(md5(base64_encode($value))); } $w = 1; function smileys($value) { global $ln; $codes = array( '', ':angel:', ':@', '', ':s', ':dodgy:', ':!:', ':heart:', '', '', ':tired:', ':-/', '', ':cool:', '', '', '', ''); $img = array( '<IMG alt="Smile" title="Smile" src="http://runelegend.com/images/smilies/smile.gif">', '<IMG alt="Angel" title="Angle" src="http://runelegend.com/images/smilies/angel.gif">', '<IMG alt="Angry" title="Angry" src="http://runelegend.com/images/smilies/angry.gif">', '<IMG alt="Shy" title="Shy" src="http://runelegend.com/images/smilies/blush.gif">', '<IMG alt="Confused" title="Confused" src="http://runelegend.com/images/smilies/confused.gif">', '<IMG alt="Dodgy" title="Dodgy" src="http://runelegend.com/images/smilies/dodgy.gif">', '<IMG alt="Exclamation" title="Exclamation" src="http://runelegend.com/images/smilies/exclamation.gif">', '<IMG alt="Heart" title="Heart" src="http://runelegend.com/images/smilies/heart.gif">', '<IMG alt="Confused" title="Confused" src="http://runelegend.com/images/smilies/huh.gif">', '<IMG alt="Idea" title="Idea" src="http://runelegend.com/images/smilies/lightbulb.gif">', '<IMG alt="Sleepy" title="Sleepy" src="http://runelegend.com/images/smilies/sleepy.gif">', '<IMG alt="Undecided" title="Undecided" src="http://runelegend.com/images/smilies/undecided.gif">', '<IMG alt="Wink" title="Wink" src="http://runelegend.com/images/smilies/wink.gif">', '<IMG alt="Cool" title="Cool" src="http://runelegend.com/images/smilies/cool.gif">', '<IMG alt="Biggrin" title="Biggrin" src="http://runelegend.com/images/smilies/biggrin.gif">', '<IMG alt="Tongue" title="Tongue" src="http://runelegend.com/images/smilies/tongue.gif">', '<IMG alt="Rolleyes" title="Rolleyes" src="http://runelegend.com/images/smilies/rolleyes.gif">', '<IMG alt="Sad" title="Sad" src="http://runelegend.com/images/smilies/sad.gif">'); return str_ireplace($codes, $img, $value); } function bbcodes($value) { $value1 = htmlspecialchars($value); $bbcodes = array( '/\[url=(.*)\](.*)\[\/url\]/isU', '/\[b\](.*)\[\/b\]/isU', '/\[img\](.*)\[\/img\]/isU', '/\[u\](.*)\[\/u\]/isU', '/\[i\](.*)\[\/i\]/isU', '/\[url\](.*)\[\/url\]/isU', '/\[s\](.*)\[\/s\]/isU', '/\[color=(#?[a-z0-9]+)\](.*)\[\/color\]/isU', '/\[center\](.*)\[\/center\]/isU', '/\[big\](.*)\[\/big\]/isU', '/\[small\](.*)\[\/small\]/isU', ); $html = array( '<a class="hrefblack" href="$1">$2</a>', '<b>$1</b>', '<img src="$1">', '<u>$1</u>', '<i>$1</i>', '<a href="$1">$1</a>', '<s>$1</s>', '<div style="color: $1">$2</div>', '<div style="text-align: center">$1</div>', '<div style="font-size: 3em">$1</div>', '<div style="font-size: 0.8em">$1</div>', ); $result = preg_replace($bbcodes, $html, $value1); return $result; } /* if(isset($_SESSION['admin']) || isset($_SESSION['user'])) { if($news1 = mysql_query("SELECT * FROM ".$prefix."users WHERE uname='". $_SESSION['user'] ."'")) { if(mysql_num_rows($news1) > 0) { while($n = mysql_fetch_array($news1)) { if($n['banned'] == 1) { header("Location: logout.php"); } } } } } if($checkipban = mysql_query("SELECT * FROM ". $prefix ."ipban WHERE ip='". $_SERVER['REMOTE_ADDR'] ."'")) { if(mysql_num_rows($checkipban) > 0) { header("Location: ipbanned.php"); } }*/ ?> <?php function capitalizeFirstCharacter($value) { $capitalize = preg_replace('/[a-z]/ie', 'strtoupper($0);', $value, 1); return $capitalize; } ?> Whats in getuserinfo.php: <?php $result = mysql_query("SELECT * FROM main id=". $_SESSION['id']) or die(mysql_error()); $row = mysql_fetch_assoc($result); $acptheme = $row["acptheme"]; ?> Please Help. Quote Link to comment Share on other sites More sharing options...
coupe-r Posted September 6, 2010 Share Posted September 6, 2010 Could this be it? $result = mysql_query("SELECT * FROM main WHERE id='". $_SESSION['id']."'") or die(mysql_error()); You don't have a WHERE clause in your query. You also dont have proper quotes in your query. Quote Link to comment Share on other sites More sharing options...
Mod-Jay Posted September 6, 2010 Author Share Posted September 6, 2010 LOL OOOO Thank Quote Link to comment Share on other sites More sharing options...
objnoob Posted September 6, 2010 Share Posted September 6, 2010 You also dont have proper quotes in your query. This depends on the table's column data type. For numeric data types, single quotes are omitted. 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.