Jump to content

OneEyedWillie

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by OneEyedWillie

  1. You didn't use the variable $result after you assigned it.
  2. Hello, I am writing a CMS for a sports organization league. One of my pages grabs values from the database using only the current week. What I want to do is when the admin enters in a game date, I want it to automatically find the week number for the date they entered. I haven't been able to find anything online that works for me. Any help would be great! Thanks
  3. Disregard this... :\ I was uploading this onto my Linux box using the www-data user but root owned the file for whatever reason, so it just wasn't uploading. It works now.
  4. Hello, I've got what should be a simple solution here. I've tried many things but it just won't work for me. This is what I have. I've got a wysiwyg editor setup to write to a file called news.php. The file that has the editor is edit/index.php. It's just a simple textarea. The textarea is supposed to include news.php. For some reason, it won't let me include that file that is in a lower directory. The file that writes to news.php is called edit/write.php. edit/write.php doesn't write to news.php instead it writes to edit/news.php. The only reason I want to include the lower directory is so that I can put a .htaccess password protection on the edit directory. I'll include some code below. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> <head> <title>Editing News</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="nicEdit.js"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { nicEditors.allTextAreas() }); </script> <form method="post" action="write.php"> <p> <textarea name="content" style="width:100%;height:1000px;"><?php include '../news.php';?></textarea> <input type="submit" value="Save" /> </p> </form> </body> </html> <?php $File = "../news.php"; $Handle = fopen($File, 'w'); $Data = $_POST['content']; fwrite($Handle, $Data); fclose($Handle); header("Location: index.php"); ?> index.php is just a simple include news.php. Am I missing an easy step? Any help would be great!! Thanks!
  5. The reason that was coming up, is because you weren't using a valid email. I added php form validation to that page, so it shouldn't happen anymore.
  6. May I ask the extention of the email you user? ex: @gmail.com Sometimes it does that if you use a weird email.. If not, I'll look into it. Thanks
  7. Alright.. I think I fixed all the things you've mentioned. Firstly: I limited the birthday characters to only use 0-9, period, and the dash. For the slogan I added htmlentities(). So if someone does enter html it shows it, not executes it. For the mail I put in a character check to ensure that it follows the same rules as usernames. If that checks out good, then it uses mysql_num_rows to check for a user. If it returns 0, then it says there isn't a user by that name. If it returns 1, then it proceeds to send the message. Now that I think about it, I should add htmlentities() to the mail as well so people aren't sending each other random html. (Edit: It already has strip_tags()) Thanks for checking out my site!
  8. Hello all, Me and my friend are developing a browser based HTML/PHP game. It is called IsleWar and based off of Islandor. We currently have register, login, account management, profiles, ranking, and mail working. The next stages is to actually start on the game. I also have made an admin panel and a ban script. If you would like to test the username ban and try to get around it, the username is: TestBan password: testban Here is the website: http://www.islewar.us/ here is the URL containing my profile: http://www.islewar.us/verify.txt Please tell me everything you find. If it's easier for you, I installed a bug reporting script at http://www.islewar.us/bugs Thanks!!
  9. Personally, I like to have a seperate page for processing my information. It seems to help me stay away from errors. For example, you would have your register.html where your form is. In the <form> tag, put register-exec.php (for example), and have all your php there. Then if all looks good in the registration put: header("location: members.php"); Just my personal preference.
  10. Wow.. I figured it was something easy like that! Thanks for your guys help! It's greatly appreciated. I love this forum.. I always get quick responses. :3
  11. Well, I'm pretty sure I'm close here. I have a ranking system for a game that me and my friend are designing. What I've done here is get the data from the table and order it by score with the highest score at the top. This way I can automatically create a ranking based on the score. In the code there is a line that says: echo ''; there is where I need the number to be. Starting at 1 and going until there are no more rows to get. I tried using a while loop, but I had no luck. Hopefully someone here can help! Here's the code: <?php $query = "select * from gamedata ORDER BY gamedata . score DESC"; $result = mysql_query($query); $rank = mysql_num_rows($result); ?> </header> <h2>Rankings</h2> <div> <table width="100%"> <tr> <th align="left">Rank</th> <th align="left">Username</th> <th align="left">Score</th> </tr> <?php while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td>'; echo ''; echo '</td>'; echo '<td>'; echo '<form name=view method=get action=viewprofile.php>'; echo "<input type=hidden name=username value="; echo $row['username']; echo "/>"; echo "<a href=viewprofile.php?username="; echo $row['username']; echo ">"; echo $row['username']; echo "</a></td></form>"; echo '<td>'; echo $row['score']; echo '</td>'; echo '</tr>'; } ?> </table>
  12. Thanks!! That worked great! I can't even thank you enough. I just started learning PHP so my code sometimes gets a bit sloppy
  13. Hi, I wrote a login, register, and IP ban script. I now want to expand the IP ban to only a username ban. I setup the database, but I'm having troubles checking for the ban and the correct password. I want to verify the password before the user is shown the ban page. Here is my signin.php page <?php //Database Information $dbhost = "localhost"; $dbname = "islewar"; $dbuser = "islewar"; $dbpass = "***"; //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string(md5($_POST['password'])); $banquery = mysql_query("select * from users where username='$username' and password='$password'"); mysql_query("select * from bans where username='$username'"); $ban_exist = mysql_num_rows($banquery); $query = "select * from users where username='$username' and password='$password'"; $result = mysql_query($query); if ($ban_exist > 0){ include 'userban.html'; } elseif (mysql_num_rows($result) != 1) { include 'loginfail.php'; } else { $_SESSION['username'] = "$username"; include "members.php"; } ?> I read about a 'hack' to execute two mysql queries but that didn't do anything. Maybe someone has had a similar issue. Thanks
  14. Hi, I'm trying to create a page where we can remove bans from the MySQL database. I've come up with this so far, but need some help. <form method="post" action="viewbans.php" name="managebans"> <table width="100%" border="1"> <tr> <td>Remove?</td> <td>IP</td> <td>Username</td> <td>Reason</td> </tr> <?php mysql_connect("localhost", "islewar", "islewar") or die(mysql_error()); mysql_select_db("islewar") or die(mysql_error()); $result = mysql_query("select * from bans") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><input type=checkbox name=ban />"; echo "</td>"; echo "<td>"; echo $row['ip']; echo "</td><td>"; echo $row['username']; echo "</td><td>"; echo $row['reason']; echo "</td>"; echo "</tr>"; } ?> </table> <input type="submit" name="delete" value="Remove Bans" /> </form> It reads the data from the database and shows it on the screen correctly. I just can't get the checkboxes to delete when they are selected, Thanks
  15. Weird, there must be something wrong with either php or MySQL on my friends server. I was trying to use this on his server and was getting that error.. So I tried putting it on my server and it works great now. I'll have to let him know. Thanks for all your help!
  16. I used Notepad++ and cPanel and got the same error. In Notepad++ and CoffeeCup I don't see an option for ascii formatting. In cPanel I can choose ascii but when I save, it formats it back to utf-8. Is it possible it is doing that because of me just copying/pasting from the tutorial? If I typed it would it stop the errors?
  17. Hi, I am trying to use a tutorial to create a login/register script. I got the register working great and it writes to the db. My problem is with logging in. I get this error: Parse error: syntax error, unexpected T_STRING in C:\ROOT\wamp\www\IsleWar\login.php on line 19 This is line 19: $query = “select * from users where username=’$username’ and password=’$password’”; Full login.php: <?php //Database Information $dbhost = "localhost"; $dbname = "islewar"; $dbuser = "islewar"; $dbpass = "<censored password>"; //Connect to database mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = $_POST[‘username’]; $password = md5($_POST[‘password’]); $query = “select * from users where username=’$username’ and password=’$password’”; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = “Bad Login”; include “login.html”; } else { $_SESSION[‘username’] = “$username”; include “memberspage.php”; } ?> Anything anybody can do to help me would be great!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.