Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #31  
Old June 12th, 2003, 09:27 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Dave... put ob_start(); at the very beginning of your code, and ob_flush(); at the very end of your code

Reply With Quote
  #32  
Old June 17th, 2003, 10:54 AM
imati0n imati0n is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 4 imati0n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I fixed it...

Last edited by imati0n : June 17th, 2003 at 12:02 PM.

Reply With Quote
  #33  
Old August 12th, 2003, 10:04 PM
phpbeginer phpbeginer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 phpbeginer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
need help

Thanks very much for a helpful article. I find this after searching for long time. I am using oracle as database not mysql.
So I changed code in relating to oracle database. But it did not work. hope anyone can help me on this. Any help or suggestions are appreciated. The code:
PHP Code:
<?PHP 
//check that the user is calling the page from the login form and not accessing it directly 
//and redirect back to the login form if necessary 
if (!isset($username) || !isset($password)) { 
header"Location: [url]http://www.yzhangibm/login.html[/url]" ); 

//check that the form fields are not empty, and redirect back to the login page if they are 
elseif (empty($username) || empty($password)) { 
header"Location: [url]http://www.yzhangibm/login.html[/url]" ); 

else{ 

//convert the field values to simple variables 

//add slashes to the username and md5() the password 
$user addslashes($_POST['username']); 
$pass addslashes($_POST['password']); 


//set the database connection variables 


      
require('db-include.inc');

     
$iDBConn OCILogon(DB_USERDB_PASSDB_NAME);


//connet to the database 

$result=ora_query("select * from users where username='$user' AND password='$pass'"$iDBConn); 

//check that at least one row was returned 

$iStatement = @OCIParse($iDBConn$result);

      @
OCIExecute($iStatementOCI_DEFAULT);

$rowCheck ora_num_rows($result); 
if(
$rowCheck 0){ 
while(
$row ora_fetch_array($result)){ 

  
//start the session and register a variable 

  
session_start(); 
  
session_register('username'); 

  
//successful login code will go here... 
  
echo 'Success!'

  
//we will redirect the user to another page where we will make sure they're logged in 
  
header"Location: checkLogin.php" ); 

  } 

  } 
  else { 

  
//if nothing is returned by the query, unsuccessful login code goes here... 

  
echo 'Incorrect login name or password. Please try again.'
  } 
  } 
  
?>

Reply With Quote
  #34  
Old March 30th, 2004, 02:50 PM
timlab timlab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 timlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
MySQL Error in program

This article was writen by: URL
PHP for Beginners by a Beginner: Simple Login, Logout, and Session Handling
Contributed by James Ruttan
Article Rating:URLURLURLURLURL / 18
2003-02-09
When I typed in the art. i keep coming up with this error.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/(Name withheld/public_html/unions/login.php on line 37
Incorrect login name or password. Please try again.

I have no clue what this means. Also, I tried to insert some names into the the database and can't do it. How is a person suppose to learn if the program to start off with doesn't work?

Please advise.

Last edited by timlab : March 30th, 2004 at 02:56 PM. Reason: left out name of art.

Reply With Quote
  #35  
Old March 30th, 2004, 03:12 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Let me attempt to assist you and keep you from being flamed.

Usually an incorrect username or password means that either the username you've supplied, or the password, or both, are invalid for logging into the SQL database. Post us what is on line 37 so we can analize and assist you in resolving this issue for yourself. What have you tried? Anything?

Reply With Quote
  #36  
Old April 30th, 2004, 11:09 AM
tphuynh tphuynh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 tphuynh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
unable to successfully login in?

First of all this tutorial is GREAT! Good job!

My problem is that I can't seem to login correctly. It keeps redirecting me to
the error message " Incorrect username and password"

I'm thinking it might be a database problem.. or maybe not?
This is what I have in my database:


+---------+----------+----------------------------------+
| user_id | username | password |
+---------+----------+----------------------------------+
| 1 | thanh | accc9105df5383111407fd5b41255e23 |
+---------+----------+----------------------------------+

I enter in usrename=thanh and password=tt at the login screen.

I tried echo $reult;
where
$result = mysql_query("select * from users where username='$user' AND p\
assword='$pass'");

What I got back was "Resource id #2" . I so I tried echo the $rowCheck and
got back 0. why?

Please help me!

Reply With Quote
  #37  
Old May 23rd, 2004, 01:35 PM
CouRage CouRage is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 1 CouRage User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i have a problem with the session_start() function.
if can help me please answer me.
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\www\mysite\site\login.php:9) in c:\program files\apache group\apache\htdocs\www\mysite\site\login.php on line 42
this is the error i have problem with.
and i don't know if i have configure my php.ini well for sessions
thanks

Reply With Quote
  #38  
Old November 14th, 2004, 08:01 PM
titoc titoc is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 5 titoc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 m 42 sec
Reputation Power: 0
First lines!

First lines of login.php are not working properly. I've tryed to modify "!isset" by "isset" and
"empty" by "!empty".
Of course this did not work, but at least I could make it to the next page "checklogin.php "otherwise
every time I made submit i stayed on the same page without any warning of bad pass or user!
Could you please tell me what should I put there to redirect back to the login form if necessary and
to check that the form fields are not empty.
Thanks!

Reply With Quote
  #39  
Old November 15th, 2004, 07:05 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
Post the snippet of code you're referring to.

Reply With Quote
  #40  
Old January 28th, 2005, 11:45 AM
buzzlms buzzlms is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 buzzlms User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 41 sec
Reputation Power: 0
THANKS to all

I've been playing with MySQL/PHP for a little while and learned some intro stuff. This article clarified a few basic commands for me and demonstrated one way so establishing sessions that work. For this I am very thankful.

To all of you who have added your suggestions - Thank You. My next task is to figure out what you mean by such things as isset($_Session['varName']) and why it is so much better than session_is_registered.

Reply With Quote
  #41  
Old January 28th, 2005, 12:52 PM
nicat23's Avatar
nicat23 nicat23 is offline
Addicted to Chaos..
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: Ft. Worth, TX
Posts: 650 nicat23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 34 sec
Reputation Power: 0
Send a message via AIM to nicat23 Send a message via Yahoo to nicat23
The reason in its simplest answer is this

session_is_registered is used when you aren't using $_SESSION (or $HTTP_SESSION_VARS),

isset() simply checks to see if the variable is registered within the $_SESSION

I would recomend against using the session_is_registered because as of php 4.x the super globals are used ($_SESSION, $_GET, $_POST, etc) and session_is_registered isnt compatable (from what I've read) with the superglobals

Basically isset is a form of an if statement in a way, it's basically asking the server "Is this variable set within the global variables"

Check out these sites for more info, or if you have other questions feel free to post

http://us2.php.net/register_globals
http://us4.php.net/manual/en/function.session-is-registered.php

Reply With Quote
  #42  
Old June 21st, 2005, 07:35 PM
GrahamCracker GrahamCracker is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 GrahamCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 57 sec
Reputation Power: 0
I'm stupid

Ok so I just got into PHP and mySQL. I know nothing about either of them and know very little HTML as it has been about 3 years since I have worked with pure HTML.

I have a hosting package, and I also have Dreamweaver, but how exactly do I create the database? What do I use to create it? I"m so confused.

sorry for all you "know it all's" out there-but I guess we all have to start somewhere

Reply With Quote
  #43  
Old October 5th, 2005, 07:01 PM
osularry osularry is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2005
Posts: 1 osularry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 32 sec
Reputation Power: 0
Thumbs up beginner needs update.

This article gives me a beginners understand of login security , but I am using a newer version of PHP and mySQl.
Is there and update of this article to 4+ or a script to handle the changes. I'm still having problem with code.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: PHP for Beginners by a Beginner: Simple Login, Logout, and Sessio


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap