|
Go4Expert Member
|
|
| 25Nov2006,22:33 | #11 |
|
by the way, where do I place my html code?
|
|
Team Leader
|
![]() |
| 27Nov2006,13:11 | #12 |
|
Place the HTML preferably after the session PHP code.
|
|
Go4Expert Member
|
|
| 27Nov2006,18:38 | #13 |
|
<?php
ob_start(); session_start(); ?> ********** You mean here? ********** <? require_once ("functions.php"); if (checkLoggedin()) echo "<H1>You are already logged in - <A href = \"login.php?do=logout\">logout</A></h1>"; else echo "<H1>You are not logged in - <A href = \"login.php\">login</A></h1></h1>"; ?> |
|
Team Leader
|
![]() |
| 28Nov2006,10:09 | #14 |
|
Yeah, right! But you may need to include or require your files before that, you can include your files, before the session code.
|
|
Go4Expert Member
|
|
| 30Nov2006,19:03 | #15 |
|
okay, ive solved that problem, now, if i want to store username and password in another txt file, what would i have to put in the main php page codes?
eg. Code:
if(file('logindata.txt'))
return true;
else
return false;
|
|
Team Leader
|
![]() |
| 30Nov2006,21:19 | #16 |
|
It would be something like this
Code: PHP
|
|
Go4Expert Member
|
|
| 1Dec2006,14:06 | #17 |
|
where do i paste this in?
<?$username = $_SESSION['usr'];$pwd = $_SESSION['pwd'];$h = fopen("userdata.txt");fwrite($h,"$username\n$pwd\n \n");fclose($h);?> and what do the "\n" stand for? |
|
Go4Expert Member
|
|
| 1Dec2006,14:08 | #18 |
|
oh no, sorry, i think i didn't say it clearly, what i wish is to extract the information of username and password FROM the text file, not store them into the txt files. Thanks for understanding.
|
|
Team Leader
|
![]() |
| 1Dec2006,14:09 | #19 |
|
\n stands for newline. Visit http://in2.php.net/types.string for more escape sequences.
|
|
Team Leader
|
![]() |
| 1Dec2006,14:13 | #20 |
|
Well then you have to store the data in text files, in a specific format say user:location:age OR user#ocation#age, so that the data retrieval becomes easy.
All you have to do is to read the text file line by line, and split it by the separator you have chosen (: or #) and then check the username part for a match. Bingo! you got your record. |
