• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Cookies determing page layout?

Incinerator

Limp Gawd
Joined
Aug 31, 2005
Messages
252
I'm working on a website and I have it so that users can log in and a cookie with their username is created when they log in successfully. Now what I want to do is, if a user is logged in (shown by the fact they have the cookie) I want to replace the username textbox, the password textbox, and the login button with something like "Hello (username)" and possibly some other info.

I've googled for a while and maybe theres a name for this sort of thing, but I cant seem to find anything even close to relevant. Any help?
 
Generally speaking, you'd do a server side check for the cookie on page load, and then change the output sent to the browser to match what you want.

We'd need to know your programming language first, and then potential code samples could be given. Of course, your exact implementation may vary.
 
I'm using VB

ok, I dont currently have access to visual studio 2008 but would this work?

On the PageLoad event, could I do something like check for the cookie, if its there, make the textboxes invisible? However, for the text that says username and password would I just be able to make that invisible as well or would I have to make them labels first, then I know its possible to make them invisible.

it seems possible to me in my head, but since I wont be able to test it for a couple days I just want to know if I'm on the right track.

thanks
 
Yes, this can be done.

Your approach would be the same: check for cookie presence on page load, then decide the output. My suggestion would be to encapsulate this check within a "Not Page.IsPostBack", and possibly some show/hide of "div" blocks (one with labels, the other with textboxes).

Also... If you're searching online for help with "VB.Net", you will get better results if you change it to "ASP.Net".
 
Back
Top