Php Login Script - Removing the login field once the user logs in
fffanatics
May 1 2005, 05:41 PM
Hey everyone. I have a login script that i know works. My question is that on my main page, it have a form to allow the user to log in. What i want it to do is that once the user logs in, the form disappears and the users data (aka username) is displayed where the form was. At the moment i cant get it to work. Below is my code.
CODE
<div id="loginMenu"> <?php if ($logged_in == 1) { ?> <!-- User information --> <?php }//if else { ?>
What happens with this code is that it only will display the form because the user isnt logged in. If i refresh the page in IE it will then display it. There has to be a way to dynamically change it once the user submits the form. THanks for the help
OK thanks for the reply and sorry about not using the code tag. i didnt even notice that it was a tag so sorry.
What i was asking was that it would display the login box in the loginMenu div but once the user hits submit in the form, that the user logs in (which my script works) and then instead of showing the loginMenu, it would display the users information. Thats what the if (loggedIn) was for but what i think happens is when the user logs in, the page isnt refreshed so it doesnt even see whats in the if.
Hopefully someone can help. Thanks agian and sorry about not using the code tag
i think it's with $logged_in not beeing assigned with the right value
Yeah i know my auth system works cause i can produce a login script that works when on a separate page. However, who wants to change pages just to log in. It has to be with teh $logged_in variable. This is the order of operations that need to happen along with which ones work:
1.) Users enters fffanatics and decides to log in using the form (works - it is the else)
2.) THe user hits submit and is authenticated (works)
3.) Now instead of the form still being on the page, it should display the users information instead (doesnt work)
I just cant seem to get to form to go away after the user hits submit. Hopefully this clarifies the issue.
i belive that there is no way you can gather all the data about the user when he logs in and then display it with out another page or a script processes it. you have to make your script log the user in then redirect it again to the page with his details displayed.
I write this Easy Login in php and i want to learn to you how to write easy password login its sample of my code its not a user pass login
CODE
<?php <?php if(!$action) { print (" <body bgcolor='#ffffff'> Admin Panel - Set Quiz ::<P> <form name='forum2' method='post' action='$PHP_SELF'> <p>Password <input type='text' name='password' size='20'> <P><input name='Submit2' type='submit' value='Quiz'> </form>"); $max = "my password"; if ($password == $max){ print (" <body bgcolor='#ffffff'> Admin Panel - Set Quiz ::<P>---- ///And then you can post and write your html tags of your html page here for display when password is true\\\\"); } ?>
its really easy i write this password login for my online exam
OK so if i understand all of you correctly, what i should do is have the user log in (run my log in script) and then redirect them to the correct page that would contani their information?
I have my website set up that after you go to the index page, you must log in to go futher. Once you log in, you are directed to another index page with a Welcome! script and member-specific info. When you set up your form to process, direct the form to a processing page that verifies your user then directs to a welcome page (a copy of your index) and modify that page to whatever welcome content you wish!
This is my form processing code:
CODE
<form action="checkuser.php" method="post">
In checkuser.php, after all variables have been checked and the user verified, I have this:
mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");
header("Location: welcome.php");
}} else { echo "<center><font color=red><strong>You could not be logged in! Either the username and password do not match or you have not validated your membership!<br /> Please try again!</strong></font></center><br />"; include 'index.php'; }
I hope some of this helps you. I know that was a huge chunk of code for just a little info, but I was afraid of leaving out something you might need. Good luck!
Yes my code does work and i do actually use cookies. I use to cookies so that they have the option of not having to sign in for 2 weeks. However, this is the only information that is cantained in the cookie. Personally, i like sessions cause its very easy to use and is a secure way to send and recieve information from a page
Why not just use cookies to keep your users logged in? It's a lot easier using sessions, in my opinion. All you would have to do is add a new variable to the config file that is something like this:
Hey everyone thanks for your help. My login script works 100% now. The error was because i had a blank line after the ?> in the one file i included. Thanks for all of your great ideas and solutions
Hmmz thanks for the help but i am not looking to really rewrite a good amount of my code. I just was wondering if anyone knew how i could fix this error since it must be a small one if i dont get it on my server but do get it on the trap17 one
Instead of directing the user to the registration page right away , you could just echo that they are not registered and then give them a link to the registration page.
In a subdomain of my site I have an installation of MediaWiki, and until now it's been working
fine. But today I've been having trouble with it. Previously, whenever I logged into MediaWiki
it worked first time and I would stay logged in for about an hour, even without the "Remember Me"
option checked. But I tried logging in now, and after logging me in, the next page I went to showed
me as "not logged in". I cleared the cache as I know this has been a problem before, and then tried
logging in again, but it still said I was not logged in! So I tried one more ....
Hi, I knew nothing about chaos until I signed up (and paid for my web space Order #2486 >
Invoice #6589) with you and I drive in London for a living ... 8 hours after sign up and still
don't know whether my User name and password work on cPanel or anywhere on this site for that
matter. I would suggest that the admin send out an introductory eMail on sign up with all our info
and put a sticky on at the start page of the forum containing standard info for all users. Like FTP
eMail and cPanel settings. The other thing that's fascinating is the 3 domains us....
Hello everyone not been on for AGES! we had net problems and i had to move to qupis and now
I've got problems. I'm making a social networking site using this script and I cant get it
to install Everytime I go to the install page i get this QUOTE Warning: session_start() :
open_basedir restriction in effect. File(/home/kasiks1/tmp) is not within the allowed path(s):
(/home/karlos:/usr/lib/php:/usr/local/lib/php:/tmp) in
/home/karlos/public_html/phpazi/install/index.php on line 1 Fatal error: session_start() : Failed
to initialize storage module: file....
Ok so i'm still working on the forum software i posted about a while back, but I have no idea
how to do this. I want to make a view new post script, as this is one of the main things that my
forum software dose not have that all other forums have. so does any body have an idea on how i
would do this? Thanks.....
Hi, I got some problems mainly related to connection issue. Firstly, I can connect to FTP server to
upload files. Secondly, I can not access cpanel account, it does not accept my registered data, the
one which is totally right. I do not what happened because it was working fine before. ....
yes,i cant login i can login to normal panel but not to cpanel i get an error every time i login i
created a ticket some days ago and im not getting a responce please help me ThePro....
Hi Guys! A friend of mine came to me asking me to help him write code for his server so that
his clients can go on his site and create a webmail account. I told him I'm not a programmer but
I googled the subject. I ran into SquirrelMail and was impressed with what it could do. Going
through the documentation I saw this QUOTE There are only two requirements for SquirrelMail:
A web server with PHP installed. PHP needs to be at least 4.1.0. Access to an IMAP server which
supports IMAP 4 rev 1. I have php5 running on my XPproSP3 but I don't know....
Ok so i'm working on a site for my chruch, and i seem to be having a little bit of trouble with
the user.php file i keep getting the following error: CODE Parse error: syntax error,
unexpected T_STRING in /home/darkzone/public_html/test/user.php on line 195 and i was wondering
if some one could help me with the script. session_start(); ob_start(); //Include the
configurations include('config.php'); //Define a few variables $x = $_GET ;
$u = $_GET ; class register { function displayform($title) { echo('....
Hi guys. I want t know if it is posible to have so many entries for one object in a field in MySQL.
I know my question may not be clear because I lack in terminology but pliz try and help. What I want
to do is for axample have a database of my clients with the following fields for every client:
fname, lname, more than one photos, contrubutions(comments, jokes, testimonials posted) etc. I want
to have the things like the photos in the same field but they have to be unique so that my php code
can deal with them individually llike they are coming from different fields.....
I'm not sure if this is the right place to post this but I really need help in installing the
dolphin community script. I have absolutely no previous experience of scripts or programming. I
would really appreciate if someone could walk me through it step-by-step, or even do it for me by
logging into my cpanel. I have tried to install it my self but I'm a little confused. I'm
sure it won't take very long at all for someone who has done this before.....
I have install windows 2003 server and some application like iis, share point, etc.my development
time want remote desktop for few user so I want multiple user to login my server but I have not
install active directory and I don’t want to install so tell me the best way to resolved the problem....
hello, I'm looking for a preloader script for my site. like it will display an loading
image while the site is loading and the once the page has loaded the image will disapear. i tryed
searching for one on google but i could not find one, i think i searched for the worng thing. if
some one knows how to make one or where i can find one that would be great. Thanks....
I didn't know where else to put it /sad.gif" style="vertical-align:middle" emoid=":("
border="0" alt="sad.gif" /> If moderators find another forum more suitable plz move this one
/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I am looking
for some sort of sript or program that let's people on your website invite friends. Like they
put in their Emailadress and mails are send to everyone in their list.. I hope someone can help me
/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> Greetzz....
How many of you experienced this? QUOTE Unable to renew IP address Unable to start RPC service
You invite a broadband service, i.e. Verizon DSL, and they provide you with an installation disk.
You gladly use it but later you add LAN to your home and decide to add a router. You follow the
manufacturer's instruction and set up your home network. But this is strange... the computer you
were able to connect to the internet just before a home network is now cannot connect to the
internet. And according to the router manual you installed the program correctly but ....
Background Image Changer Script To swap the background image from your CSS file according to the
Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
create an index.php file and copy/paste the following script. CODE <?php $hour =
date('H'); if ($hour < 12 ) { $image =
"morning.png"; } ....
Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
Current script: CODE <?php //Save this as something like htmltest.php function
CheckForm() { $html_unsafe=$_POST['code']; //Gives us our user
input $html_safe=str_replace("<?php"," ",$html_unsafe);
//Starts security measures $html_safe=str_replace("?>","
",$html_sa....
Hi, I came across this website www.planmylifestyle.com which offers an innovative login system. In
the traditional login system, a user is asked to enter a username and password besides many other
personal information. In this website, to register the site creates an ID file that the user can
download to the local hard drive. After registration, to login to the website, the user has to
simply upload the registered ID file (browser and select ID file from local hard drive) and click on
the Login Button. The user is then taken to the website which seems to be a searc....
With this tutorial, you will learn how to create a textfile login script. This user membership
script is for use also with my forums and message system scripts. I will also give you the scripts
to make it so that people can change their profiles. Ok, The first thing we need to do is make the
database. To do this, create a blank text file called 'userdata.txt' , make sure it is ALL
LOWER-CASE. Edit this file and put
'**username|##|password|##|email|##|rank|##|userid|##|name|##|picture**'. This will not be
used, however it will give you an idea of how the....
This script will help you to protect your source code Add this to Section of your site
! HTML <script language=JavaScript> var message="Function Disabled!";
/////////////////////////////////// function clickIE4(){ if
(event.button==2){ alert(message); return false; } } function
clickNS4(e){ if
(document.layers||document.getElementById&&!document.all){ if
(e.which==2||e.which==3){ alert(message); return false; } } }
if (docume....
Im trying to fix some things on my acount but, i hava to be able to log into my Admin. acount. my
dad had the comp. before me and he forget the password to get into the acount. how do i hack into my
own computer to get the password, or is there any way of defragging my comp. without being a admin?....
I was looking for scripts to put on my website one day, and it turned up this!
http://www.phpizabi.net/ It's a free open-source script, and it has most of the qualities of
myspace.com! And best of all, you can mend it the way you want! I might use it, but on one
of my subdomains . . . . My friend already tried it out, he said it works fine! His website is
under construction right now, but I'll give you the link to it when he's done . . .....
This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
Scripts site. Just in case the site may not show, I will include the code here: List of things
needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
transparent gif image with the watermark - goes in the same directory as this script // ....
If you are tired of providing your clients with weather feeds that take visitors off of their site
or slam their site with ads, I finally found one after searching for hours.
Here's a link to a
FREE php script that pulls the feed directly from any airport in the world to your site. It is easy
to customize and has simple, well documented installation instructions.
http://www.mattsscripts.co.uk/mweather.htm
hope you find it helpful... a good one for designers
to archive as you will most likely need it some day for a client.
Check out Matt's other free
scripts....
Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
doesnt do anything special but I am going to make an email mod for it so that it will email results
to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
<html> <head> <title><? echo "Gamers Pub $qid";
?></title> </head> <body> <p><h3><? echo "....
Introduction This is a code that I use to dynamically create the drop down menus. First, you have
to edit the following code and put it in your Javascript. Notice : /*** SET BUTTON'S FOLDER HERE
***/. Edit that to your folder. Also, the /*** SET BUTTONS' FILENAMES HERE ***/. This creates a
mouseover when the drop down is activated. Put all your onmouseover images under: oversources = new
array; and your onmouseout images under : upsources. Be sure to set your on and out images above
each other. CODE /*** SET BUTTON'S FOLDER HERE ***/ var buttonFold....
Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
are tryn to learn PHP. First, let's make register.php: CODE <?
include("conn.php"); // create a file with all the database connections
if($do_register){ // if the submit button were clicked if((!$name)
|| (!$email) || (!$age) || (!$login) ||
(!$password) || (!$password2)){ print "You can't let
any fields in blank....
Does someone know a script where you can 1. Add clans to a roster 2. Edit clans on a roster 3. Add
players too a clan 4. Edit players 5. Schedule matches 6. Add clan Leaders to manage their own clan
+ members 7. Add members to edit their own information And maybe some sort of scoreboard integrated
where you can put Wins, Draws and loses and that automaticly puts best clans on the top? If there
isnt such a script could someone create 1 for me? (its for a league ^^)....
Looking for php, login, script, removing, login, field, user, logs
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.