Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with my login slider

Featured Replies

Hi

 

I need help to make my login slider work.

I bought a template website because i really liked the login in slider.

 

I have set up my database already but i am having trouble codeing it

 

I want it to work so when some one pressed login into to my main site also i want it to work so people can signup

 

Here is the slider Login slider

 

 

Thanks in advance for the help and please tell me if your require more info.

Hi

 

Have you got a login or register script preferably php, also how is your database set up

 

Pat

  • Author

Hi

 

Have you got a login or register script preferably php, also how is your database set up

 

Pat

 

 

I have a scrpit from another login php but it dos enot seem to work. And my database is set up by mysql

I have a scrpit from another login php but it dos enot seem to work. And my database is set up by mysql

 

Can you post the login script, also what tables and fields have you set up in your database

  • Author

CREATE TABLE IF NOT EXISTS `members` (

`id` int(11) NOT NULL auto_increment,

`username` varchar(255) NOT NULL,

`password` varchar(255) NOT NULL,

`email` varchar(255) NOT NULL,

`ip` varchar(255) NOT NULL,

`date` varchar(255) NOT NULL,

PRIMARY KEY (`id`)

) ENGINE=MyISAM AUTO_INCREMENT=1 ;

 

 

 

That is the tables

  • Author

And the login script?

 

 

 

 

That is for the login

<? 

session_start();
include_once"config.php";
if(isset($_POST['login'])){
$username= trim($_POST['username']);
$password = trim($_POST['password']);
if($username == NULL OR $password == NULL){
$final_report.="Please complete all the fields below..";
}else{
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report.="This username does not exist..";
}else{
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] == $password){
$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
$final_report.="You are about to be logged in, please wait a few moments.. <meta http-equiv='Refresh' content='2; URL=members.php'/>";
}}}}
?> 

 

 

This is for the logout

<? 
session_start();
include_once"config.php";;
session_unset('username');
session_unset('password');
echo "<meta http-equiv='Refresh' content='2; URL=login.php'/>";
?> 

 

 

register one

<? 
include_once"config.php";
if(isset($_POST['register'])){
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$memip = $_SERVER['REMOTE_ADDR'];
$date = date("d-m-Y");
if($username == NULL OR $password == NULL OR $email == NULL){
$final_report.= "Please complete the form below..";
}else{
if(strlen($username) <= 3 || strlen($username) >= 30){
$final_report.="Your username must be between 3 and 30 characters..";
}else{
$check_members = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");   
if(mysql_num_rows($check_members) != 0){
$final_report.="The username is already in use!";  
}else{ 
if(strlen($password) <= 6 || strlen($password) >= 12){
$final_report.="Your password must be between 6 and 12 digits and characters..";
}else{
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ 
$final_report.="Your email address was not valid..";
}else{
$create_member = mysql_query("INSERT INTO `members` (`id`,`username`, `password`, `email`, `ip`, `date`) 
VALUES('','$username','$password','$email','$memip','$date')"); 
$final_report.="Thank you for registering at Richies, you may login."; 
}}}}}}
?>

 

 

 

Members One

<? 
session_start();
include_once"config.php";
if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
header("Location: login.php");
}else{
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `members` WHERE username='".$_SESSION['username']."'"));
}
?>

 

 

Config file

<? 


ob_start();session_start();
$hostname = "";
$data_username = ""; //database username
$data_password = " "; //database password
$data_basename = ""; //database name
$conn = mysql_connect("".$hostname."","".$data_username."","".$data_password."");  
mysql_select_db("".$data_basename."") or die(mysql_error());  
?>

 

i have tested the above on the files they came with and it works but when i try put the code into the slider it dose not.

Can you put a demo username and password into the database.

 

save this as login.php

 

<? 

session_start();
include_once"config.php";
if(isset($_POST['login'])){
$username= trim($_POST['username']);
$password = trim($_POST['password']);
if($username == NULL OR $password == NULL){
$final_report.="Please complete all the fields below..";
}else{
$check_user_data = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'") or die(mysql_error());
if(mysql_num_rows($check_user_data) == 0){
$final_report.="This username does not exist..";
}else{
$get_user_data = mysql_fetch_array($check_user_data);
if($get_user_data['password'] == $password){
$start_idsess = $_SESSION['username'] = "".$get_user_data['username']."";
$start_passsess = $_SESSION['password'] = "".$get_user_data['password']."";
$final_report.="You are about to be logged in, please wait a few moments.. <meta http-equiv='Refresh' content='2; URL=members.php'/>";
}}}}
?> 

 

then alter the login part of the slider code as below

 

<!-- Members Login Starts -->
<div class="left">
<form class="clearfix" action="login.php" method="post">
<h1 class="padlock">Member Login</h1>
<label class="grey" for="log">Username:</label>
<input class="field" type="text" name="username" id="log" value="" size="23" />
<label class="grey" for="pwd">Password:</label>
<input class="field" type="password" name="password" id="pwd" size="23" />
<label><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" />  Remember me</label>
<div class="clear"></div>
<input type="submit" name="login" value="Login" class="bt_login" />
<a class="lost-pwd" href="[url="view-source:http://richies.me/#"]#[/url]">Lost your password?</a>
</form>

then try logging in with the demo username and password

  • Author

Nop that never worked it just hidden the slider now

Nop that never worked it just hidden the slider now

 

some code slipped in to the form try this

 

<!-- Members Login Starts -->
<div class="left">
<form class="clearfix" action="login.php" method="post">
<h1 class="padlock">Member Login</h1>
<label class="grey" for="log">Username:</label>
<input class="field" type="text" name="username" id="log" value="" size="23" />
<label class="grey" for="pwd">Password:</label>
<input class="field" type="password" name="password" id="pwd" size="23" />
<label><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me</label>
<div class="clear"></div>
<input type="submit" name="login" value="Login" class="bt_login" />
<a class="lost-pwd" href="#">Lost your password?</a>
</form>

  • Author

nop that never worked either ...its still hidden

nop that never worked either ...its still hidden

 

Thats strange it works my end, but get the following error

 

[b]Warning[/b]: session_start() [[url="http://richies.me/function.session-start"]function.session-start[/url]]: Cannot send session cache limiter - headers already sent (output started at /home/content/k/e/n/kenfoo/html/login.php:2) in [b]/home/content/k/e/n/kenfoo/html/login.php[/b] on line [b]4[/b]

 

This could be due to the opening php tag not being on the very first line on login.php

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.