Jump to content

Flowdy

Members
  • Posts

    37
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male
  • Location
    England, United Kingdom

Flowdy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I took the brackets out and still not working...i dont quite understand what you mean janim Errors Code <?php $dbhost = "localhost"; $dbuser = "poison_mygame"; $dbpass = "england"; // keep your password here $dbname = "poison_mygame"; mysql_connect("127.0.0.1", "poison_mygame", "england"); // 127.0.0.1 goes to the IP of the host (where most likely your db is stored). mysql_select_db("poison_mygame"); // Check to see if user logged in session_start(); if((!isset($_SESSION['id'])) || (!isset($_SESSION['username'])) || (!isset($_SESSION['password']))) { unset($_SESSION['username']); unset($_SESSION['password']); unset($_SESSION['id']); $loggedin = 0; } else { $loggedin =1; } ?>
  2. Sure here is the code <?php $dbhost = "localhost"; $dbuser = "poison_mygame"; $dbpass = "england"; // keep your password here $dbname = "poison_mygame"; mysql_connect("127.0.0.1", "poison_mygame", "[england]"); // 127.0.0.1 goes to the IP of the host (where most likely your db is stored). mysql_select_db("poison_mygame"); // Check to see if user logged in session_start(); if((!isset($_SESSION['id'])) || (!isset($_SESSION['username'])) || (!isset($_SESSION['password']))) { unset($_SESSION['username']); unset($_SESSION['password']); unset($_SESSION['id']); $loggedin = 0; } else { $loggedin =1; } ?>
  3. Sorry for the double post...incase you cant see the page as a friend told me she couldn't i get these errors But i can see text boxes for username password and submit button
  4. ooo that helped but now there are loads of errors you should be to see wat i mean by clicking here http://www.testphp.poison-envy.net/index.php
  5. Nope didnt work.. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'poison_mygame'@'localhost' (using password: YES) in /home/poison/public_html/testphp/connect.php on line 8 Could not connect: Access denied for user 'poison_mygame'@'localhost' (using password: YES) Am starting to think i added a username and password to the database the wrong way
  6. I did use my password last time i just took it out when posting the code on here....I changed things and now i get this the code <?php $dbhost = "localhost"; $dbuser = "poison_mygame"; $dbpass = ""; // keep your password here $dbname = "poison_mygame"; <?php mysql_connect($dbhost, $dbuser, $dbpass) or die('Could not connect: ' . mysql_error()); ?> // Check to see if user logged in session_start(); if((!isset($_SESSION['id'])) || (!isset($_SESSION['username'])) || (!isset($_SESSION['password']))) { unset($_SESSION['username']); unset($_SESSION['password']); unset($_SESSION['id']); $loggedin = 0; } else { $loggedin =1; } ?> The error
  7. The posion_frgn1 isnt the database i made for this its the poison_game one is the first attached image... so i put in the poison_game instead, this being the new code <?php $dbhost = "localhost"; $dbuser = "poison_mygame"; $dbpass = ""; // keep your password here $dbname = "poison_mygame"; $link = mysql_connect($dbhost, $dbuser, $dbpass); if (!$link) { die('Could not connect: ' . mysql_error()); } $selectdb = mysql_select_db($dbname) or die("Could not connect to database."); ?> // Check to see if user logged in session_start(); if((!isset($_SESSION['id'])) || (!isset($_SESSION['username'])) || (!isset($_SESSION['password']))) { unset($_SESSION['username']); unset($_SESSION['password']); unset($_SESSION['id']); $loggedin = 0; } else { $loggedin =1; } ?> I took my password out but now i get this message ???
  8. I did that and this is what i see [attachment deleted by admin]
  9. in the MySQL databases via Control Panel there is nothing under the database i made for this code ??? just has the title poison_mygame
  10. Ok thanx but i don't understand which password to put there as i thought it was the password for the username i added for the database? or would it be the password i use to login to my Cpanel?
  11. were do i correct it? in the code or somewere else?
  12. Ah right ok! then i have no idea i really am that new to php/MySQL
  13. Yeah it must be on the connect.php as the other are ...index.php...logout.php and register.php and they all coming up with the cannot connect to database. PHP is confusing dont think ill ever get to understand it
  14. Ah thanx i feel stupid now am i just stupid cos when i go to http://www.testphp.poison-envy.net/register.php i just get Could not connect to database. shouldnt a form come up to register?
  15. Thanx guys i got it working thanx to your help...i changed the connection to mysql_connect() but now i have a different problem on the register.php <?php include('connect.php); if($loggedin == '1') die("you can't register another account while you're logged in."); // Register Script // Putting new data into databases. if(isset($_POST['submit'])) { // trim removes the whitespaces from the beginning and end of text // this keeps someone from having a username of " " $uname = trim($_POST['username']); // Make sure all forms were filled out. if((!isset($_POST['username'])) || (!isset($POST_['pass'])) || ($uname == '') || ($_POST['pass'] == '')) die("please fill out the form completely. <br><br> <a href=register.php>Continue</a>"); // Make sure name hasn't already been used. $check = @mysql_query("SELECT id FROM players WHERE username = '$uname'"); $check = @mysql_num_rows($check); if($check > 0) die("sorry username has already been taken. Please try again. <br><br> <a href=register.php>Continue</a>"); // Encrypt password $pass=md5($_POST['pass']); $date = date("m/d/y"); // Finally, create record. $newplayer = @mysql_query("INSERT INTO players (username, password, registered) VALUES ('$uname', '$pass', '$date')") or die("Error: ".mysql_error()); echo 'you have been registered! you make now <a href=index.php>Log in</a>.'; } else { // A simple example of a form. echo '<form action=register.php method=post> Username: <input type=text name=username><br> Password: <input type=password name=pass><br> <input type=submit name=submit value=Submit> </form>'; } ?> The error i get is
×
×
  • 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.