OOP Login/Register System Error in Hosting Site

+1 Haise Sasaki · January 1, 2015
So I finished Alex's tutorial in OOP Login/Register system and used it to my system. It's working good in my localhost. No errors and all.

I uploaded it on a server and I can't even login. It always says "The username and password you entered did not match!". All my configs are correct. I don't know. Is it because of PDO? Please help..

This is my index page


<!DOCTYPE html>

<?php require_once 'core/init.php'; ?>

<html>

<head>

<title></title>

<meta name="">



<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">



<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">

<link rel="stylesheet" href="includess/css/styles.css">

<link href="includess/css/bootstrap-glyphicons.css" rel="stylesheet">



<script src="js/modernizr-2.6.2.min.js"></script>

</head>

<body>

<?php

$user = new User();

if($user->isLoggedIn()){

Redirect::to('home.php');

} ?>

<div class="container" id="main">

<div class="navbar navbar-default navbar-fixed-top">

<div class="container">

<button class="navbar-toggle" data-target=".navbar-responsive-collapse" data-toggle="collapse" type="button">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<a class="navbar-brand" href="index.php"><img src="images/lpulogo50x50.png" alt="LPU-Cavite ALS"></a>

<div class="nav-collapse collapse navbar-responsive-collapse">

<ul class="nav navbar-nav">

<li>

<a href="index.php"></a>

</li>

</ul>

<ul class="nav navbar-nav pull-right">

<li class="active">

<a href="index.php">Home</a>

</li>

<li>

<a href="lpuals.php">FAQs</a>

</li>

<li>

<a href="contactus.php">Contact Us</a>

</li>

</ul><!-- end nav pull-right -->

</div> <!-- end of nav-collapse -->

</div> <!-- end of navbar-container -->

</div> <!-- end of navbar -->

<div class="carousel slide" id="myCarousel">

<!-- Indicators -->

<ol class="carousel-indicators">

<li class="active" data-slide-to="0" data-target="#myCarousel"></li>

<!-- <li data-slide-to="1" data-target="#myCarousel"></li> -->

<li data-slide-to="2" data-target="#myCarousel"></li>

</ol>

<!-- Wrapper for slides -->

<div class="carousel-inner">

<div class="item active" id="slide1">

<div class="carousel-caption">

<h4>Al</h4>

<p></p>

</div><!-- end carousel-caption-->

</div><!-- end item -->

<!-- <div class="item" id="slide2">

<div class="carousel-caption">

<h4>Don't have any idea about DepEd's Alternative Learning System?</h4>

<a href="faq.php"><p>Click here to learn more!</p></a>

</div>

</div> -->

<div class="item" id="slide3">

<div class="carousel-caption">

<h4>Le</h4>

</div><!-- end carousel-caption-->

</div><!-- end item -->

</div><!-- carousel-inner -->

<!-- Controls -->

<a class="left carousel-control" data-slide="prev" href="#myCarousel"><span class="icon-prev"></span></a>

<a class="right carousel-control" data-slide="next" href="#myCarousel"><span class="icon-next"></span></a>

</div> <!-- end of carousel -->

<?php 

if(Session::exists('success')) {

echo Session::flash('success');

}

?>

<div class="row" id="bigCallout">

<div class="col-6">

<div class="well">

<div class="page-header">

<h3>Alternative Learning System <small></small></h3>

</div><!-- end page-header -->

<p class="lead">An</p>

<a href="lpuals.php" class="btn btn-primary" id="alertMe">Click here to learn more</a>

<a href="contactus.php" class="btn btn-link">or Contact Us!</a>

</div><!-- end well -->

</div><!-- end col-6 -->

<div class="col-6">

<div class="well">

<div class="page-header">

<h3>Login</h3>

</div><?php 

if(Input::exists()) {

if(Token::check(Input::get('token'))) {

$validate = new Validate();

$validation = $validate->check($_POST,array(

'username' => array('required' => true),

'password' => array('required' => true)

));

if($validation->passed()) {

$user = new User();

$remember = (Input::get('remember') === 'on') ? true : false;

$login = $user->login(Input::get('username'), Input::get('password'), $remember);

if($login) {

Redirect::to('home.php');

} else {

echo '<div class="alert alert-danger" role="alert">The username and password you entered did not match!</div>';

}



} else { ?> <div class="alert alert-danger" role="alert"> <?php

foreach($validation->errors() as $error) {

echo $error, '<br>';

}

?> </div> <?php

}

}

} ?>

<form class="form-horizontal login" method="post" action="">

<input type="text" name="username" class="form-control" placeholder="Username">

<input class="form-control" type="password" name="password" id="password" autocomplete="off" placeholder="Password">

<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">

<input type="submit" value="Log in" class="btn btn-primary">

<label for="remember"><input type="checkbox" name="remember" id="remember" class="remember"> Remember me</label> <span class="separator">.</span> <a href="forgot.php">Forgot Password?</a>

</form>

</div>



</div>



</div> <!-- end of bigCallout -->



<!-- <div class="row" id="featuresHeading">

<div class="col-12">

<h2>More Features</h2>

<p class="lead">Cornhole kitsch Williamsburg pug bicycle rights vegan. Neutra food truck occupy kitsch sustainable.</p>

</div><!-- end col-12

</div><!-- end featuresHeading --> 





<div class="row" id="features">



<div class="col-sm-6 feature">

<div class="panel">

<div class="panel-heading">

<h3 class="panel-title">A teacher and want to volunteer?</h3>

</div><!-- end panel-heading -->

<img src="images/badge_css3.jpg" alt="Volunteer Teacher" class="img-circle">



<p>Are </p>



<a href="volunteer.php" class="btn btn-danger btn-block">Click here to volunteer!</a>

</div><!-- end panel -->

</div><!-- end feature -->



<div class="col-sm-6 feature">

<div class="panel">

<div class="panel-heading">

<h3 class="panel-title">L!</h3>

</div><!-- end panel-heading -->

<img src="images/badge_bootstrap.jpg" alt="Bootstrap 3" class="img-circle">



<p>L</p>



<a href="registration.php" class="btn btn-info btn-block">Click here to register!</a>

</div><!-- end panel -->

</div><!-- end feature -->

</div> <!-- end of featuresHeading -->



<div class="row" id="moreInfo">

<div class="col-sm-6">

<h3>Visit Us!</h3>

<div class="tabbable">

<ul class="nav nav-tabs">

<li class="active"><a href="#tab1" data-toggle="tab">L</a></li>

<li><a href="#tab2" data-toggle="tab">C</a></li>

</ul>

<div class="tab-content">

<div class="tab-pane active" id="tab1">

<h4><span class="glyphicon glyphicon-map-marker"></span> Location <small>of the </small></h4>



<iframe width="100%" height="200" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d3866.3517442211523!2d120.91578599999998!3d14.290984!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x8102047b46464ab7!2sLyceum+of+the+Philippines+University!5e0!3m2!1sen!2sus!4v1411432246302" frameborder="0" style="border:0"></iframe>



Pay!

</div><!-- end tab-pane -->



<div class="tab-pane" id="tab2">

<h4>What is the essence of life?<small> To serve others and to do good.</small></h4>



<p>W.</p>



<hr>



</div><!-- end tab-pane -->

</div><!-- end tab-content -->

</div><!-- end tabbable -->

</div><!-- end col-sm-6 -->



<div class="col-sm-6">

<h3>Announcement</h3>

<?php $news = DB::getInstance()->query("SELECT * FROM news ORDER BY id DESC");

foreach ($news->results() as $new) {

$date = date_create($new->date);

$datefrmt = date_format($date, 'F d\, Y g:iA');

$content = $new->content;

$sContent = substr($content, 0, 100);

echo "<div class=list-group>

<a href=readnews.php?id=$new->id class=list-group-item>

<h4 class=list-group-item-heading>$new->title <span class=date>$datefrmt<span></h4>

<p class=list-group-item-text>$sContent</p>

</a>

</div>";



}

?>





</div><!-- end col-sm-6 -->



</div>





</div> <!-- end of container -->





<footer>

<div class="container">

<div class="row">

<div class="col-sm-2">

<h6>Copyright © 2014 L</h6>

</div><!-- end col-sm-2 -->



<div class="col-sm-4">

<h6>About Us</h6>

<P>L.</P>

</div><!-- end col-sm-4 -->



<div class="col-sm-2">

<h6>Navigation</h6>

<ul class="unstyled">

<li><a href="index.php">Home</a></li>

<li><a href="lpuals.php">FAQs</a></li>

<li><a href="contactus.php">Contact</a></li>

<li><a href="volunteer.php">Volunteer as Teacher</a></li>

</ul>

</div><!-- end col-sm-2 -->



<div class="col-sm-2">

<h6>Useful Links</h6>

<ul class="unstyled">

<li><a href="http://www.deped.gov.ph" target="_blank">Dep</a></li>

<li><a href="www.deped-als.com" target="_blank">Bur</a></li>

</ul>

</div><!-- end col-sm-2 -->



<div class="col-sm-2">

<h6>Coded by <span class="glyphicon glyphicon-thumbs-up"></span><a href="developers.php"> D</a></h6>

</div><!-- end col-sm-2 -->

</div><!-- end row -->

</div><!-- end container -->



</footer>





<script src="includess/js/jquery-1.8.2.min.js"></script>

<script src="bootstrap/js/bootstrap.js"></script>

<!-- Custom Js -->

<script src="includess/js/script.js"></script>

</body>

</html>





Post a Reply

Replies

Oldest  Newest  Rating
0 Raphael de Oliveira · January 2, 2015
Upload your code to pastebin so we can take a look
0 Haise Sasaki · January 3, 2015
Thanks for the reply. Hope someone can solve this :(
  • 1

PHP

107,321 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators