
PHPDevil
Members-
Posts
38 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by PHPDevil
-
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
-
Hi guys, Im simply creating a login page for when people visit my website. Not up at the moment though. Issue I'm having is that authentication of the username and password works when you visit the page for the first time but doesn't when you press the login button. the php and sql i've used is: $page_mode = isset($_POST['page_mode']) ? $_POST['page_mode'] : ''; $error_string = ''; if ($page_mode == 'Login') { $username = $_POST['username']; $password = $_POST['password']; if (trim($username) == '' || trim($password) == '') $error_string .= '<font color=red>You have left either the username or password field blank!</font><br />'; } else { $result = $mysqli->query("SELECT PlayerID, Username, Password FROM Persons WHERE Username='" . mysql_real_escape_string($username) . "'"); if (!($row = mysql_fetch_assoc($result)) || $row['password'] != sha1($password)) $error_string .= 'Please check your email address or password. Your details weren\'t correct <br />'; else { $error_string .= 'Site not ready'; } } and for my HTML echo " <div class='login'> <div align='right'> <img src='/outsideimage/toppart.png' /> </div> <div class='logincol'>"; echo $error_string; echo "<form method='post' action=''> <input type='hidden' name='page_mode' value='Login'> Username:<br /> <input type='text' name='username' size='30px' /><br /> Password:<br /> <input type='password' name='password' size='30px' /><br /><br /> <input type='submit' value='Login' title='Login' /> </div> <img src='/outsideimage/topbot.png' /> </div>"; I would like to point out that if either the username or password is blank the correct error message comes up. if there not nothing happens :( it simply won't check it against the databse when you press login but will when you type the url in O,o
-
thanks for your support. i roughly have some indication on how this works now with all these functions. Instead of messing with then i decided just to redo the design of the page first but even thats causing me poblems. for example if i wanted to move the main body within a div class as i hate using tables for the design, the entire page disappears and only banner remains? im hoping someone knows whats going on....trying to make the main menu area 200 pixels wide in a div and the rest of the page 800 pixels. Of course all of this is in a main div cotainer thats set margin: 0 auto and width: 1000px
-
Hi, I want to modify my header completely and well make a new design. Im just curious on how mccodes manages to place the header around each page. I can't seem to work out how this header appears on every page. does anyone know? thanks
-
lool sorry. I didn't understand what you said :( im pretty basic to all of this.
-
Hi I'm having some difficulties with a database. I got a forgot password script which I've made. I got to the process where ive md5 and created the new password with rand now when i run my sql query the database doesn't seem to update the new password if ($email == $dbemail && $lname == $dblname) { $password = rand(10000,20000); $passnew = md5($password); mysql_query("UPDATE users SET userpass='$passnew' WHERE email='$email'") or die(mysql_error()); $checkpass = mysql_query("SELECT * FROM users WHERE email='$email' AND userpass='$newpass'"); $nnum = mysql_num_rows($checkpass); if ($nnum == 1){ echo "Password was changed succesfully"; } else { echo "Error occured"; } } else { echo "email not sent. details arent te same"; } i believe the issue lies there. I keep getting the "error occured" message on the site. If more of the script is needed please let me know Thanks!
-
Sorry forgot to mention that. This one: <div class='logintop'> <div align='right'> <img src='toppart.png' /> </div> </div> <div class='logintext'> <input type="text" name="username" id="username" size='35px' value="Enter your Username" onfocus="if(this.value==this.defaultValue)this.val ue='';" onblur="if(this.value=='')this.value=this.defaultV alue;"/> <input type="password" name="password" id="password" size='35px' value="Enter your password" onfocus="if(this.value==this.defaultValue)this.val ue='';" onblur="if(this.value=='')this.value=this.defaultV alue;"/> <div class='logintop'> <input type='submit' name='submit' /><input type="button" value="Forgot Password" /> </div> </div> <div align='right'> <img src='topbot.png' /> </div> with this one: <div class='logintop2'> <div align='left'> <img src='topabout.png' /> </div> </div> <div class='clear'></div> </div> The example with a url is http://www.makeapc.co.uk/test.php Trying to keep the about banner on the same line as Login
-
Im having problems with keeping two divs on the same line. i tried to use all this float stuff but i hadn't had any luck. <?php print <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!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" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <meta name='SQL DEVIL" content='ZONE WARS' /> <meta name='Keywords' content='cssplay, css play, Cascading, Style, Sheets, CSS1, CSS2, CSS, XHTML1.1, w3c, doing it with style, recommendations, opacity, box model, mozilla, opera, netscape, internet explorer, v6, v7.23, techniques, layout, three column, cutting edge, experimental, validation, validate, navigation, pop-up, pull-down, menus, tips, tricks, css mouseover, mouseovers, CSS experiments, CSS demonstrations'/> <meta name='Description' content='CSS ~ Cutting edge Cascading Style Sheets. Experiments in CSS' /> <title>Zone Wars</title> <style type='text/css'> body { background: #000000 url(http://www.blogblog.com/1kt/awesomeinc/body_background_dark.png) repeat scroll top left; margin:0 auto; text-align:center; overflow: hidden; } div.centered { text-align: left; margin: 0 auto; width: 800px; border: 0px solid white; } div.logintext { position: relative; left: 500px; background-color: black; width:300px; color: #fff; } #nav { width: 100%; 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; } div.logintop { padding-top: 5px; } div.logintop2 { padding-top: 5px; float: left; } .clear { clear: both;} input{ font:normal 14px Tahoma; color:#ffffff; height: 20px; background-color: #1c1b1b; border-color: #242424; } </style> </head> <body> <div class='centered'> <!-- Navigation Bar start --> <ul id="nav"> <li><a href="#">Home </a></li> <li><a href="#">Register</a></li> <li><a href="#">Forgot Password</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Terms and Conditions</a></li> </ul> <!-- Navigation Bar End --> <img src='bannertest.jpg' /> <br /> <div class='logintop'> <div align='right'> <img src='toppart.png' /> </div> </div> <div class='logintext'> <input type="text" name="username" id="username" size='35px' value="Enter your Username" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/> <input type="password" name="password" id="password" size='35px' value="Enter your password" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/> <div class='logintop'> <input type='submit' name='submit' /><input type="button" value="Forgot Password" /> </div> </div> <div align='right'> <img src='topbot.png' /> </div> <div class='logintop2'> <div align='left'> <img src='topabout.png' /> </div> </div> <div class='clear'></div> </div> </body> </html> EOF; ?>
-
i managed to get it working :)
-
thanks for your replies! I didn't get any luck with the changes :( the new codes allowed it to be in the div but prevented the height from changing
-
Hey guys i'm having a problem with some of my positioning. I've made a container for my web design to go into using a div and the code for it is. div.centered{ text-align: left; margin: 0 auto; width: 800px; border: 1px solid white; } now ive placed a banner in the div tag. <div class="centered"> <div class="banner"> <img src="logo.png" /> </div> </div> for me to position the image where i wanted i made another class however there is a issue with it working though. the code which i have at the momment is. div.banner { top:35px; } that doesn't do anything to the image. So i added in position:absolute; that does change the image to where i want it however it takes the image outside the DIV container where as i want it to stay there. Any suggestions on what to do? Thanks