View Full Version : first time visitor welcome message

01-08-2012, 12:56 PM
Hi all new guy on the block here,

I've got a website, and I want to add a welcoming message which hovers on a certain part of the page which only loads for the visitor for the first time they login, and won't again(presumably cookies used). And says something like "adjust your settings here.." I don't want it to be an external popup but something that loads on the page in a certain area, defined by me (PX-pixle reference)

I think i nutted something out in a bit of PHP, this is what i've got so far

if (firstLogin()){
genSpecial(***load jquerie or css etc***);

can anyone help me figure out how to make this all work and load a box from jquerie or something similar? thanks

01-08-2012, 06:41 PM
Make a <div> area where you wish it to be ...
And then, use CSS to make the <div> "hidden", so it doesn't show.

If the cookie does not exist, you make it "visible" ... if the cookie exists make it "hidden".
You do this using inline CSS within that <div>.

So, get the <div> part working first ... where you can switch it manually to test it.
Then, when that's working, you'll add the PHP Cookie part to make it work automatically


<div class="visible">
This is my div with the information I want to show.
only when there is no cookie set for this computer.

After the cookie is set, you'll be changing it to this ...

<div class="hidden">
This is my div with the information I want to show.
only when there is no cookie set for this computer.


01-09-2012, 12:44 AM
Thanks for that, I was hoping to not use cookies, sorry for not making this clear, just incase the user goes on another computer etc, I want it only to appear oncer per an account, thats where i was going to use PHP, how would I do this?
Thanks for everything though

01-09-2012, 04:15 AM
You'll have to add a new column to the user's MySQL table.
Maybe you can call it "new_user", and put a 1 in there when
the user is new. After they view the special part, you put a 0 in
that column. Check that column each time to see if the logged-in
user has seen it or not.

01-09-2012, 05:21 PM
I am building a new site and would not mind doing this, so I will give this a try and report back if I get it done.


01-09-2012, 05:32 PM

My answers in this thread are of relevance to you - they pretty much answer your question.

01-10-2012, 12:31 AM
Thanks all, it's not a one user site, but more of a multi user social network, similar to facebook if you will, thats where I was thinking of adding that little script into the index.php page when they first login, but i'm not so sure on how to load querie with it... any pointers?
Thanks again

01-10-2012, 03:08 AM
Did you add a new column to the database table (where your user stuff is)?
Each user needs a spot where you know if they've seen the welcome message or not.
When a new user is added to the table, you put a 1 in that spot (did not see the message).
When they see the welcome message, you update that to a 0 (they saw the message).

01-11-2012, 02:25 AM
Sorry for not making myself clear, I am trykng to set it up, so I don't have to do anything, because there are quite a few new members everyday and I could spend all day just updating the mysql tables. Is there a solution in PHP etc?

01-11-2012, 04:56 AM
Well no ...

You add a column to the table ... that's one MySQL command.
You can do that using your MySQL admin panel (on your webhost control panel).

Then, you add the starting value of 1 to that column when they register.
And after they see the welcome, you do an UPDATE to that column ... a zero.
It's done with scripting, so you do nothing.

Only the members who have a 1 there will see the welcome, so all previous
members are past it already ... they won't see it.

We can't do any scripting ... we don't have access to your database or files.
Maybe you can find a person who lives by you that can stop over and show
you in person. Or, you'll have to trust a stranger to enter your files.