
PHPDevil
Members-
Posts
38 -
Joined
-
Last visited
PHPDevil's Achievements
Newbie (1/14)
0
Reputation
-
Hi again. Just having a mysqli issue. First time using databases and tables. I have a table with PlayerIDs and Username as the title. Table itself is called users When a person logs in i create a session variable for ID $_SESSION['ID'] = $id; Now in the game I want to retrieve that username so I'm able to display it. I don't want to use the session variable to do this as i will be reusing that username constantly so i would want it stored in a variable. $data = mysqli_query($mysqli, "SELECT * FROM userss WHERE PlayerIDs =" . $_SESSION['ID']); $info = mysqli_fetch_array( $data ); The above is my sql that im using. And to ouput the result I use echo $info['Username']; Yet nothing gets displayed. Is there a way where I can call all this data easily and display it easily. Like for example if i wanted to display there level aswell. So in other words control what is displayed? Thanks
-
Hi guys, I just wanted to see your views on whether or not to add a recaptcha on a login page. Reason behind this is mostly to reduce brute force (hopefully)
-
Thanks for your help sniko (i like that name...reminds me of snickers! :P) Yeah I should have read the manual, it was because i had "requre header.php" at the top so i just moved that down. Thanks for your time!
-
I didn't think this was suppose to be difficult but i've made a mess of something which I think is straight forward O,o Issue is on my login page, if the username and password is right, that user doesn't get redirected. O,o if ($hash == $dbpass) { $error_string .= 'Authentication succeeded'; $_SESSION['login'] = "1"; $_SESSION['username'] = $username; $_SESSION['email'] = $email; $_SESSION['ID'] = $id; header('Location: loggedin.php'); } I do have session_start(); at the top of my login page. The loggedin page has just this <?php session_start(); require "corefolder/globe.php"; if(empty($_SESSION['login']) || empty($_SESSION['username']) || empty($_SESSION['email']) || empty($_SESSION['ID'])) { header('location: login.php'); die(); } ?> globe.php is just my database connection. thats fine Should mention that i did comment out the if statement in loggedin for debugging but still no luck
-
Thanks for that Dayo! Probably do something like this $salt='tv7f59r6ti'; $salt2='dfsdsfsda'; $hash = hash('ripemd160' , $salt.$pass1.$salt2);
-
For obvious reasons, ive moved away from MD5. I just had some questions. What I am using now is: $hash = hash('ripemd160' , $pass1); As far as im concerned, there hasn't been a issue with ripemd160....I hope! I was wondering, I wanted to add a salt for a better piece of mind....looked at the manual for php hash function but it doesn't show how i can implement it in the parameters. So my question is how would I achieve this and what is the use of MD5 nowadays
-
Hey guys, basically trying to use PHPASS for hashing passwords. I got a issue with my login page where I have this code when it comes to authentication if( $page_mode == 'Login' ) { require "globe.php"; //db connect $username = htmlentities($_POST['username']); $username = mysqli_real_escape_string($mysqli, $username); $password =mysqli_real_escape_string ($mysqli, $_POST['password']); $query = mysqli_query($mysqli, "SELECT * FROM Persons WHERE Username = '$username'"); $row = mysqli_fetch_assoc($query); $numrows = mysqli_num_rows($query); $dbuser = $row['Username']; $dbpass = $row['Password']; $hash_cost_log2 = 8; // Do we require the hashes to be portable to older systems (less secure)? $hash_portable = FALSE; $hasher = new PasswordHash($hash_cost_log2, $hash_portable); $hash = $hasher->HashPassword($password); if( ($username == '') || ($password == '') ) { $error_string .= '<font color=red>You have left either the username or password field blank!</font>'; } else if ($numrows == 1) { if ($hasher->CheckPassword($dbpass, $hash)) { $error_string .= 'Authentication succeeded'; echo $password; echo "<br />"; echo $hash; echo "<Br />"; echo $dbpass; } else { $error_string .= 'Authentication failed'; echo $password; echo "<br />"; echo $hash; echo "<Br />"; echo $dbpass; } } else { $error_string .= '<font color=red>No username can be found! (2)</font>'; } } Ive tried debugging it but can only see that both the dbpassword and the user entered password won't match. For example.... When i typed in the CORRECT password i get the user entered password after hashed: $P$BsFbIyt3TqmiENpkiiFmanysGL3sqy/ and the database password which is correct: $P$BeVDgwR8j3fCeB2AiziyqsXJHNHdJt. Its driving me mad :(
-
Hey, back again :) Just wondering if I had a div like this .example { border-style: solid; color: red; } now as you can see around the div theres a red border. Is it possible to have another border around that red border without having to make another div tag. Because what I have at the momment is a black box, red border but i want another black border around it as it might look nice!
-
I got a issue here in whcih I've purchased Ravans mafia game script but when I've been looking around it seems its a copy of mccodes and for me to use Ravans, I need to buy a MCCODES licenes? At the momment I'm refusing to place the game online, purely due to the fact that I don't want to steal someones work. I've tried contacting Ravan over this but haven't recieved a response. Could anyone shed some light for me and tell me where on earth I stand. Thanks
-
Update: Thanks for the support illusions. I managed to find the issue and it was due to the fact that all i needed to do was update the navigation bar and set the z index to 1.
-
Thanks for the reply. The final /DIV was a bit further down so didn't really count it. Still tried anyway but it resulted in the layout being distorted.
-
Hi guys, I have this extract from my code .bg { width: 100%; height: 100%; attachment:fixed; position: absolute; top: 0; left: 0; z-index: -5000; } body { margin: 0 auto; background-color: black; background-attachment: fixed; } div.container { margin: 0 auto; width: 1000px; } #nav { width: 100%; position:fixed; float: left; margin: 0 0 0 0; padding: 0; list-style: none; background-color: #000000; } #nav li { float: left; } #nav li a { display: block; padding: 8px 15px; text-decoration: none; font-weight: bold; color: #069; border-right: 1px solid #333; } #nav li a:hover { color: #c00; background-color: #000; } .bannerimage { position:relative; float:left; /* optional */ width:1000px; height:200px; } .bannerimage .text { position:absolute; top:65px; /* in conjunction with left property, decides the text position */ left:32px; width:193px; /* optional, though better have one */ color:#FF8000; height: 146px; } <!-- Navigation --> <ul id='nav'> <li><a href='login.php'>Home </a></li> <li><a href='register.php'>Mailbox (0)</a></li> <li><a href='forgotpassword.php'>Events (0)</a></li> <li><a href='register.php'>Inventory</a></li> <li><a href='forgotpassword.php'>City</a></li> <li><a href='forgotpassword.php'>Chat (0)</a></li> <li><a href='register.php'>Missions</a></li> <li><a href='contact.php'>Education</a></li> <li><a href='t&c.php'>Employment</a></li> <li><a href='login.php'>Hospital </a></li> <li><a href='register.php'>Jail</a></li> <li><a href='forgotpassword.php'>Forums</a></li> <li><a href='contact.php'>Search</a></li> <li><a href='t&c.php'>Donator</a></li> <li><a href='register.php'>News</a></li> <li><a href='register.php'>Faction</a></li> </ul> <!-- Container --> <div class="container"> <!-- Banner --> <div class="bannerimage"> <div align="center"><img src="gameimage/newbann.png" style="margin-top: 37px; " /> </div> <div class="text"> <h3 style="margin-top:0px; margin-bottom:0px;">Username</h3> <br /> Level:<br /> Money:<br /> Gold:<br /> </div> </div> Now through debugging if I removed the code following the banner comment my nevigation bar works perfectly. With the code after the banner comment added, my navigation bar buttons work for the first few buttons and the rest refuse to co operate. I've concluded it must be down to the div tags but i've got little knowledge over HTML so would be grateful if anyone can see what the issue is
-
hi guys, I have a issue i believe with my recaptcha on my email page. i downloaded the script and installed it and ran it properly. it shows up but my problem is at the checking part in which it always says it fails. for the actual checking i have this require_once('recaptchalib.php'); $privatekey = "FILTERED OUT"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $error_string .= '<center>The reCAPTCHA wasnt entered correctly. Go back and try it again.</center><br />'; } else if ($user == '') { $error_string .= '<center>You left the Username field blank!.</center><br />'; } would be grateful if anyone can see the issue. I also had this error mes PHP Fatal error: Call to undefined function recaptcha_check_answer() that stopped after i changed require_once to require and back again. not sure whats going on here