Posted By

AlexPrisoner on 04/12/08


Tagged

login register index and for


Versions (?)

index.php


 / Published in: PHP
 

URL: http://www.myworldness.com

None.

  1. <?PHP session_start(); // NEVER REMOVE THIS!
  2. //Variables you would need to change!
  3. $dbhost = 'localhost'; //Your Database Host!
  4. $dbuser = 'exdeeorg_mwn'; //Your Database Username!
  5. $dbpass = 'mwnalex'; //Your Database Password!
  6. $dbname = 'exdeeorg_mwn'; //Your Database Name!
  7. //END! DON'T EDIT ANYTHING BELOW THIS LINE IF YOU DON'T KNOW WHAT YOUR DOING!!!
  8.  
  9. $connect = mysql_connect($dbhost,$dbuser,$dbpass) or die("Could not connect to database<br/><b>Error:</b>".mysql_error());
  10. mysql_select_db($dbname,$connect) or die("Could not connect to database<br/><b>Error:</b>".mysql_error());
  11.  
  12. //Start Code
  13.  
  14. if($_SESSION['logged_in'] != 1){
  15. //Content For Logged Out User!
  16. ?>
  17. <center>Oh you seem to be logged out choose one of the options below!</center>
  18. <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  19. <tr>
  20. <td><a href="usercp.php?login">Login</a></td>
  21. <td><div align="right"><a href="usercp.php?register">Register</a></div></td>
  22. </tr>
  23. </table>
  24.  
  25. <?
  26. }
  27. else{
  28. //Content for users Logged In!
  29. //Get User Deatails!
  30. $userdata = mysql_query("SELECT * FROM `users` WHERE id = {$_SESSION['user_id']}");
  31. $userdata = mysql_fetch_array($userdata);
  32. //END!
  33. ?>
  34. Hey their <?=$userdata['username'];?>!<br/>
  35. (<a href="usercp.php?logout">Logout</a>)
  36. <?
  37. }
  38. ?>

Report this snippet  

You need to login to post a comment.