-
Posts
1,686 -
Joined
-
Last visited
Never
Everything posted by Lamez
-
fixed it
-
ya, just did, and I get all my variables.
-
gosh I see I for got a "." in my query, I feel retarted. so I fixed that, now I am getting this error here: 98 & 99 <?php mysql_query($query, ACC_NAME); mysql_close(ACC_NAME); ?> they are defined in my constants file. here is my connection file <?php include_once("constants.php"); $connection_w = mysql_connect(WRLD_SERVER, WRLD_USER, WRLD_PASS); mysql_select_db(WRLD_NAME, $connection_w) or die(mysql_error()); $connection_a = mysql_connect(ACC_SERVER, ACC_USER, ACC_PASS); mysql_select_db(ACC_NAME, $connection_a) or die(mysql_error()); ?>
-
This is the first time I have ever seen an error like this one. Please tell me how to fix it line 96 is where $query starts. <?php if ($_SESSION['regsuccess'] = true){ $query = "INSERT INTO `accounts` (`login`,`password`, `lastip`, `email`, `flags`) VALUES ('".$_POST['user']."', '".$_POST['pass']."', '".$_SERVER['REMOTE_ADDR']."', '".$_POST['email']"', '".$_POST['type']."')"; mysql_query($query, ACC_NAME); mysql_close(ACC_NAME); } ?> thanks!
-
[SOLVED] Need Fresh pair of Eyes - Should be easy.
Lamez replied to Lamez's topic in PHP Coding Help
Hey it worked, I see what you did with the code. Thank you so much -
[SOLVED] Need Fresh pair of Eyes - Should be easy.
Lamez replied to Lamez's topic in PHP Coding Help
man I am still getting the same error as above. -
[SOLVED] Need Fresh pair of Eyes - Should be easy.
Lamez replied to Lamez's topic in PHP Coding Help
well If I use your code I get a whole new error: <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); } else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action="?cmd=check"> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action="?cmd=ask"> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> line 99: I do not understand why it is doing this. -
I am sorry if I am wasting a thread on this, but I cannot found how to fix this. I have been lookin at this for a while now, and try to remake it, but still need some help here is the error: code: <?php ob_start(); $path = "../../"; $title = "Update Home"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $getlink = $_GET["cmd"]; if ($getlink == "yes") { if ($dele !== (md5("yes"))){ header('Location: del_us.php'); }else{ $results = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($results)){ $user = $row['username']; $lvl = $row['userlevel']; if ($lvl == ('1')){ mysql_query("DELETE FROM `users` WHERE `username` = '$user'"); mysql_query("DELETE FROM `userpoints` WHERE `username` = '$user'"); $_SESSION['del_message'] = $user.' has been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "check") { $ans = $_POST['ans']; if ($ans == ("yes")){ header('Location: ?cmd=dele'); $dele = md5("yes"); } if ($ans == ("no")){ $_SESSION['del_message'] = $user.' has not been deleted.'; header('Location: del_us.php'); } } elseif ($getlink == "ask") { if (!isset($_POST['ask'])){ header('Location: del_us.php'); exit; } ?> <form id="form1" name="form1" method="post" action="?cmd=check"> <table width="100%" border="0"> <tr> <td width="29%">Are you sure you want to delete <?php echo $_POST['user']; ?></td> <td width="71%"><label> <input type="submit" name="yes" id="ans" value="Yes!" /> <input type="submit" name="no" id="ans" value="No!" /> </label></td> </tr> </table> </form> <?php } else { ?> <p class="header">Delete Users</p> <p class="maintext"> <?php echo $_SESSION['del_message']; ?> <br /> <form id="us_lvl" name="us_lvl" method="post" action="?cmd=ask"> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php $q = mysql_query("SELECT * FROM `users`"); while($row = mysql_fetch_array($q)); $usn = $row['username']; $lvl = $row['userlevel']; //$user_ is defined in head.php as logged in username. if ($usn !== ($user_)){ if ($lvl !== ('9')){ echo '<option value="'.$usn.'">'.$usn.'</option>'; } } } ?> </select> </label></td> <td width="14%"><label> <input type="submit" name="ask" id="ask" value="Delete" /> </label></td> <td width="66%"><label></label></td> </tr> </table> </form> </p> <?php } }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> line 26:
-
gosh I am sorry, I must have over read that part. I did overwrite the variable $username, I changed it to $usn, and it works fine now. Thank you for your help. It takes a lot of patience to put of with me -Lamez
-
you know what is funny, when I remove the query, and refresh the page, I do not get logged out. But when I put the query back, I get logged out. Why?
-
lol I am sorry about my choice of words, when I say something like that, I am sure that they are all intact. Thank you for your response. I am not getting any errors. Also it is not just when I refresh it is when I browse to any page that requires a login. I will look harder.
-
I did var_dump on a page that works, and I get the same variables ya it is a function.
-
I am pretty sure all the variables are there.
-
well I did var dump, and I get this: everything looks to be intact
-
it is in the include in head.php, that should not be the problem though, because one of my other pages that work fine, are structured like this one. example: <?php ob_start(); $path = "../../"; $title = "Ban\UnBan Users"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $ban = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '0' and `userlevel` = '1'"); $un = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '1'"); if (isset($_POST['ban'])){ if (isset($_POST['user'])){ $user = $_POST['user']; mysql_query("UPDATE `users` SET `ban`='1' WHERE `username`='$user'")or die(mysql_error()); $_SESSION['message'] = $user." has been banned"; header('Location: ban_us.php'); } } if (isset($_POST['un_ban'])){ if (isset($_POST['ban_user'])){ $banuser = $_POST['ban_user']; mysql_query("UPDATE `users` SET `ban`='0' WHERE `username`='$banuser'")or die(mysql_error()); $_SESSION['message'] = $banuser." has been unbanned"; header('Location: ban_us.php'); } } ?> <p class="header">Ban\UnBan Users</p> <p class="maintext"> <?php echo $_SESSION['message']; ?> <br /> <form id="ban" name="ban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">UnBanned</td> <td width="13%"><label> <select name="user" id="user"> <?php while($row = mysql_fetch_array($ban)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="ban" id="ban" value="Ban User" /> </label></td> </tr> </table> </form> <br /> <form id="unban" name="unban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">Banned</td> <td width="13%"><label> <select name="ban_user" id="ban_user"> <?php while($row = mysql_fetch_array($un)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="un_ban" id="un_ban" value="unBan User" /> </label></td> </tr> </table> </form> </p> <?php }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?> This page works great
-
My page I just made keeps logging me out after I refresh, but when I browse to another page I made, I do not get logged out. They are both base on the same code structure. Is there anything in my code below that would be the reason why I get logged out? <?php ob_start(); $path = "../../"; $title = "Change User Level"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $q = mysql_query("SELECT * FROM `users` ORDER BY `userlevel` DESC"); ?> <p class="header">Change User Level</p> <p class="maintext"> <form id="us_lvl" name="us_lvl" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">User List</td> <td width="13%"><label> <select name="user" id="user"> <?php while($row = mysql_fetch_array($q)){ $lvl = $row['userlevel']; $username = $row['username']; if ($lvl == ('9')){ $lvl = "Admin"; }else{ $lvl = "Member"; } //$user_ is defined in head.php as logged in username. if ($username !== ($user_)){ echo '<option value="'.$username.'">'.$username.' ('.$lvl.')</option>'; } } ?> </select> </label></td> <td width="14%"><label> <input type="radio" name="lvl" id="radio" value="9" checked> </label> Admin <label> <input type="radio" name="lvl" id="radio2" value="1" /> </label> Member</td> <td width="66%"><label> <input type="submit" name="ch_lvl" id="ch_lvl" value="Change Level" /> </label></td> </tr> </table> </form> </p> <?php }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?>
-
thanks for suggesting sessions variables, I got it to work just fine now. <?php ob_start(); $path = "../../"; $title = "Ban Users"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $ban = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '0' and `userlevel` = '1'"); $un = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '1'"); if (isset($_POST['ban'])){ if (isset($_POST['user'])){ $user = $_POST['user']; mysql_query("UPDATE `users` SET `ban`='1' WHERE `username`='$user'")or die(mysql_error()); $_SESSION['message'] = $user." has been banned"; header('Location: ban_us.php'); } } if (isset($_POST['un_ban'])){ if (isset($_POST['ban_user'])){ $banuser = $_POST['ban_user']; mysql_query("UPDATE `users` SET `ban`='0' WHERE `username`='$banuser'")or die(mysql_error()); $_SESSION['message'] = $banuser." has been unbanned"; header('Location: ban_us.php'); } } ?> <p class="header">Ban Users</p> <p class="maintext"> <?php echo $_SESSION['message']; ?> <br /> <form id="ban" name="ban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">UnBanned</td> <td width="13%"><label> <select name="user" id="user"> <?php while($row = mysql_fetch_array($ban)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="ban" id="ban" value="Ban User" /> </label></td> </tr> </table> </form> <br /> <form id="unban" name="unban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">Banned</td> <td width="13%"><label> <select name="ban_user" id="ban_user"> <?php while($row = mysql_fetch_array($un)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="un_ban" id="un_ban" value="unBan User" /> </label></td> </tr> </table> </form> </p> <?php }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?>
-
well I could use sessions, they are all on the same page. I thought there could be a better way to do this. <?php ob_start(); $path = "../../"; $title = "Ban Users"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $ban = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '0' and `userlevel` = '1'"); $un = mysql_query("SELECT `username` FROM `users` WHERE `ban` = '1'"); if (isset($_POST['ban'])){ if (isset($_POST['user'])){ $user = $_POST['user']; mysql_query("UPDATE `users` SET `ban`='1' WHERE `username`='$user'")or die(mysql_error()); $message = $user." has been banned"; } } if (isset($_POST['un_ban'])){ if (isset($_POST['ban_user'])){ $banuser = $_POST['ban_user']; mysql_query("UPDATE `users` SET `ban`='0' WHERE `username`='$banuser'")or die(mysql_error()); $message = $banuser." has been unbanned"; } } ?> <p class="header">Ban Users</p> <p class="maintext"> <?php echo $message; ?> <br /> <form id="ban" name="ban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">Users List</td> <td width="13%"><label> <select name="user" id="user"> <?php while($row = mysql_fetch_array($ban)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="ban" id="ban" value="Ban User" /> </label></td> </tr> </table> </form> <br /> <form id="unban" name="unban" method="post" action=""> <table width="100%" border="0"> <tr> <td width="7%">Users List</td> <td width="13%"><label> <select name="ban_user" id="ban_user"> <?php while($row = mysql_fetch_array($un)){ echo '<option value="'.$row['username'].'">'.$row['username'].'</option>'; } ?> </select> </label></td> <td width="80%"><label> <input type="submit" name="un_ban" id="un_ban" value="unBan User" /> </label></td> </tr> </table> </form> </p> <?php }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?>
-
sounds like you might have to make a function.
-
Is there a way to refresh the page with php, and still keep the variables in tact?
-
That is all defined in a include page in the head. That is not the problem because I have that on my most of my pages. I am not too sure what it is.
-
Nothing in my code is being echoed out. I have no clue why. My head shows, but not my html or my footer. It works on other pages of my website. Here is the code: <?php ob_start(); $path = "../../"; $title = "Change Marquee"; $rank = "yes"; include ($path."main/include/cons/head.php"); if($session->logged_in){ if($session->isAdmin()){ $q = mysql_query("SELECT * FROM `marquee`"); $row = mysql_fetch_array($q) or die(mysql_error()); $num_rows = mysql_num_rows($q); if($num_rows < 1){ $auto = '1'; }else{ $auto = $row['auto']; } $type = $row['num']; $id = $row['id']; $basket = $row['mar_basket']; $foot = $row['mar_foot']; $nu = $row['mar_nu']; $custom = $row['mar_custom']; if ($auto == ('1')){ $q = mysql_query("SELECT * FROM `site_status`"); $row = mysql_fetch_array($q); $stat = $row['status']; //0 nutral, 1 = basket, 2 = football $auto_yes = "checked"; $auto_no = ""; if ($type == ('3')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = ""; $mar_custom = "checked"; $mar_none = ""; } if ($type == ('4')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = ""; $mar_custom = ""; $mar_none = "checked"; } if ($stat == ('0')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = "checked"; $mar_custom = ""; $mar_none = ""; } if ($stat == ('1')){ $mar_basket = "checked"; $mar_foot = ""; $mar_nu = ""; $mar_custom = ""; $mar_none = ""; } if ($stat == ('2')){ $mar_basket = ""; $mar_foot = "checked"; $mar_nu = ""; $mar_custom = ""; $mar_none = ""; } }else{ $auto_no = "checked"; //0 = nutral, 1 = basket, 2 = football, 3 = custom, 4 = none if ($type == ('0')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = "checked"; $mar_custom = ""; $mar_none = ""; } if ($type == ('1')){ $mar_basket = "checked"; $mar_foot = ""; $mar_nu = ""; $mar_custom = ""; $mar_none = ""; } if ($type == ('2')){ $mar_basket = ""; $mar_foot = "checked"; $mar_nu = ""; $mar_custom = ""; $mar_none = ""; } if ($type == ('3')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = ""; $mar_custom = "checked"; $mar_none = ""; } if ($type == ('4')){ $mar_basket = ""; $mar_foot = ""; $mar_nu = ""; $mar_custom = ""; $mar_none = "checked"; } } ?> <p class="header">Change Marquee</p> <p class="maintext"> <form id="form1" name="form1" method="post" action="ch_mar_up.php"> <table width="100%" border="0"> <tr> <td>Update Automatically</td> <td width="7%"> <label> <input type="radio" name="auto" id="radio5" value="yes" <?php echo $auto_yes; ?>> </label> Yes</td> <td width="76%"> <label> <input type="radio" name="auto" id="radio6" value="no" <?php echo $auto_no; ?>> </label> No</td> </tr> <tr> <td width="17%"><label> <input type="radio" name="mar" id="radio" value="bakset" <?php echo $mar_basket; ?>> Basketball</label></td> <td colspan="2"><label> <input name="basket" type="text" id="basket" value="<?php echo $basket; ?>" size="150" /> </label></td> </tr> <tr> <td><label> <input type="radio" name="mar" id="radio2" value="foot" <?php echo $mar_foot; ?>> Football</label></td> <td colspan="2"><input name="foot" type="text" id="foot" value="<?php echo $foot; ?>" size="150" /></td> </tr> <tr> <td><label> <input type="radio" name="mar" id="radio7" value="nu" <?php echo $mar_nu; ?>> Neutral </label></td> <td colspan="2"><input name="nu" type="text" id="nu" value="<?php echo $nu; ?>" size="150" /></td> </tr> <tr> <td><label> <input type="radio" name="mar" id="radio3" value="custom" <?php echo $mar_custom; ?>> Custom</label></td> <td colspan="2"><input name="custom" type="text" id="custom" value="<?php echo $custom; ?>" size="150" /></td> </tr> <tr> <td><label> <input type="radio" name="mar" id="radio4" value="none" <?php echo $mar_none; ?>> None</label></td> <td colspan="2"><label> <input type="submit" name="button" id="button" value="Update" /> </label></td> </tr> </table> </form> </p> <?php }else{ header('Location: '.$path.'index.php'); } }else{ header('Location: '.$path.'index.php'); } include ($path."main/include/cons/foot.php"); ?>
-
view your source code, and see what image it is trying to show.
-
lol I am getting better with php
-
yes xls files can pose a threat, because you can program VB express, but these files need to be executed to be harmful. Are you trying to protect you or your users? Because if you are trying to protect your server, it will be ok from files like xls, or something like that.