Data hasn't saved thorough phpmyadmin - php

I want to save a form data through codeigniter framework in PhPMyadmin.But it's not working. it redirected to my form page automatically.
here is my View (form page's) code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo $title;?></title>
<!-- Bootstrap Core CSS -->
<link href="<?php echo base_url();?>bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- MetisMenu CSS -->
<link href="<?php echo base_url();?>bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="<?php echo base_url();?>dist/css/sb-admin-2.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="<?php echo base_url();?>bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Forms</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
Basic Form Elements
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-6">
<form action"<?php echo base_url();?>super_admin/save_category" method="post" >
<div>
<?php
$message=$this->session->userdata('message');
if($message){
echo $message;
$this->session->unset_userdata('message');
}
?>
</div>
<div class="form-group">
<label>Text Input</label>
<input class="form-control" name="category_name">
<p class="help-block">Example block-level help text here.</p>
</div>
<div class="form-group">
<label>Text area</label>
<textarea class="form-control" name="category_description" rows="3"></textarea>
</div>
<div class="form-group">
<label>Radio Buttons</label>
<div class="radio">
<label>
<input type="radio" name="publication_status" id="optionsRadios1" value="1" checked>Published
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="publication_status" id="optionsRadios2" value="0">Unpublished
</label>
</div>
</div>
<button type="submit" class="btn btn-default">Submit </button>
<button type="reset" class="btn btn-default">Reset </button>
</form>
</div>
</div>
<!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
</div>
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="<?php echo base_url();?>bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="<?php echo base_url();?>bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="<?php echo base_url();?>bower_components/metisMenu/dist/metisMenu.min.js"></script>
<!-- Custom Theme JavaScript -->
<script src="<?php echo base_url();?>dist/js/sb-admin-2.js"></script>
And here is my Controller code :
<?php
//session_start();
defined('BASEPATH') OR exit('No direct script access allowed');
/**
*
*/
class Super_Admin extends CI_Controller
{
public function __construct(){
parent::__construct();
$admin_id=$this->session->userdata('admin_id');
if($admin_id==NULL){
redirect('admin_login','refresh');
}
}
public function index()
{
$this->load->view('admin/admin_master');
}
public function add_category(){
$data=array();
//$data['admin_content']=$this->load->view('admin/add_category','',TRUE);
$data['title']='Add category';
$this->load->view('admin/add_category',$data);
}
public function save_category(){
$data=array();
$data['category_name']=$this->input->post('category_name',TRUE);
$data['category_description']=$this->input->post('category_description',TRUE);
$data['publication_status']=$this->input->post('publication_status',TRUE);
$this->super_admin_model->save_category_info($data);
$sdata=array();
$sdata['message']="Save Category information successfully";
$this->session->set_userdata($sdata);
redirect('super_admin/add_category');
}
public function logout(){
$this->session->unset_userdata('admin_name');
$this->session->unset_userdata('admin_id');
$sdata=array();
$sdata['message']='You are successfully logout!';
$this->session->set_userdata($sdata);
redirect('admin_login','refresh');
}
}
?>
And here is my Model code :
<?php
class Super_Admin_Model extends CI_Model{
public function save_category_info($data){
$this->db->insert('tbl_category',$data);
}
}
?>

You forgot to load your model.
public function save_category(){
$this->load->model('super_Admin_Model', 'model'); //May be you forget this.
$data= array(
'category_name' => $this->input->post('category_name',TRUE),
'category_description' => $this->input->post('category_description',TRUE),
'publication_status' => $this->input->post('publication_status',TRUE)
);
$this->model->save_category_info($data);
$sdata=array();
$sdata['message']="Save Category information successfully";
$this->session->set_userdata($sdata);
redirect('super_admin/add_category');
}

Related

Receiving blank view with status code 200 in vagrant

I am very new to Laravel and I have been given a very old project and asked to use vagrant/homestead. The project uses php7.2 and doesn't have php artisan. It also doesn't have public folder. The problem is that the I am getting a blank view with status code 200. My homestead.yaml is:
folders:
- map: C:\Users\Desktop\school_erp_lms
to: /home/vagrant/school_lms
sites:
- map: school-lms.test
to: /home/vagrant/school_lms
php: "7.2"
databases:
- u789138695_schoolerp
route.php is:
Route::get('/login','LoginController#index');
LoginController is:
<?php
namespace App\Http\Controllers;
use View;
class LoginController extends Controller
{
public $data = array();
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
}
public function index()
{
return View::make('login', $this->data);
}
}
.env is:
DB_NAME=u789138695
DB_USERNAME=user
DB_PASSWORD=""
DEBUG=true
login.blade.php is:
<!DOCTYPE html>
<html lang="en" <?php if($panelInit->isRTL == 1){ ?>dir="rtl"<?php } ?> style="background:none;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<?php if($panelInit->settingsArray['favicon'] == "e"){ ?>
<link rel="icon" type="image/png" sizes="16x16" href="{{URL::asset('assets/images/favicon.png')}}">
<?php } ?>
<title><?php echo $panelInit->settingsArray['siteTitle'] . " | " . $panelInit->language['signIn']; ?></title>
<!-- Bootstrap Core CSS -->
<link href="{{URL::asset('assets/plugins/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet">
<!-- Custom CSS -->
<?php if($panelInit->isRTL == 1){ ?>
<link href="{{URL::asset('assets/css/style-rtl.css')}}" rel="stylesheet">
<link href="{{URL::asset('assets/plugins/bootstrap-rtl-master/dist/css/custom-bootstrap-rtl.css')}}" rel="stylesheet" type="text/css" />
<?php }else{ ?>
<link href="{{URL::asset('assets/css/style.css')}}" rel="stylesheet">
<?php } ?>
<link href="{{URL::asset('assets/css/custom.css')}}" id="theme" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<?php
$bgStyling = "";
if($panelInit->settingsArray['authPageImage'] == "1"){
$bgStyling .= "background-image:url('".URL::asset('assets/images/login-register.jpg')."'); ";
}
if($panelInit->settingsArray['authPageColor'] != ""){
$bgStyling .= "background-color:".$panelInit->settingsArray['authPageColor'].";";
}
?>
<body class="loginMark" style="<?php echo $bgStyling; ?>;background-attachment:fixed; background-repeat: repeat-y;background-size: cover;" >
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
</div>
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<section id="wrapper" <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-register login-sidebar" style="'.$bgStyling.'"'; } ?>>
<div <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-box card"'; }else{ echo 'class="login-register" '; } ?> >
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?><div class="login-box card"><?php } ?>
<div class="card-block">
<form class="form-horizontal form-material" id="loginform" action="{{URL::to('/login')}}" method="post">
<a href="javascript:void(0)" class="text-center db logo-text-login">
<?php
if($panelInit->settingsArray['siteLogo'] == "siteName"){
echo $panelInit->settingsArray['siteTitle'];
}elseif($panelInit->settingsArray['siteLogo'] == "text"){
echo $panelInit->settingsArray['siteLogoAdditional'];
}elseif($panelInit->settingsArray['siteLogo'] == "image"){
?><img src="<?php echo URL::asset('assets/images/logo-light.png'); ?>" /><?php
}
?>
</a>
<h3 class="box-title m-b-20"><?php echo $panelInit->language['signIn']; ?></h3>
#if($errors->any())
<span style='color:red;'>{{$errors->first()}}</span><br/><br/>
#endif
<div class="form-group ">
<div class="col-xs-12">
<input class="form-control" type="text" name="email" required="" placeholder="<?php echo $panelInit->language['userNameOrEmail']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input class="form-control" type="password" name="password" required="" placeholder="<?php echo $panelInit->language['password']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div class="checkbox checkbox-primary pull-left p-t-0">
<input id="checkbox-signup" name="remember_me" type="checkbox">
<label for="checkbox-signup"> <?php echo $panelInit->language['rememberMe']; ?> </label>
</div> <i class="fa fa-lock m-r-5"></i> <?php echo $panelInit->language['restorePwd']; ?> </div>
</div>
<div class="form-group text-center m-t-20">
<div class="col-xs-12">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" type="submit"><?php echo $panelInit->language['signIn']; ?></button>
</div>
</div>
<?php if(isset($panelInit->settingsArray['allowPublicReg']) AND $panelInit->settingsArray['allowPublicReg'] == "1"){ ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><b><?php echo $panelInit->language['registerNewAccount']; ?></b></p>
</div>
</div>
<?php } ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><b><?php echo $panelInit->language['schoolTerms']; ?></b></p>
</div>
</div>
</form>
</div>
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?></div><?php }?>
</div>
</section>
<script src="{{URL::asset('assets/plugins/jquery/jQuery-2.1.4.min.js')}}"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="{{URL::asset('assets/plugins/bootstrap/js/tether.min.js')}}"></script>
<script src="{{URL::asset('assets/plugins/bootstrap/js/bootstrap.min.js')}}"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="{{URL::asset('assets/js/jquery.slimscroll.js')}}"></script>
<!--Wave Effects -->
<script src="{{URL::asset('assets/js/waves.js')}}"></script>
<!--stickey kit -->
<script src="{{URL::asset('assets/plugins/sticky-kit-master/dist/sticky-kit.min.js')}}"></script>
<!--Custom JavaScript -->
<script src="{{URL::asset('assets/js/custom.min.js')}}"></script>
<?php if( isset($panelInit->settingsArray['gTrackId']) AND $panelInit->settingsArray['gTrackId'] != "" ): ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $panelInit->settingsArray['gTrackId']; ?>', 'auto');
ga('send', 'pageview');
</script>
<?php endif; ?>
</body>
</html>
The "login.blade.php" file exists under resources/views. The response I am getting is a blank screen with status code 200. I have tried other blades also inplace of login and still got the same response. But when I provided an invalid blade name, I got an error saying blade doesn't exist. Any help is appreciated.
What the problem is
Hmmm... To be honest - I'm not sure. I can't really find any bad part of what you're posted.
Maybe it's a caching error.
Solution suggestions
You say that you don't have php artisan working. Hmm... How do you clear the cache then? The command: php artisan cache:clear
None the less... The first command that comes to mind is to try and clear the cache and generates composer-files, with this command:
php artisan cache:clear && composer dump-autoload
But if you can't do php artisan, then maybe just do: composer dump-autoload
Further debugging
If it was me, then I would start at the routes, changing this:
Route::get('/login','LoginController#index');
to this:
dd('hey');
Route::get('/login','LoginController#index');
And then reloading the page. You should then see it say 'Hey' on the screen.
... If that works, then change it to this:
Route::get('/login','LoginController#index');
dd('hey');
Then it _SHOULDN'T say 'Hey' on the screen.
... Then I would work my way through the controller as well.
And afterwards through the view.
To find the place where it deviates what you expect should happen and what really happens.
Fun fact:
I have tried once, where I did this - and moved the dd-statement aaaaaall the way through my code. And in the end, when I simply removed the dd-statement then the unexpected behaviour was gone. It must have been some caching or something.

CSS in Public dont work in Show Controller

show function can't get the files in public
I tried in other controller without resources it can read the css at img in public sorry for my english
public function show($id)
{
$brand = Brand::where('c_id', $id)->get();
return view('brand.pick')->with('brand',$brand);
}
This is my HTML blade file
#extends('layouts.app')
#section('content')
#foreach($brand as $b)
<option value="{{$b->b_name}}" selected>{{$b->b_name}}
</option>
#endforeach
the page don't have css and image
This is in Index function the css is working when I run in show function
This is my Blade file Layout.app
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<title>{{config ('app.name')}}</title>
<link rel="icon" href="img/favicon.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- animate CSS -->
<link rel="stylesheet" href="css/animate.css">
<!-- owl carousel CSS -->
<link rel="stylesheet" href="css/owl.carousel.min.css">
<!-- themify CSS -->
<link rel="stylesheet" href="css/themify-icons.css">
<!-- flaticon CSS -->
<link rel="stylesheet" href="css/flaticon.css">
<!-- font awesome CSS -->
<link rel="stylesheet" href="css/magnific-popup.css">
<!-- swiper CSS -->
<link rel="stylesheet" href="css/swiper.min.css">
<!-- style CSS -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
#include('inc.nav');
#yield('content');
<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>
<!-- footer part start-->
<section class="footer-area section_padding">
<div class="container">
<div class="row">
<div class="col-xl-2 col-sm-4 mb-4 mb-xl-0 single-footer-
widget">
<h4>Top Products</h4>
<ul>
<li>Managed Website</li>
<li>Manage Reputation</li>
<li>Power Tools</li>
<li>Marketing Service</li>
</ul>
</div>
<div class="col-xl-2 col-sm-4 mb-4 mb-xl-0 single-footer-widget">
<h4>Quick Links</h4>
<ul>
<li>Jobs</li>
<li>Brand Assets</li>
<li>Investor Relations</li>
<li>Terms of Service</li>
</ul>
</div>
<div class="col-xl-2 col-sm-4 mb-4 mb-xl-0 single-footer-
widget">
<h4>Features</h4>
<ul>
<li>Jobs</li>
<li>Brand Assets</li>
<li>Investor Relations</li>
<li>Terms of Service</li>
</ul>
</div>
<div class="col-xl-2 col-sm-4 mb-4 mb-xl-0 single-footer-
widget">
<h4>Resources</h4>
<ul>
<li>Guides</li>
<li>Research</li>
<li>Experts</li>
<li>Agencies</li>
</ul>
</div>
<div class="col-xl-4 col-sm-8 col-md-8 mb-4 mb-xl-0 single-
footer-widget">
<h4>Newsletter</h4>
<p>You can trust us. we only send promo offers,</p>
<div class="form-wrap" id="mc_embed_signup">
<form target="_blank"
action="https://spondonit.us12.list-manage.com/subscribe/post?
u=1462626880ade1ac87bd9c93a&id=92a4423d01" method="get" class="form-
inline">
<input class="form-control" name="EMAIL"
placeholder="Your Email Address" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Your Email Address '" required=""
type="email">
<button class="click-btn btn btn-default text-
uppercase">subscribe</button>
<div style="position: absolute; left: -5000px;">
<input
name="b_36c4fd991d266f23781ded980_aefe40901a" tabindex="-1" value=""
type="text">
</div>
<div class="info"></div>
</form>
</div>
</div>
</div>
</div>
</section>
<footer class="copyright_part bottom">
<div class="container">
<div class="row align-items-center ">
<p class="footer-text m-0 col-lg-8 col-md-12"><!-- Link back
to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script>
All
rights reserved | This template is made with <i class="ti-heart" aria-
hidden="true"></i> by <a href="https://colorlib.com"
target="_blank">Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC
BY
3.0. --></p>
<div class="col-lg-4 col-md-12 text-center text-lg-right
footer-social">
<i class="ti-facebook"></i>
<i class="ti-twitter"></i>
<i class="ti-instagram"></i>
<i class="ti-skype"></i>
</div>
</div>
</div>
</footer>
<!-- footer part end-->
<!-- jquery plugins here-->
<!-- jquery -->
<script src="js/jquery-1.12.1.min.js"></script>
<!-- popper js -->
<script src="js/popper.min.js"></script>
<!-- bootstrap js -->
<script src="js/bootstrap.min.js"></script>
<!-- aos js -->
<script src="js/aos.js"></script>
<!-- easing js -->
<script src="js/jquery.magnific-popup.js"></script>
<!-- swiper js -->
<script src="js/swiper.min.js"></script>
<!-- swiper js -->
<script src="js/masonry.pkgd.js"></script>
<!-- particles js -->
<script src="js/owl.carousel.min.js"></script>
<!-- carousel js -->
<script src="js/swiper.min.js"></script>
<!-- swiper js -->
<script src="js/swiper_custom.js"></script>
<!-- custom js -->
<script src="js/custom.js"></script>
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
Use asset helper of laravel.
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
By default asset helper will search path inside public folder, or you can configure asset url in .env file.
https://laravel.com/docs/5.8/helpers#method-asset

cakePHP3 - pure html login page

i'm using cakePHP3 with AdminLTE theme, i want my login page rendered with pure html from .ctp with no additional theme view generated by controller, is there a way to accomplish that? i've already tried $this->viewBuilder()->layout(false) in my action function, but it didn't work
Create a new layout to be used for the login page, let's call the layout 'loginLayout'. Below is a sample code based on maiconpinto adminlte plugin. If you are not using the plugin, make sure you indicate the right path for your CSS and script files.
<?php use Cake\Core\Configure; ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo Configure::read('Theme.title'); ?></title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<?php echo $this->Html->css('AdminLTE./bootstrap/css/bootstrap.min'); ?>
<!-- iCheck -->
<?php echo $this->Html->css('AdminLTE./plugins/iCheck/all.css'); ?>
<!-- Font Awesome -->
<link rel="stylesheet" href='https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<?php echo $this->Html->css('AdminLTE.AdminLTE.min'); ?>
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<?php echo $this->Html->css('AdminLTE.skins/skin-'. Configure::read('Theme.skin') .'.min'); ?>
<?php echo $this->fetch('css'); ?>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition login-page">
<?php echo $this->Flash->render(); ?>
<?php echo $this->Flash->render('auth'); ?>
<?php echo $this->fetch('content'); ?>
<!-- jQuery -->
<?php echo $this->Html->script('https://code.jquery.com/jquery-3.2.1.min.js'); ?>
<!-- Bootstrap 3.3.5 -->
<?php echo $this->Html->script('AdminLTE./bootstrap/js/bootstrap.min'); ?>
<!-- iCheck -->
<?php echo $this->Html->script('AdminLTE./plugins/iCheck/icheck.min.js'); ?>
<!-- AdminLTE App -->
<?php echo $this->Html->script('AdminLTE./js/app.min'); ?>
<!-- AdminLTE for demo purposes -->
<?php echo $this->fetch('script'); ?>
<?php echo $this->fetch('scriptBottom'); ?>
<script>
$(function () {
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".navbar .menu").slimscroll({
height: "200px",
alwaysVisible: false,
size: "3px"
}).css("width", "100%");
var a = $('a[href="<?php echo $this->request->webroot . $this->request->url ?>"]');
if (!a.parent().hasClass('treeview') && !a.parent().parent().hasClass('pagination')) {
a.parent().addClass('active').parents('.treeview').addClass('active');
}
});
</script>
</body>
</html>
On your .ctp file, indicate the layout to be used
<?php
$this->layout = 'loginLayout';
?>
<div class="login-box">
<div class="login-logo">
<b>Admin</b>LTE
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Sign in to start your session</p>
<form action="../../index2.html" method="post">
<div class="form-group has-feedback">
<input type="email" class="form-control" placeholder="Email">
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" class="form-control" placeholder="Password">
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label>
<input type="checkbox"> Remember Me
</label>
</div>
</div>
<!-- /.col -->
<div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</div>
<!-- /.col -->
</div>
</form>
<div class="social-auth-links text-center">
<p>- OR -</p>
<a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-facebook"></i> Sign in using
Facebook</a>
<a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-google-plus"></i> Sign in using
Google+</a>
</div>
<!-- /.social-auth-links -->
I forgot my password<br>
Register a new membership
</div>
<!-- /.login-box-body -->
</div>
<!-- /.login-box -->

Configuring a login feature

This is my first time using a template. I'm a beginner.
Since I used adminlte template my codes stop working properly.
HTML Code:
<!DOCTYPE html>
enter code here<?php
session_start();
?>
<html>
<head>
<meta charset="UTF-8">
<title>Admin Panel | Log in</title>
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="font-awesome/font-awesome-2/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="ionicons/ionicons2/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/square/blue.css">
<style type="text/css">
.img-bg-mine{
background: url('images/loginbg.jpg') no-repeat center center fixed; background-size: cover;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition login-page img-bg-mine">
<div class="login-box">
<div class="login-logo">
<b>Student</b> Evaluation
</div>
<!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">Sign in to start your session</p>
<form action="login.php" method="post">
<div class="form-group has-feedback">
<div class="input-group">
<input type="text" class="form-control" placeholder="Enter Your Username" name="login_username" id="login_username">
<span id="errorUsername"></span>
<span class="input-group-addon">
<i class="fa fa-user"></i>
</span>
</div>
</div>
<div class="form-group has-feedback">
<div class="input-group">
<input type="password" class="form-control" placeholder="Enter Your Password" name="login_password" id="login_password">
<span id="errorPassword"></span>
<span class="input-group-addon">
<i class="fa fa-lock"></i>
</span>
</div>
<br>
<div class="row">
<div class="col-xs-12">
<button type="submit" class="btn bg-olive btn-flat pull-right btn-lg" name="login" id="login">Sign In</button>
</div>
</div>
</form>
</div>
<!-- /.login-box-body -->
</div>
<!-- jQuery 2.2.3 -->
<script src="plugins/JQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
PHP Code:
<?php
include 'dbcon.php';
?>
<?php
if(isset($_POST['login'])){
$username = mysqli_real_escape_string($conn,$_POST['login_username']);
$password = mysqli_real_escape_string($conn,$_POST['login_password']);
//select user from database
$select_user = "SELECT * from tb_admin where admin_user='$username' and admin_pass='$password'";
//run query
$login =mysqli_query($conn,$select_user);
$count =mysqli_num_rows($login);
$row= mysqli_fetch_array($login);
if ($count > 0){
session_start();
$_SESSION['id']=$row['admin_id'];
echo "<script>window.open('adminpanel.php','_self')</script>";// this part is not working it only shows the word window.open('adminpanel.php','_self') instead of showing the page adminpanel.php
}else
{
echo "<script>alert('Login failed..')</script>";// same here
echo "<script>window.open('index.php','_self')</script>";// same here
}
}
?>
It looks like my script in login.php is not working. It just shows the text nothing more.

HTML form, link error

I have a very weird problem.
I'm coding login system and i have two buttons in form; one is for submitting and second is link and is used to send user to register page.
My problem is that when i click that link form is submitted instead of redirection.
Here is link to page:
http://takeaprize.pl/login.php
And page code:
<?php
include_once 'secure/core.php';
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $settings->getSiteTitle(); ?> - Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<meta name="description" content="<?php echo $settings->getMETAdescription(); ?>" />
<meta name="keywords" content="<?php echo $settings->getMETAkeywords(); ?>" />
<link rel="icon" type="image/ico" href="assets/images/favicon.ico" />
<!-- Bootstrap -->
<link href="assets/css/vendor/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/css/minimal.css" rel="stylesheet">
<link rel="stylesheet" href="assets/js/vendor/jgrowl/css/jquery.jgrowl.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="bg-1">
<!-- Wrap all page content here -->
<div id="wrap">
<!-- Make page fluid -->
<div class="row">
<!-- Page content -->
<div id="content" class="col-md-12 full-page login">
<div class="inside-block">
<img src="assets/images/logo-big.png" alt class="logo">
<h1><strong>Welcome</strong> Guest</h1>
<h5><?php echo $settings->getSiteTitle(); ?></h5>
<form id="login_form" class="form-signin" action="">
<section>
<div class="input-group">
<input type="text" class="form-control" name="username" placeholder="Username">
<div class="input-group-addon"><i class="fa fa-user"></i></div>
</div>
<div class="input-group">
<input type="password" class="form-control" name="password" placeholder="Password">
<div class="input-group-addon"><i class="fa fa-key"></i></div>
</div>
</section>
<section class="controls">
Forgot password?
</section>
<section class="log-in">
<button class="btn btn-greensea"><i class="fa fa-lock"></i> Log In</button>
<span>or</span>
<button class="btn btn-slategray"><i class="fa fa-sign-out"></i> Create an account</button>
</section>
</form>
</div>
</div>
<!-- /Page content -->
</div>
</div>
<!-- Wrap all page content end -->
</body>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://code.jquery.com/jquery.js"></script>
<script src="assets/js/vendor/jgrowl/jquery.jgrowl.min.js"></script>
</html>
Thanks in advance for any help

Categories