No Such File Directoy - php

Dont know whats the reason behind because my code wont run. Its say's there's no such file directory but there is and index inside a folder. Does my code or the server?Dont know whats the reason behind because my code wont run. Its say's there's no such file directory but there is and index inside a folder. Does my code or the server?
Please see images below. Thanks!.
https://ibb.co/fKqZ5m
https://ibb.co/cDynQm
code:
navbar.php
<?php include('tooltip.php'); ?>
<div class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a 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>
</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class=""><a rel="tooltip" data-placement="bottom" title="Home" id="home" href="index.php"><i class="icon-home icon-large"></i> Home</a> </li>
<!-- <li class="divider-vertical"></li> -->
<li class="">
<a rel="tooltip" data-placement="bottom" title="Click Here to About" id="login" href="about.php"><i class="icon-info-sign icon-large"></i> About</a>
</li>
<li class="">
<a rel="tooltip" data-placement="bottom" title="Click Here to Admin Login" id="login" href="librarian/index.php"><i class="icon-user icon-large"></i> Admin</a>
</li>
<!--<li class="">
<a rel="tooltip" data-placement="bottom" title="Click Here to Register Member" id="login" href="register_member.php"><i class="icon-user icon-large"></i> Register Member</a>
</li>-->
</ul>
</div>
</div>
</div>
</div>
index.php inside librarian directory.
<?php
include('header.php');
include('navbar.php');
?>
<div class="container">
<div class="margin-top">
<div class="row">
<div class="span12">
<div class="login">
<div class="log_txt">
<p><strong><center>Login</center></strong></p>
</div>
<form class="form-horizontal" method="POST">
<div class="control-group">
<label class="control-label" for="inputEmail">Username</label>
<div class="controls">
<input type="text" name="username" id="username" placeholder="Username" required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">
<input type="password" name="password" id="password" placeholder="Password" required>
</div>
</div>
<div class="control-group">
<div class="controls">
<button id="login" name="submit" type="submit" class="btn"><i class="icon-signin icon-large"></i> Submit</button>
</div>
</div>
<?php
if (isset($_POST['submit'])){
session_start();
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = mysql_query($query)or die(mysql_error());
$num_row = mysql_num_rows($result);
$row=mysql_fetch_array($result);
if( $num_row > 0 ) {
header('location:users.php');
$_SESSION['id']=$row['user_id'];
}
else{ ?>
<div class="alert alert-danger">Access Denied</div>
<?php
}}
?>
</form>
</div>
</div>
</div>
</div>
</div>

It should be ../librarian/index.php because navbar.php is in a different directory (youth).
Most likely your tree is like this:
htdocs
- librarian
- index.php
- youth
- navbar.php
Using ../ will move you up a directory then you can target librarian.

Related

Second tab not showing in form boostrap

This my code
I have a form with bootstrap and 2 tabs, when I display the form shows the first tab, but when I click on the second tab nothing happens.
I dont know what I missing.......................................
...............................................................
<div class="container" style="margin-top:70px">
<div class ="card bg-light col-8">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs pull-left">
<li class="nav-item">
<a class="nav-link active" href="#contactos">Contactos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#domicilio">Domicilio</a>
</li>
</ul>
</div>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"])."?opc=".$opc."&id=".$id;?>" method="post" id ="formulario" class="tab-content">
<div class="tab-pane fade show active" id="contactos">
<div class="form-row" > <!--linea1-->
<div class="col-3">
<div class="form-group">
<label for="text1">ID</label>
<input id="text1" name="text1" type="text" class="form-control" value="<?php echo $campo1?>" readonly>
</div>
</div>
</div> <!--linea1-->
</div> <!--tab contacto-->
<div class="tab-pane fade" id="domicilio">
<div class="form-row" > <!--linea5-->
<div class="col">
<div class="form-group">
<label for="text11">Calle</label>
<input id="text11" name="text11" type="text" class="form-control" value="<?php echo $campo11?>" required <?php if ($opc == 'C'){echo "readonly";}?>>
<span class="error"><?php echo $error_text11;?></span>
</div>
</div>
</div> <!--linea5-->
</div> <!--tab domicilio-->
<div class="form-row"> <!--linea9-->
<div class="col-6">
<div class="form-group">
Cancelar
<button name="submit" type="submit" class="btn btn-primary">Confirmar</button>
</div>
</div>
</div> <!--linea9-->
</form>
</div>
</div>
for bootstrap 5 as per docs you need to add data-bs-toggle="tab" data-bs-target="#{tabID}" type="button" role="tab" aria-controls="{tabID}" aria-selected="true" to the a tag with class nav-link
so your code should be
<div class="container" style="margin-top:70px">
<div class ="card bg-light col-8">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs pull-left">
<li class="nav-item">
<a class="nav-link active" href="#contactos" data-bs-toggle="tab" data-bs-target="#contactos" type="button" role="tab" aria-controls="contactos" aria-selected="true">Contactos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#domicilio" data-bs-toggle="tab" data-bs-target="#domicilio" type="button" role="tab" aria-controls="domicilio" aria-selected="true">Domicilio</a>
</li>
</ul>
</div>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"])."?opc=".$opc."&id=".$id;?>" method="post" id ="formulario" class="tab-content">
<div class="tab-pane fade show active" id="contactos">
<div class="form-row" > <!--linea1-->
<div class="col-3">
<div class="form-group">
<label for="text1">ID</label>
<input id="text1" name="text1" type="text" class="form-control" value="<?php echo $campo1?>" readonly>
</div>
</div>
</div> <!--linea1-->
</div> <!--tab contacto-->
<div class="tab-pane fade" id="domicilio">
<div class="form-row" > <!--linea5-->
<div class="col">
<div class="form-group">
<label for="text11">Calle</label>
<input id="text11" name="text11" type="text" class="form-control" value="<?php echo $campo11?>" required <?php if ($opc == 'C'){echo "readonly";}?>>
<span class="error"><?php echo $error_text11;?></span>
</div>
</div>
</div> <!--linea5-->
</div> <!--tab domicilio-->
<div class="form-row"> <!--linea9-->
<div class="col-6">
<div class="form-group">
Cancelar
<button name="submit" type="submit" class="btn btn-primary">Confirmar</button>
</div>
</div>
</div> <!--linea9-->
</form>
</div>
</div>
working example JSfiddle
Edit:
if you are using bootstrap 4 just remove -bs from the data attributes so it would be data-toggle="tab" data-target="#{tabID}" type="button" role="tab" aria-controls="{tabID}" aria-selected="true"
<div class="container" style="margin-top:70px">
<div class ="card bg-light col-8">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs pull-left">
<li class="nav-item">
<a class="nav-link active" href="#contactos" data-toggle="tab" data-target="#contactos" type="button" role="tab" aria-controls="contactos" aria-selected="true">Contactos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#domicilio" data-toggle="tab" data-target="#domicilio" type="button" role="tab" aria-controls="domicilio" aria-selected="true">Domicilio</a>
</li>
</ul>
</div>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"])."?opc=".$opc."&id=".$id;?>" method="post" id ="formulario" class="tab-content">
<div class="tab-pane fade show active" id="contactos">
<div class="form-row" > <!--linea1-->
<div class="col-3">
<div class="form-group">
<label for="text1">ID</label>
<input id="text1" name="text1" type="text" class="form-control" value="<?php echo $campo1?>" readonly>
</div>
</div>
</div> <!--linea1-->
</div> <!--tab contacto-->
<div class="tab-pane fade" id="domicilio">
<div class="form-row" > <!--linea5-->
<div class="col">
<div class="form-group">
<label for="text11">Calle</label>
<input id="text11" name="text11" type="text" class="form-control" value="<?php echo $campo11?>" required <?php if ($opc == 'C'){echo "readonly";}?>>
<span class="error"><?php echo $error_text11;?></span>
</div>
</div>
</div> <!--linea5-->
</div> <!--tab domicilio-->
<div class="form-row"> <!--linea9-->
<div class="col-6">
<div class="form-group">
Cancelar
<button name="submit" type="submit" class="btn btn-primary">Confirmar</button>
</div>
</div>
</div> <!--linea9-->
</form>
</div>
</div>
working fiddle for bootstrap 4

How can I send HTML with BOOTSTRAP email

How do I send HTML email so that it will look nice with Bootstrap 4? When I send mail it looks nice, but when receiver gets it it looks bad.
here's code:
https://jsfiddle.net/bluemilkyh/6m4v9pnf/1/
I'd also like to make footer form (it's about news subscription) when they fill the form and press the button it would save to my database (I have database already which is not localhost...).
code:
<!DOCTYPE html>
<html>
<head>
<title>Stanovanja Fink</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<!-- navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="http://localhost/stanovanjefink/index.php">Stanovanja Fink</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/stanovanjeanja.php">Stanovanje Anja</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/stanovanjealjaz.php">Stanovanje Aljaž</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/kontakt.php">Kontakt</a>
</li>
</ul>
</form>
</div>
</nav>
<hr>
<body>
<div class="p-3 mb-2 bg-light text-dark container text-center d-flex flex-column align-items-center">
<h2 form-inline justify-content-center>Rezervacija Stanovanje Aljaz</h2>
<br>
<br>
<label ><b>Ime: </b></label>
<input type="text" class=" form-control col-sm-6 " disabled value="" >
<label><b>Priimek: </b></label>
<input type="text" class="form-control col-sm-6 " disabled value="" ><label><b>Telefon: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>E-mail: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Prihod: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Odhod: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Cena: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<br>
<h3>Informacije </h3>
<p><i class="gdlr-icon fa fa-map-marker"></i><b> Lokacija:</b> Pod Lipovim trotom</p>
<p><i class="gdlr-icon fa fa-phone"></i> <b>Telefon:</b> +36 41 8813 49219 </p>
<p><i class="gdlr-icon fa fa-envelope"></i> <b>Email :</b> +36 41 88213 49912 </p>
<br>
</div>
</body>
<footer class="bg-dark text-center">
<div class="container p-4">
<form action="kontakt.php">
<div class="row d-flex justify-content-center">
<div class="col-auto">
<p class="pt-2" style="color:white;">
<b>Naroci se na novice: </b>
</p>
</div>
<div class="col-md-5 col-12">
<div class="form-outline form-white mb-4">
<input type="email" placeholder="email" name="novice" class="form-control" required>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-outline-light mb-4">
Narocite se
</button>
</div>
</div>
<section class="mb-4">
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-facebook-f"></i
></a>
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-twitter"></i
></a>
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-instagram"></i></a>
</section>
</form>
</div>
<div class="text-center p-3" style="background-color:black; color:gray;">
© 2020 Stanovanja Fink
</div>
</div>
</footer>`
I am guessing you are using bootstrap. Use bootstrap for e-mail instead. Web frameworks will NOT play nicely with e-mail. HTML e-mail have different rules and best practices on how to develop markup for it, than classic web sites.
Possibly related:
Look for the top answer here to get a general idea about developing for e-mail: CSS Email Template at Outlook does not display correctly
Here for basic layout: How to make a fluid width email with a max width

Notice: Undefined variable username when I try to echo $username [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 5 years ago.
I'm a beginner when it comes to PHP and I've been trying the whole day to fix this error. I'm trying to make a profile page here where the user will enter his username and that username will be saved in the MySQL database then I want the username to print on the username blank which he/she used to fill in the first place. Now when I enter the username, the username gets inserted in the database. But it doesn't get echo'd/printed on the blank like I want it to.
user.php:
<?php
ini_set('display_errors', 1); ini_set('log_errors',1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
/* Displays user information and some useful messages */
session_start();
include 'db.php';
// Check if user is logged in using the session variable
if ( $_SESSION['logged_in'] != 1 ) {
$_SESSION['message'] = "You must log in before viewing your profile page!";
header("location: error.php");
}
else {
// Makes it easier to read
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$email = $_SESSION['email'];
$active = $_SESSION['active'];
$username = $_SESSION['username'];
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="assets/img/favicon.ico">
<title>Social Junction | User Profile</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<!-- Animation library for notifications -->
<link href="assets/css/animate.min.css" rel="stylesheet"/>
<!-- Light Bootstrap Table core CSS -->
<link href="assets/css/light-bootstrap-dashboard.css" rel="stylesheet"/>
<!-- CSS for Demo Purpose, don't include it in your project -->
<link href="assets/css/demo.css" rel="stylesheet" />
<!-- Fonts and icons -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<link href="assets/css/pe-icon-7-stroke.css" rel="stylesheet" />
</head>
<body>
<div class="wrapper">
<div class="sidebar" data-color="blue" data-image="http://www.zastavki.com/pictures/originals/2015/Creative_Wallpaper_Set_of_business_people_100390_.jpg">
<!-- you can change the color of the sidebar using: data-color="blue | azure | green | orange | red | purple" -->
<div class="sidebar-wrapper">
<div class="pic"></div>
<div class="logo">
<a href="#">
<span style="font-size: 28px;">Hello <span style="font-weight: bold;"><?php echo $first_name.' '.$last_name; ?>!</span></span>
</a>
</div>
<ul class="nav">
<li>
<a href="dashboard.php">
<i class="pe-7s-graph"></i>
<p>Dashboard</p>
</a>
</li>
<li class="active">
<a href="user.html">
<i class="pe-7s-user"></i>
<p>User Profile</p>
</a>
</li>
</ul>
</div>
</div>
<div class="main-panel">
<nav class="navbar navbar-default navbar-fixed">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation-example-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Profile</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-dashboard"></i>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-globe"></i>
<b class="caret"></b>
<span class="notification">5</span>
</a>
<ul class="dropdown-menu">
<li>Notification 1</li>
<li>Notification 2</li>
<li>Notification 3</li>
<li>Notification 4</li>
<li>Another notification</li>
</ul>
</li>
<li>
<a href="">
<i class="fa fa-search"></i>
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="">
Account
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something</li>
<li>Another action</li>
<li>Something</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li>
<a href="#">
Log out
</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<div class="card">
<div class="header">
<h4 class="title">Edit Profile</h4>
</div>
<div class="content">
<form method="POST" action="action.php">
<div class="row">
<div class="col-md-5">
<div class="form-group">
<label>Company (disabled)</label>
<input type="text" class="form-control" disabled placeholder="Company" value="Creative Code Inc.">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Username</label>
<input name="username" type="text" class="form-control" placeholder="Username" value="<?php echo $username; ?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" placeholder="Email" value="<?php echo $email; ?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>First Name</label>
<input type="text" name="first_name" class="form-control" placeholder="Company" value="<?php echo $first_name; ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Last Name</label>
<input type="text" name="last_name" class="form-control" placeholder="Last Name" value="<?php echo $last_name; ?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Address</label>
<input type="text" name="address" class="form-control" placeholder="Home Address" value="Bld Mihail Kogalniceanu, nr. 8 Bl 1, Sc 1, Ap 09">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>City</label>
<input type="text" name="city" class="form-control" placeholder="City" value="Mike">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Country</label>
<input type="text" name="country" class="form-control" placeholder="Country" value="Andrew">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Postal Code</label>
<input type="number" class="form-control" placeholder="ZIP Code">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>About Me</label>
<textarea name="aboutme" rows="5" class="form-control" placeholder="Here can be your description" value="Mike">Lamborghini Mercy, Your chick she so thirsty, I'm in that two seat Lambo.</textarea>
</div>
</div>
</div>
<button type="submit" class="btn btn-info btn-fill pull-right">Update Profile</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card card-user">
<div class="image">
<img src="https://ununsplash.imgix.net/photo-1431578500526-4d9613015464?fit=crop&fm=jpg&h=300&q=75&w=400" alt="..."/>
</div>
<div class="content">
<div class="author">
<a href="#">
<img class="avatar border-gray" src="assets/img/faces/face-3.jpg" alt="..."/>
<h4 class="title"><?php echo $first_name; ?><br />
<small><?php echo $last_name; ?></small>
</h4>
</a>
</div>
<p class="description text-center"> "Lamborghini Mercy <br>
Your chick she so thirsty <br>
I'm in that two seat Lambo"
</p>
</div>
<hr>
<div class="text-center">
<button href="#" class="btn btn-simple"><i class="fa fa-facebook-square"></i></button>
<button href="#" class="btn btn-simple"><i class="fa fa-twitter"></i></button>
<button href="#" class="btn btn-simple"><i class="fa fa-google-plus-square"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container-fluid">
<nav class="pull-left">
<ul>
<li>
<a href="#">
Home
</a>
</li>
<li>
<a href="#">
Company
</a>
</li>
<li>
<a href="#">
Portfolio
</a>
</li>
<li>
<a href="#">
Blog
</a>
</li>
</ul>
</nav>
<p class="copyright pull-right">
© 2016 Creative Tim, made with love for a better web
</p>
</div>
</footer>
</div>
</div>
</body>
<!-- Core JS Files -->
<script src="assets/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>
<!-- Checkbox, Radio & Switch Plugins -->
<script src="assets/js/bootstrap-checkbox-radio-switch.js"></script>
<!-- Charts Plugin -->
<script src="assets/js/chartist.min.js"></script>
<!-- Notifications Plugin -->
<script src="assets/js/bootstrap-notify.js"></script>
<!-- Google Maps Plugin -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<!-- Light Bootstrap Table Core javascript and methods for Demo purpose -->
<script src="assets/js/light-bootstrap-dashboard.js"></script>
<!-- Light Bootstrap Table DEMO methods, don't include it in your project! -->
<script src="assets/js/demo.js"></script>
</html>
TL;DR: This is the main line where I'm trying to echo $username:
<div class="col-md-3">
<div class="form-group">
<label>Username</label>
<input name="username" type="text" class="form-control" placeholder="Username" value="<?php echo $username; ?>">
</div>
</div>
And this is the form's action.php:
<?php
ini_set('display_errors', 1); ini_set('log_errors',1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect('localhost', 'id1753243_venom', 'roushan123', 'id1753243_gameware_01');
if(!$con)
{
echo 'Not connected to the server';
}
if(isset($_POST['username'])){ $username = $_POST['username'];
$sql = "UPDATE users SET username='".mysqli_real_escape_string($con,$username)."' WHERE id = 1";
$insert = mysqli_query($con,$sql);
}
if(!$insert)
{
echo 'Not inserted';
}
else
{
echo 'Inserted';
}
header("refresh:2; url=user.php");
?>
Username gets successfully inserted in MySQL database BUT I can't get it to print on the form blank. Why is that?
NOTE: I did not code the login system. It already had variables defined e.g email, fname, lname so it was easy for me to echo them on the blanks. I have been searching for help for 2 days. Can't fix it yet. I'm hoping someone here can help me.
Change your action.php with below code
<?php
session_start(); //---> start session
ini_set('display_errors', 1); ini_set('log_errors',1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect('localhost', 'id1753243_venom', 'roushan123', 'id1753243_gameware_01');
if(!$con)
{
echo 'Not connected to the server';
}
if(isset($_POST['username']))
{
$username = $_POST['username'];
$sql = "UPDATE users SET username='".mysqli_real_escape_string($con,$username)."' WHERE id = 1";
$insert = mysqli_query($con,$sql);
$_SESSION['username'] = $username; //---> this will store username into session variable
}
if(!$insert)
{
echo 'Not inserted';
}
else
{
echo 'Inserted';
}
header("refresh:2; url=user.php");
?>
If you need more guidelines on this let me know... I'm happy to help you with.

Data printed on form duplicates when I switch accounts?

I'm trying to create a profile page with blanks like username, city etc. I have successfully stored username & city in the MySQL Database using the UPDATE query. I have set the WHERE condition according to the email of the users. I have made 2 accounts with separates emails, for testing purposes. When I logged in from account #1, entered username & id, it was successfully stored in the correct row. Then I logged out, and logged in from account #2, and the username & city I entered in account #1 was duplicated and printed on blanks of account #2. BUT in database, the data was still distinguished until I pressed ENTER. So my question is, why is this happening and how do I fix this?
Action.php:
<?php
session_start(); //---> start session
ini_set('display_errors', 1); ini_set('log_errors',1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect('localhost', 'id1753243_venom', 'roushan123', 'id1753243_gameware_01');
if(!$con)
{
echo 'Not connected to the server';
}
$city = $_SESSION['city'];
$city = $_POST['city'];
if(isset($_POST['username']))
if(isset($_POST['city']))
{
$username = $_POST['username'];
$sql = "UPDATE users SET username='".mysqli_real_escape_string($con,$username)."', city = '$city' WHERE email='".mysqli_real_escape_string($con,$_SESSION['email'])."‌​'";
$insert = mysqli_query($con,$sql);
$_SESSION['username'] = $username; //---> this will store username into session variable
$_SESSION['city'] = $city; //---> this will store city into session variable
}
if(!$insert)
{
echo 'Not inserted';
}
else
{
echo 'Inserted';
}
header("refresh:2; url=user.php");
?>
And this is the user.php:
<?php
ini_set('display_errors', 1); ini_set('log_errors',1); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
/* Displays user information and some useful messages */
session_start();
include 'db.php';
// Check if user is logged in using the session variable
if ( $_SESSION['logged_in'] != 1 ) {
$_SESSION['message'] = "You must log in before viewing your profile page!";
header("location: error.php");
}
else {
// Makes it easier to read
$first_name = $_SESSION['first_name'];
$last_name = $_SESSION['last_name'];
$email = $_SESSION['email'];
$active = $_SESSION['active'];
$username = $_SESSION['username'];
$city = $_SESSION['city'];
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/png" href="assets/img/favicon.ico">
<title>Social Junction | User Profile</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" />
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<!-- Animation library for notifications -->
<link href="assets/css/animate.min.css" rel="stylesheet"/>
<!-- Light Bootstrap Table core CSS -->
<link href="assets/css/light-bootstrap-dashboard.css" rel="stylesheet"/>
<!-- CSS for Demo Purpose, don't include it in your project -->
<link href="assets/css/demo.css" rel="stylesheet" />
<!-- Fonts and icons -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<link href="assets/css/pe-icon-7-stroke.css" rel="stylesheet" />
</head>
<body>
<div class="wrapper">
<div class="sidebar" data-color="blue" data-image="http://www.zastavki.com/pictures/originals/2015/Creative_Wallpaper_Set_of_business_people_100390_.jpg">
<!-- you can change the color of the sidebar using: data-color="blue | azure | green | orange | red | purple" -->
<div class="sidebar-wrapper">
<div class="pic"></div>
<div class="logo">
<a href="#">
<span style="font-size: 28px;">Hello <span style="font-weight: bold;"><?php echo $first_name.' '.$last_name; ?>!</span></span>
</a>
</div>
<ul class="nav">
<li>
<a href="dashboard.php">
<i class="pe-7s-graph"></i>
<p>Dashboard</p>
</a>
</li>
<li class="active">
<a href="user.html">
<i class="pe-7s-user"></i>
<p>User Profile</p>
</a>
</li>
</ul>
</div>
</div>
<div class="main-panel">
<nav class="navbar navbar-default navbar-fixed">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation-example-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Profile</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-dashboard"></i>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-globe"></i>
<b class="caret"></b>
<span class="notification">5</span>
</a>
<ul class="dropdown-menu">
<li>Notification 1</li>
<li>Notification 2</li>
<li>Notification 3</li>
<li>Notification 4</li>
<li>Another notification</li>
</ul>
</li>
<li>
<a href="">
<i class="fa fa-search"></i>
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="">
Account
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>Action</li>
<li>Another action</li>
<li>Something</li>
<li>Another action</li>
<li>Something</li>
<li class="divider"></li>
<li>Separated link</li>
</ul>
</li>
<li>
<a href="index.php">
Log out
</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<div class="card">
<div class="header">
<h4 class="title">Edit Profile</h4>
</div>
<div class="content">
<form method="POST" action="action.php">
<div class="row">
<div class="col-md-5">
<div class="form-group">
<label>Company (disabled)</label>
<input type="text" class="form-control" disabled placeholder="Company" value="Creative Code Inc.">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label>Username</label>
<input name="username" type="text" class="form-control" placeholder="Username" value="<?php echo $username; ?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" placeholder="Email" value="<?php echo $email; ?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>First Name</label>
<input type="text" name="first_name" class="form-control" placeholder="Company" value="<?php echo $first_name; ?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Last Name</label>
<input type="text" name="last_name" class="form-control" placeholder="Last Name" value="<?php echo $last_name; ?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Address</label>
<input type="text" name="address" class="form-control" placeholder="Home Address" value="Bld Mihail Kogalniceanu, nr. 8 Bl 1, Sc 1, Ap 09">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>City</label>
<input type="text" name="city" class="form-control" placeholder="City" value="<?php echo $_SESSION['city']; ?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Country</label>
<input type="text" name="country" class="form-control" placeholder="Country" value="Andrew">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Postal Code</label>
<input type="number" class="form-control" placeholder="ZIP Code">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>About Me</label>
<textarea name="aboutme" rows="5" class="form-control" placeholder="Here can be your description" value="Mike">Lamborghini Mercy, Your chick she so thirsty, I'm in that two seat Lambo.</textarea>
</div>
</div>
</div>
<button type="submit" class="btn btn-info btn-fill pull-right">Update Profile</button>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card card-user">
<div class="image">
<img src="https://ununsplash.imgix.net/photo-1431578500526-4d9613015464?fit=crop&fm=jpg&h=300&q=75&w=400" alt="..."/>
</div>
<div class="content">
<div class="author">
<a href="#">
<img class="avatar border-gray" src="assets/img/faces/face-3.jpg" alt="..."/>
<h4 class="title"><?php echo $first_name; ?><br />
<small><?php echo $username; ?></small>
</h4>
</a>
</div>
<p class="description text-center"> "Lamborghini Mercy <br>
Your chick she so thirsty <br>
I'm in that two seat Lambo"
</p>
</div>
<hr>
<div class="text-center">
<button href="#" class="btn btn-simple"><i class="fa fa-facebook-square"></i></button>
<button href="#" class="btn btn-simple"><i class="fa fa-twitter"></i></button>
<button href="#" class="btn btn-simple"><i class="fa fa-google-plus-square"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container-fluid">
<nav class="pull-left">
<ul>
<li>
<a href="#">
Home
</a>
</li>
<li>
<a href="#">
Company
</a>
</li>
<li>
<a href="#">
Portfolio
</a>
</li>
<li>
<a href="#">
Blog
</a>
</li>
</ul>
</nav>
<p class="copyright pull-right">
© 2016 Creative Tim, made with love for a better web
</p>
</div>
</footer>
</div>
</div>
</body>
<!-- Core JS Files -->
<script src="assets/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js" type="text/javascript"></script>
<!-- Checkbox, Radio & Switch Plugins -->
<script src="assets/js/bootstrap-checkbox-radio-switch.js"></script>
<!-- Charts Plugin -->
<script src="assets/js/chartist.min.js"></script>
<!-- Notifications Plugin -->
<script src="assets/js/bootstrap-notify.js"></script>
<!-- Google Maps Plugin -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<!-- Light Bootstrap Table Core javascript and methods for Demo purpose -->
<script src="assets/js/light-bootstrap-dashboard.js"></script>
<!-- Light Bootstrap Table DEMO methods, don't include it in your project! -->
<script src="assets/js/demo.js"></script>
</html>
I know the code is not secure, this is just for test purposes. Help is highly appreciated.

Experiencing Undefined Index and session already started

I have tried some answers given here on stackoverflow relating to undefined index and session already started, but still dont seem to get whats wrong.
the below code is the whole code in the index.php file
Please someone should guide me or assist me on what im doing wrongly or didnt get right.
<?php
// check for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit('Sorry, this script does not run on a PHP version smaller than 5.3.7 !');
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once('./php-login-advanced-master/libraries/password_compatibility_library.php');
}
// include the config
require_once('./php-login-advanced-master/config/config.php');
// include the to-be-used language, english by default. feel free to translate your project and include something else
require_once('./php-login-advanced-master/translations/en.php');
// include the PHPMailer library
require_once('./php-login-advanced-master/libraries/PHPMailer.php');
// load the login class
require_once('./php-login-advanced-master/classes/Login.php');
// load match class
require_once('./php_scrips/matching.php');
// load the registration class
require_once('./php-login-advanced-master/classes/Registration.php');
// create the registration object. when this object is created, it will do all registration stuff automatically
// so this single line handles the entire registration process.
$registration = new Registration();
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process.
$login = new Login();
//create a match object
$match = new match();
?>
<body>
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<i class="fa fa-user"></i> <?php echo $_SESSION[user_name] ?> <b class="caret"></b>
<ul class="dropdown-menu">
<?php
if(isset($_SESSION['user_email'])){
echo '
<li><i class="fa fa-dashboard"></i> My Dashboard</li>
<li><i class="fa fa-user"></i> My Profile</li>';
if($_SESSION['user_level']=='ADMINISTRATOR'){
echo '<li>Rematch Member</li>
<li>Set User Recovery Question</li>
<li>Rematch Admins</li>';
}
echo '
<li><i class="fa fa-warning"></i> Pending Payments</li>
<li><i class="fa fa-money"></i> Paid Members</li>
<li class="divider"></li>
<li>
<i class="fa fa-fw fa-power-off"></i> Log Out
</li>';
}?>
</ul>
</li>
</ul>
<?php
if(isset($_SESSION['user_email'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active"><i class="fa fa-dashboard"></i> My Dashboard</li>
<li><i class="fa fa-user"></i> My Profile</li>';
if($_SESSION['user_level']=='ADMINISTRATOR'){
echo '<li>Rematch Member</li>
<li>Set User Recovery Question</li>
<li>Rematch Admins</li>';
}
echo '
<li><i class="fa fa-warning"></i> Pending Payments</li>
<li><i class="fa fa-money"></i> Paid Members</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>Statistics Overview</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong>Please note that your account will be automatically deleted once you complete your cycle.<br/>To continue with the TapFortune system for the 2nd or as many times as posible, you have to register for every cycle.
</div>
</div>
</div>
<!-- /.row -->';
$match->to_pay($_SESSION['user_to_pay'],$_SESSION['user_status']);
$match->to_get($_SESSION['user_email'],$_SESSION['user_status']);
echo '<!--
<div class="row">
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Last 10 Sign Ups</h3>
</div>
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
</div>
<div class="text-right">
See More <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
</div>
</div>
</div>-->
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && !isset($_GET['reg']) && !isset($_GET['password_rest']) && !isset($_SESSION['user_reset'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Login
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Login
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">'
.$registration->messages['recovery_reset_successful'].'
<form method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<label for="username">Email</label>
<input type="text" name="user_name" class="form-control" placeholder="Enter Email">
</div>'
.$login->errors['invalid_email'].'
<div class="form-group">
<label for="username">Password</label>
<input type="password" name="user_password" class="form-control" placeholder="Enter Password">
</div>'
.$login->errors['Login_failed'].$login->errors['wrong_password'].'
<div class="checkbox">
<label>
<input type="checkbox" name="user_rememberme" value="1">
Remember me </label>
</div>
<div>
<input type="submit" name="login" value="Sign In" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
<div>
Forgotten password
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_GET['password_rest'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Password Reset
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Password Reset
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">
<form method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<label for="username">Email</label>
<input type="text" name="user_email" class="form-control" placeholder="Enter Email">
</div>'
.$registration->errors['user_email_error'].'
<div class="form-group">
<label for="user_question">Recovery Question:
<select name="user_question" class="form-control">
<option value="" selected="selected">select Recovery Question</option>
<option value="1">My pets name</option>
<option value="2">Mothers maiden name</option>
<option value="3">My First car</option>
<option value="4">My favourite uncle\'s name</option>
<option value="5">My favourite childs name</option>
</select>
</label>
'.$registration->errors['recovery_question'].'
</div>
<div class="form-group">
<label for="user_answer">Answer:
<input type="text" name="user_answer" class="form-control"/>
'.$registration->errors['recovery_answer'].'
</label>
</div>
<div>
<input type="submit" name="verify_me" value="Verify Me" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_SESSION['user_reset'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Password Reset
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Password Reset
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">'
.$registration->messages['recovery_reset_successful'].'
<form method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="user_email" value="'.$_SESSION['user_reset'].'">
<div class="form-group">
<label for="username">New Password</label>
<input type="text" name="user_password" class="form-control" placeholder="Enter New Password">
</div>
<div class="form-group">
<label for="username">Repeat Password</label>
<input type="text" name="user_password_repeat" class="form-control" placeholder="Repeat New Password">
</div>'
.$registration->errors['user_password_error'].''
.$registration->errors['user_password_repeat_error'].'
<div>
<input type="submit" name="password_rest" value="Reset Password" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_GET['reg'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li>Login</li>
<li class="active">Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Sign Up
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong>Please we advice you have your mobile banking available to you in order to avoid being removed from the system due to inability to pay in 24 hours.
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-12 col-sm-10" style="padding-top:30px; padding-bottom:5px">
'.$registration->messages['success'].'
'.$registration->errors['registration_error'].'
<form method="post">
<label for="mobile_number">Phone:
<input type="text" name="mobile_number" class="form-control" />
'.$registration->errors['mobile_number_error'].'
</label><br />
<label for="user_email">Email:
<input type="email" name="user_email" class="form-control"/>
'.$registration->errors['user_email_error'].'
</label><br />
<label for="user_password_new">Password:
<input type="password" name="user_password_new" class="form-control"/>
'.$registration->errors['user_password_error'].'
</label><br />
<label for="user_password_repeat">Repeat Password:
<input type="password" name="user_password_repeat" class="form-control" />
'.$registration->errors['user_password_repeat_error'].'
</label><br />
<label for="user_amount">Amount to Cycle:
<select name="user_amount" class="form-control">
<option value="" selected="selected">Amount to cycle</option>
<option value="10,000">N 10,000</option>
<option value="20,000">N 20,000</option>
<option value="50,000">N 50,000</option>
<option value="100,000">N 100,000</option>
</select>
'.$registration->errors['user_amount_error'].'
</label><br />
<label for="user_name">Account Name(Name As it shows in your account):
<input type="text" name="user_name" class="form-control"/>
'.$registration->errors['user_name_error'].'
</label><br />
<label for="user_account_number">Account Number:
<input type="number" name="user_account_number" class="form-control"/>
'.$registration->errors['user_account_number_error'].'
</label><br />
<label for="user_bank_name">Bank Name:
<input type="text" name="user_bank_name" class="form-control"/>
'.$registration->errors['user_bank_name_error'].'
</label><br />
<label for="email">Country:
<select name="country" class="form-control">
<option value="Nigeria" selected="selected">Nigeria</option>
</select>
'.$registration->errors['country_error'].'
</label><br />
<label for="user_question">Recovery Question:
<select name="user_question" class="form-control">
<option value="" selected="selected">select Recovery Question</option>
<option value="1">My pets name</option>
<option value="2">Mothers maiden name</option>
<option value="3">My First car</option>
<option value="4">My favourite uncle\'s name</option>
<option value="5">My favourite childs name</option>
</select>
</label><br />
'.$registration->errors['recovery_question'].'
<label for="user_answer">Answer:
<input type="text" name="user_answer" class="form-control"/>
'.$registration->errors['recovery_answer'].'
</label><br />
<img src="./php-login-advanced-master/tools/showCaptcha.php" alt="captcha" /><br />
<label for="captcha">Enter the captcha above
<input type="text" name="captcha" required class="form-control"/>
</label>
'.$registration->errors['captcha_error'].'<br />
<input type="submit" name="register" value="SIGN UP" class="btn btn-success"/>
</form>
';
}?>
Registration.php session part
public function __construct()
{
session_start();
// if we have such a POST request, call the registerNewUser() method
if (isset($_POST["register"])) {
$this->registerNewUser($_POST['user_name'], $_POST['user_email'], $_POST['user_password_new'], $_POST['user_password_repeat'], $_POST["captcha"], $_POST['mobile_number'],$_POST['country'],$_POST['user_account_number'],$_POST['user_bank_name'],$_POST['user_question'],$_POST['user_answer'],$_POST['user_amount']);
}
// if we have such a POST request, call the verifyUser() method
if (isset($_POST["verify_me"])) {
$this->verifyUser($_POST['user_email'], $_POST['user_question'], $_POST['user_answer']);
}
// if we have such a POST request, call the reset_recovery() method
if (isset($_POST["reset_recovery"])) {
$this->reset_recovery($_POST['user_email'], $_POST['user_question'], $_POST['user_answer']);
}
// if we have such a POST request, call the reset_recovery() method
if (isset($_POST["password_rest"])) {
$this->reset_password($_POST['user_email'], $_POST['user_password'], $_POST['user_password_repeat']);
}
}
Session was also stated in the login file...
This is the error message i get:
PHP Notice: A session had already been started - ignoring session_start() in php-login-advanced-master/classes/Registration.php on line 39
PHP Notice: Use of undefined constant user_name - assumed 'user_name' in index.php on line 125
PHP Notice: Undefined index: user_name in index.php on line 125
PHP Notice: Undefined index: recovery_reset_successful in index.php on line 272
PHP Notice: Undefined index: invalid_email in index.php on line 278
PHP Notice: Undefined index: Login_failed in index.php on line 283
PHP Notice: Undefined index: wrong_password in index.php on line 283

Categories