Jump to content

MrSamCraft

Members
  • Posts

    15
  • Joined

  • Last visited

MrSamCraft's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello! Iv made a little Minecraft avatar generator that can fetch Minecraft avatars. But for this to work I'm going to use a form that allows users to input a username and select a size. For example: But how could I get the username and avatar size into the URL, for example; (For this to show i added it in) http://pvpbattles.com/mc/index.php?u=MrSamCraft&s=90 Thanks, Sam D
  2. Hello, I am wanting users on my site to enter their Minecraft account name that will then place their player head as the profile image, i have the code to fetch it but how can I use php to input the username into the url? <img src="https://minotar.net/avatar/USERNAME_here/100"> Thanks, Sam
  3. Could I do this for non registered users? to hide stuff if they are not logged in? if(!user_registerd) { ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Account<b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/account.php">Manage Account</a></li> <li><a href="http://enderbase.com/register.php">My Submissions</a></li> <li><a href="http://enderbase.com/logout.php">Logout</a></li> <?php } ?>
  4. wouldn't i use this instead? <?php if(logged_in() == false) { ?> STUFF TO HIDE HERE <?php } else { ?>
  5. Hello, Iv finished my login/register function now! wooop! But i am wanting to remove the register/login menu from registered users now, how would I go about doing this? Thanks! This is the menu code from the index page! <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="brand">EnderBase</a> <div class="nav-collapse collapse"> <ul class="nav"> <li class="active"><a>Home</a></li> <li><a href="http://enderbase.com/about.php">About</a></li> <li><a href="http://enderbase.com/contact.php">Contact</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Register/Login <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="http://enderbase.com/register.php">Register</a></li> <li><a href="http://enderbase.com/login.php">Login</a></li> <li class="divider"></li> <li><a href="http://enderbase.com/activate.php">Account Activation</a></li> </ul> </li> </ul> </div><!--/.nav-collapse --> </div> </div> </div>
  6. Hello, So im in the middle of making a login section and so far so good, until i hit a brick wall... So for the users needto active the account. I tested this with my test account and before I activated the test account via the database (changed it form 0 to 1) it said "User not activated". From that point on I activated it, now when i try to login Im just getting "That username/password combination is incorrect" (But its not...) Here have a look for your self http://enderbase.com/login.php Username: test Password: test Here the code User.php <?php function logged_in() { return (isset($_SESSION['iduser'])) ? true : false; } function user_exists($username) { $username = sanitize($username); return (mysql_result(mysql_query("SELECT COUNT(`iduser`) FROM `user` WHERE `username` = '$username'"), 0) == 1) ? true : false; } function user_active($username) { $username = sanitize($username); return (mysql_result(mysql_query("SELECT COUNT(`iduser`) FROM `user` WHERE `username` = '$username' AND `active` = 1"), 0) == 1) ? true : false; } function iduser_from_username($username) { $username = sanitize($username); return mysql_result(mysql_query("SELECT `iduser` FROM `user` WHERE `username` = '$username'"), 0, 'iduser'); } function login($username, $password) { $iduser = iduser_from_username($username); $username = sanitize($username); $password = md5($passowrd); return (mysql_result(mysql_query("SELECT COUNT(`iduser`) FROM `user` WHERE `username` = '$username' AND `password` = '$password'"), 0) == 1) ? $iduser : false; } ?> Login.php <?php include 'core/init.php'; if (empty($_POST) === false) { $username = $_POST['username']; $password = $_POST['password']; if (empty($username) === true || empty($password) === true) { $errors[] = 'You need to enter a username and password!'; } else if (user_exists($username) === false) { $errors[] = 'We can\'t find that username. Have you registerd?'; } else if (user_active($username) === false) { $errors[] = 'You havn\'t activated your account!'; } else { $login = login($username, $password); if ($login === false) { $errors[] = 'That username/password combination is incorrect!'; } else { $_SESSION['iduser'] = $login; header('Location: index.php'); exit(); } } } ?> Thanks, Sam (p.s. Im a noob to this )
  7. My noobish coding right there! Dam the tiredness! Thanks for the help Barand!
  8. I'v been stuck on this now for the past 4 hours! I'm trying to get this code to prompt a user with the right error when not entering the right pass or username but its just prompting with Array ( ) <?php include 'core/init.php'; if (empty($_POST) === false) { $username = $_POST['username']; $password = $_POST['password']; if (empty($username) === true || empty($password) === true) { $erros[] = 'You need to enter a username and password!'; } else if (user_exists($username) === false) { $erros[] = 'We can\'t find that username. Have you registerd?'; } else if (user_active($username) === false) { $erros[] = 'You havn\'t activated your account!'; } else { $login = login($username, $password); if ($login === false) { $errors[] = 'That username/password combination is incorrect!'; } else { $_SESSION['iduser'] = $login; header('Location: index.php'); exit(); } } print_r($errors); } ?> Thanks, Sam
  9. I'm trying to test a login iv just made but i keep getting this error Parse error: syntax error, unexpected T_IF. on line 4 ​ Here is the code.. Its starting to bug me.. Help please! (Im new to php) Thanks, Sam
×
×
  • 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.