Jump to content

Kyza

Members
  • Posts

    4
  • Joined

  • Last visited

Kyza's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Kyza

    Error

    Hey,Im working on my site, and I keep getting this error:Parse error: syntax error, unexpected T_FUNCTION in C:\wamp\www\test\a+BB\global.php on line 6The code im using is:<?php$con = mysql_connect("localhost" , "name" ,"password") or die(mysql_error());mysql_select_db("database name", $con)function mss($value){ return mysql_real_escape_string(trim(strip_tags($value)));}function topic_go($id){ echo "<meta http-equiv=\"refresh\" content=\"0;url=index.php?act=topic&id=".$id."\">";}function s($value){ return stripslashes($value);}function topic($input){ // bbcode return nl2br(strip_tags(stripslashes(htmlentities(htmlspecialchars($input)))));}function uid($uid, $link = FALSE){ $sql = "SELECT username FROM `users` WHERE `id`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ return "Invalid User"; }else { $row = mysql_fetch_assoc($res); if(!$link){ return $row['username']; }else { return "<a href=\"/tuts/forum/index.php?act=profile&id=".$uid."\">".$row['username']."</a>"; } }}function post($uid){ $sql = "SELECT * FROM `forum_replies` WHERE `uid`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); return mysql_num_rows($res);}function isa($uid){ $sql = "SELECT admin FROM `users` WHERE `id`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); return $row['admin'];}?>
  2. Kyza

    Parse error

    Hey, im curretly working on a admin page, I have done this code: <?php//session start and get variablesession_start();$user = $_SESSION['user'];//connect$connect = mysql_connect("localhost" , "root" ,"");mysql_select_db("netbb");//query$get = mysql_query("SELECT * FROM users WHERE username='$users'")while ($row = mysql_fetch_assoc($get)){ $admin = $row['admin'];}echo $admindie();?> I keep getting this error Parse error: parse error in C:\wamp\www\web\admin.php on line 13 Can someone please help.
  3. Kyza

    Battle System?

    Ok, I am working on a MMORPG, a 2d one, I have been looking for a php script that will allow the avatar to move around, simlar to : http://pokemoninfinity.comAll help will be appriciatedBrad
  4. Hey Im getting this error:Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/brad/public_html/index.php on line 66Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/brad/public_html/index.php on line 66Access denied for user 'nobody'@'localhost' (using password: NO)It seems its in the index.php file, here is the code, im not sure what to change, please help:<?phpob_start();session_start();include "./global.php";$action = $_GET['act'];$actions_array = array('forum','create','topic','reply','mod');?><html> <head> <title>Forum</title> <link rel="stylesheet" type="text/css" href="./style.css"> <script language="Javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to logout?"); if(agree){ return true ; }else { return false ; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if($_SESSION['uid']){ $sql = "SELECT * FROM `users` WHERE `id`='".$_SESSION['uid']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; }else { $row = mysql_fetch_assoc($res); echo "Welcome back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['username']."</a>! <a href=\"./logout.php\" onClick=\"return confirmLogout()\">Logout</a>\n"; echo "<br>\n"; echo "<a href=\"./index.php\">Forum Index</a>\n"; if($row['admin'] == '1'){ echo " | <a href=\"./admin.php\">Administrative Section</a>\n"; } } }else { echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } $admin_user_level = $row['admin']; ?> </div> <div id="content"> <?php if(!$action || !in_array($action,$actions_array)){ $sql1 = "SELECT * FROM `forum_cats` WHERE `admin` < ".$row['admin']."+1"; $res1 = mysql_query($sql1) or die(mysql_error()); $i=1; while($row2 = mysql_fetch_assoc($res1)){ echo "<div id=\"fcontent\">\n"; echo " <div class=\"header\" id=\"header_".$i."\" onMouseOver=\"this.className='headerb'\" onMouseOut=\"this.className='header'\">".$row2['name']."</div>\n"; $sql2 = "SELECT * FROM `forum_sub_cats` WHERE `cid`='".$row2['id']."' AND `admin` < ".$row['admin']."+1"; $res2 = mysql_query($sql2) or die(mysql_error()); while($row3 = mysql_fetch_assoc($res2)){ echo " <div id=\"content\">\n"; echo " <a href=\"./index.php?act=forum&id=".$row3['id']."\">".$row3['name']."</a><br>\n"; echo " " . $row3['desc'] . "\n"; echo " </div>\n"; } echo "</div>\n"; $i++; } }else { if($action == 'forum'){ include "./includes/forum.php"; } if($action == 'create'){ if(!$_SESSION['uid']){ header("Location: login.php"); }else { include "./includes/create.php"; } } if($action == 'topic'){ include "./includes/topic.php"; } if($action == 'reply'){ if(!$_SESSION['uid']){ header("Location; login.php"); }else { include "./includes/reply.php"; } } if($action == 'mod'){ if(!$_SESSION['uid']){ header("Location; login.php"); }else { include "./includes/mod.php"; } } } ?> </div> </div> </center> </body></html><?phpob_end_flush();?>
×
×
  • Create New...