Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by burtybob

  1. ternary operation is far better if you are only comparing one value. You'd use switch if you are going to be comparing multiple values. oh... Ok thanks for that little bit of information i will remember that now!
  2. just use switch seems like its the easiest and least complicated way of doing it!
  3. You can use switch as well, http://us2.php.net/switch
  4. ok thank you i will check those now i didnt think of this! The reason that the others might not be wokrign is that the code in my prevoius post is editeed to my needs and there was more so i will probably need to alter the others now!
  5. Hi i am editing a game from someone and i have been editing the login poage for a whil now and i have one problem, The page just redirects to the index.php page please can you look at my code i have looked several time but i have always been tired from school or work, so it might be that i missed something. <!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" xml:lang="en" lang="en"> <head> <title>Lealta alla Famiglia :: Login</title> <link rel="stylesheet" type="text/css" href="main.css" /> <script language="JavaScript" type="text/javascript"> function doFocus() { document.myform.login.focus(); } </script> </head> <body onload="doFocus();" onmouseover="window.status='Welcome to Lealta alla Famiglia';return true;" onmouseout="window.status='';return true;"> <br /> <div align="center"> <a href="home.php"><img src="gfx/titlepic.jpg" alt="Lealta alla Famiglia" width="600" height="80" border="0" /></a> <br /><br /><?=$message?><br /><br /> <form action="test1.php" method="post"> <table cellspacing="0" cellpadding="0" class="tblout"> <tr class="tblin"><td class="tblhdr" colspan="2">L o g i n</td></tr> <tr class="tblin"><td class="btext">Login Name</td><td class="btext"><input type="text" name="login" size="20" maxlength="20" class="textbox" /></td></tr> <tr class="tblin"><td class="btext">Password</td> <td class="btext"><input type="password" name="pass" size="20" maxlength="20" class="textbox" /></td> </tr> <tr class="tblin"><td class="btextc" colspan="2"><font class="warn">NOTE:</font> Login name and<br />password are case sensitive</td></tr> <tr class="tblin"><td class="btextc" colspan="2"><input type="submit" name="sublogin" value=" Login " class="button" /></td></tr> </table> <?php if ($helpmsg==1) { ?> <br /> <table width="500" cellspacing="0" cellpadding="0" class="tblout"> <tr class="tblin"><td class="tblhdr" colspan="2">Error!</td></tr> <tr class="tblin"><td class="btext">You cannot be logged in because the account has not yet been activated.<br /><br />Please check the email you received when you registered for the activation link. If you are unable to find it check your spam inbox as they sometimes get placed in there.</td></tr> <tr class="tblin"><td class="btextc" colspan="2"><input type="submit" name="subresend" value=" Resend Email " class="button" /></td></tr> </table> <?php } ?> </form> Users online: <?=$onlinecount?><br /><br /><br /> <a href="register.php">register</a> - <a href="lostpassword.php">lost password</a> - <a href="screenshots.php">screenshots</a> </div> </body> </html> <?php $username="root"; $password="benburt"; $database="lealta"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM members"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $login1 = $_POST['login']; $pass1 = $_POST['pass']; $login2 = mysql_result($result,$i,"loginname"); $pass2 = mysql_result($result,$i,"password"); if ($login1==$login2&&$pass1==$pass2) { $plalive = mysql_result($result,$i,"alive"); $pluserid = mysql_result($result,$i,"userid"); $placcesslevel = mysql_result($result,$i,"accesslevel"); $pldisplayname = mysql_result($result, $i , "displayname"); /****************************** ** SEE IF THE PLAYER IS DEAD ** ******************************/ if ($plalive==0) { $_SESSION['c_userid']=$pluserid; header("Location: killed.php"); exit; } /******************************** ** SEE IF THE PLAYER IS BANNED ** ********************************/ $checkban=mysql_fetch_array(mysql_query("SELECT * FROM banned WHERE `displayname`='$pldisplayname'")); $banid=$checkban[banid]; $banexpire=$checkban[expire]; if (!empty($banned)) { $_SESSION['c_userid']=$pluserid; $nowtime=time(); //Need to add code here to unban if timer has expired and also to check for infinite bans header("Location: banned.php"); exit; } $nowtime=time(); /************************************************************* ** UPDATE THE RECORD OF PLAYER'S LAST DATE/TIME OF ACTIVITY ** *************************************************************/ mysql_query("UPDATE members SET `dtlastactive`=NOW() WHERE `displayname`='$pldisplayname'"); switch ($placcesslevel) { case 0: //Account suspended $_SESSION['c_userid']=$pluserid; header("Location: suspended.php"); exit;break; case 1: //Player $_SESSION['c_userid']=$pluserid; header("Location: news.php"); exit;break; case 2: //Help desk operator $_SESSION['c_userid']=$pluserid; header("Location: news.php"); exit;break; case 3: //Moderator $_SESSION['c_userid']=$pluserid; header("Location: news.php"); exit;break; case 4: //Head moderator $_SESSION['c_userid']=$pluserid; header("Location: news.php"); exit;break; case 5: //Admin $_SESSION['c_userid']=$pluserid; header("Location: news.php"); exit;break; default: $message="An error has occured and you can't be logged on - please contact admin"; } } $i++; } ?>
  6. is there scripts that mean you can put a download link and an edit link onto a page?
  7. Is it possible to add new users to ftp, using a script in php?
  8. I am writing here to see what others thought about it. I might just have to get the good old pen and paper out and do exactly what you said or send an e-mail to some of the breakfast time show (<--- yeah i know sad isn't it).
  9. yeah but we the minority can change that so that the majority learns the correct terms! 1 by one we can change it around. I would just like to see the MEDIA using the correct terms then the majority would know the correct!
  10. i could break down CRackers into 2 parts here HACKERS / \ CR=criminal H=Helpfull / \ CRackers Hackers / \ Mailicous coders etc. Network admins
  11. Well i am doing a 4 hour a week course on hardware installation so i think i might go and have a look at linux
  12. Not really cos as azu said one is a criminal and one is a really good person such as an administrator of a network.
  13. personally i would say a bus! But thanks for the tips the main things i would be doing is: 1) surfing the net 2) playing php games (on the net) 3) making and (hopefully) running php games. 4) a couple years down the line C/C++ So with the new info is it a bit easier on which to use for those although reading the post that answered me i would say windows.
  14. i am interested to know i am not new to computers yet i am only a little experienced which would be better for me?
  15. i am ben from dorset in the uk and i am 15 know html about 70% perfect and am learning php getting good at it. Love playing and help code online games and know a little C but dont plan on learning anymore yet untill i am as good in php as i am in html. Also i have never met a female coder but they must exist.
  16. True i mean the news started using it in the bad way so therefore people saw hackers as bad, however now it is not the case as much as more and more people have started learning the difference. I wish the media would start doing the same if more people took the following it should sort out most of the errors that have been made: 1)Hackers are good they help make the internet and fix bugs and other stuff in programs and games 2)Crackers try to gain unauthorised access to password protected sites for malicious uses 3) Script kiddies use other peoples programs (at times programs created by hackers for a good use) and basically do the same as a cracker However script kiddies are probably the worst as quite a few crackers will create their own programs for malicious use. I think that if we all point this out to everyone we can we might be able to get the original meanings back which will be good as we can once again become proud of being a hacker and disgusted at crackers/script kiddies Please if you agree post or if not post and say why not.
  17. OK has anyone noticed that us HACKERS are getting all the blame for online credit card fraud etc? When in fact it is CRACKERS not HACKERS does anyone find this annoying you say to someone that you would like to be or are a hacker and they go all cold and nasty because of the way in which they have heard it? Most people think that hackers are bad people but we are not are we! hackers are good and crackers bad now anyone who says otherwise please post or post in agreement but make sure you post whether you agree or disagree with me!
  18. just glancing at this without knowing much about GET it looks right as long as i remember to connect to database first which is easy enough so i will try this now! This worked thank you!
  19. I have the database and do i have to learn sql cant i just use PHPmyadmin or is there some other reason? I am creating my own game and i am doing it in this way to learn PHP as if i didn't learn PHP while using it i wouldn't be bothered to learn it at all, i plan to completely re code my game once i have learned PHP properly so i have thought about getting a pre-made one but decided against it as i have stated.
  20. I posted this yesterday but then when i re read it i found it was not a very good question and example so i have reposted it with more information! I would like to use GET to make a profile.php and then get the data from the database about each user like online rpgs do they use a page like http://www.game.com/profile.php?id=usersid The page then shows any items that user has bought in the game! for example http://sigil.outwar.com/profile.php?id=1 and then it goes up like http://sigil.outwar.com/profile.php?id=2 and so on Does anyone know how to do this?
  21. using get to make a profile.php and then get the data from the database about each user like a lot of online rpgs do some dont but most use a page like http://www.game.com/profile.php?id=usersid The page then shows any items that user has bought in the game!
  22. i have tryed the code and it works thank you i will now somehow make a function to some how stop injection if this is possible. Is there anyway to do it with a profile page sort of thing? like Online rpg's do?
  23. ok thanks frost i was trying it to work out how get works, when i come to doing the site i will not use the include but i am atm just trying to understand and get it working. Also is there anyway that using include in that way i could use a function to protect myself against script kiddies? I will do a post later today to tell if i got it working or not.
  24. This is a basic login script it might need a minor edit to make it work for you in the way you want but that should mean just basic php knowledge. LOGIN FORM <html> <body><form action="welcome.php" method="post"><br> Username: <input type="text" name="username" /><br> Password: <input type="password" name="password" /><br> <input type="submit" /> </form></body> </html> LOGIN CHECK AGAINST DATABASE <?php include('config.php'); mysql_connect($database,$username,$password); @mysql_select_db(contacts) or die( "Unable to select database"); $query="SELECT * FROM login"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $user=mysql_result($result,$i,"Username"); $pass=mysql_result($result,$i,"Password"); $location=mysql_result($result,$i,"Location"); $user2 = $_POST['username']; $pass2 = $_POST['password']; if ($user == $user2 && $pass == $pass2) { echo "<a href=$location>Your Profile</a>"; } elseif ($user != $user2 && $pass != $pass2) { echo "incorrect username and password"; }else { echo "wah me not pingu"; } ?> LOGIN CONFIG FILE <?php //config.php $database = "your database"; $username = "database username"; $password = "database password"; ?>
×
×
  • 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.