Tizag Webmaster Forums  

Go Back   Tizag Webmaster Forums > User Submissions > Tutorial Forum

Reply
 
Thread Tools Display Modes
  #71  
Old 09-30-2007, 05:12 PM
hards hards is offline
Curious Visitor
 
Join Date: Sep 2007
Posts: 6
hards will become famous soon enough
Thanks a lot
techietim
Stryker250
fenderocker
Reply With Quote
  #72  
Old 09-30-2007, 09:55 PM
Dfraz Dfraz is offline
 
Join Date: Sep 2007
Location: Erm, The Music Room?
Posts: 225
Dfraz has a little shameless behaviour in the past
When u login it shows Wrong password, When the pass and user is right, Why?
Reply With Quote
  #73  
Old 10-11-2007, 11:01 AM
Silvion Silvion is offline
Newbie
 
Join Date: Oct 2007
Posts: 11
Silvion will become famous soon enough
Very impressed. Great work there mate. Will be very handy!!
Reply With Quote
  #74  
Old 09-12-2008, 04:06 PM
Les paul Les paul is offline
Curious Visitor
 
Join Date: Sep 2008
Posts: 1
Les paul will become famous soon enough
php erro rather than JavaScript error...

Hey,

A friend of mine edited the script to display an error inline via PHP rather than the JavaScript popup "wrong Password..." replace the JavaScript <script></script> tags with the following...

PHP Code:
exit;
    } 
    else {
        
$error="Wrong password, please try again.";
    }
}
?> 
then place anywhere in the page you want the error to show up:

PHP Code:
<?
    
if(strlen($error) > 0) {
        print 
"
        <p style=\"border: 1px dotted #000; padding: 4px; background-color: #FFFFE6;\">"
.$error."</p>";
    }
    
?>
I found the <script></script> tags above the Doctype causing issues in IE
Reply With Quote
  #75  
Old 10-30-2008, 03:10 PM
renpat renpat is offline
Newbie
 
Join Date: Nov 2007
Location: Netherlands
Posts: 12
renpat will become famous soon enough
I'm using a script that is similar to this one and it works perfect. Only recently a problem raised when going to one of the new pages I created.

The file is located in the same folder as the one I'm directing the people from,
it's source:
PHP Code:
<?php
session_start
();
if (empty(
$_SESSION['ingelogd']) || $_SESSION['ingelogd'] != true)  {
    
header('Location: ../login.php');
    exit;
} else { 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<pre>
<?php print_r($_SESSION); ?>
</pre>
</body>
</html>
<?php ?>
The check is exactly the same as on all the other pages I created but each time I go to this page the array is empty and I'm sent back to the login-page. (I tried without redirecting, just by using session_start(); and failed aswell)

I even tried by using the code of one of the other (working) pages but without result.
This all on the hosted site.

When I try to access the page on my loal machine there is no problem.

Does anyone have a clue?
Reply With Quote
  #76  
Old 05-11-2009, 08:27 PM
cyruskafaiwu cyruskafaiwu is offline
Newbie
 
Join Date: May 2009
Location: The Great White North
Posts: 11
cyruskafaiwu will become famous soon enough
Send a message via MSN to cyruskafaiwu
Nice, small and simple.
Reply With Quote
  #77  
Old 05-18-2009, 08:02 AM
filzn filzn is offline
Curious Visitor
 
Join Date: May 2009
Posts: 1
filzn will become famous soon enough
Very nice script!!!
Could anyone please post, if its possible, a modificacion for Username and password Login?

Thx to all
Reply With Quote
  #78  
Old 05-18-2009, 12:26 PM
renpat renpat is offline
Newbie
 
Join Date: Nov 2007
Location: Netherlands
Posts: 12
renpat will become famous soon enough
PHP Code:
<?php session_start();
$host 'localhost';
$database 'my_database';
$dbuser 'db_username';
$dbpassword 'db_password';

$db_conn mysql_connect($host$dbuser$dbpassword) or die('Not connected : ' mysql_error());


if(isset(
$_POST['username']) && $_POST['username'] != ''){
   if(isset(
$_POST['password']) && $_POST['password'] != ''){
       
mysql_select_db($database$db_conn);
       
$query_rs_userdetails "SELECT * from `users` WHERE userid='$_POST['username']' AND password = '$_POST['password']' LIMIT 1"//I limit it allways to 1 to be sure I only get 1 or 0 results
       
$rs_userdetails  mysql_query($query_rs_userdetails$db_conn) or die(mysql_error());
       
$row_rs_userdetails mysql_fetch_assoc($rs_userdetails);
       
$totalRows_rs_userdetails mysql_num_rows($rs_userdetails );

       if(
$totalRows_rs_userdetails  == 1){
             
$_SESSION['myloggedstate'] == true;
             
// set any other session parameter you want to set with the result here (like the emnail-address etc)

            
$location 'inlogged_page.php';
      } else {
            
$location 'not_inlogged_page.php';
     }
      
header('Location: '.$location);
      exit();
   }
}
.......
html of the page

I hope this is helpfull

Last edited by renpat; 05-18-2009 at 12:29 PM.
Reply With Quote
  #79  
Old 11-06-2009, 10:48 AM
evrman evrman is offline
Curious Visitor
 
Join Date: Nov 2009
Posts: 1
evrman will become famous soon enough
Ok, I think I've got myself into a corner on this one. Just came across your script the other day and started playing with it. On the login.php page I changed the "index.php" to the html page I was using. It works fine on my Mac but on my boss's PC just loops him back to the login.php page.

I changed index.php to directory.php, then changed my index.php page to directory.php as well, to which I added my html. same result. Other than that I haven't changed anything. Have any idea what I might be doing wrong?
Thanks!
Reply With Quote
  #80  
Old 11-06-2009, 11:07 AM
renpat renpat is offline
Newbie
 
Join Date: Nov 2007
Location: Netherlands
Posts: 12
renpat will become famous soon enough
Make sure the variable in the session you check looks for is mentioned in the page you are headering to:

PHP Code:
if($totalRows_rs_userdetails  == 1){ 
             
$_SESSION['myloggedstate'] == true
             
// set any other session parameter you want to set with the result  here (like the emnail-address etc) 

            
$location 'inlogged_page.php'

on the new page the checked must be:
PHP Code:
session_start(); 
if (empty(
$_SESSION['myloggedstate']) || $_SESSION['myloggedstate'] != true)  { 
    
header('Location: ../login.php'); 
    exit; 
} else { 
?>
rest of page 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:35 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008, Tizag