show once

Started on the old forum in September 2009 · view the original in the archive · old links redirect here

10 replies · 831 views · started 17 years ago · 1 min read

4 participants
riderz Lead · 975 posts #1

how can i make this code show one time on index

if($uid==$who)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}

or how can i make a file to update the profile and make it show only once after registration


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

anderson Developer · 146 posts #2

riderz wrote: how can i make this code show one time on index

if($uid==$who)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}

or how can i make a file to update the profile and make it show only once after registration

You can try like:

$t = mysql_fetch_array(mysql_query("SELECT regtime FROM ibwf_users WHERE id='".$who."' "));
$rt = $t[0];
$nt = time() - $rt;

if($nt<300)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}

It will show that link up to 5 mins after anyone's registration. Tell me if it's working or not.

@ riderz

Wait...

kiLLeR-eyEd_14 Senior · 382 posts #3

anderson wrote: You can try like:

$t = mysql_fetch_array(mysql_query("SELECT regtime FROM ibwf_users WHERE id='".$who."' "));
$rt = $t[0];
$nt = time() - $rt;

if($nt<300)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}

It will show that link up to 5 mins after anyone's registration. Tell me if it's working or not.

@ riderz

this isn't a good idea..better to use an sql fetching with something like a row char(1) NOT NULL default '0'..if row is equal to 0 then show link to edit profile..then in the update page, you should query to set the row value into 1..then it will not show again after it was updated..Got my point?

anderson Developer · 146 posts #4

kiLLeR-eyEd_14 wrote: this isn't a good idea..better to use an sql fetching with something like a row char(1) NOT NULL default '0'..if row is equal to 0 then show link to edit profile..then in the update page, you should query to set the row value into 1..then it will not show again after it was updated..Got my point?

riders asked for a code that shows the link only for once after registration so I coded in that way. Besides personally I avoid sql as much as I can.

Wait...

wap2k Developer · 168 posts #5

I would have said use a session variable set on the register page but maybe the session isnt started intill you log-in!

$_SESSION['first_time'] = 1; // set on the register page

then

if(isset($_SESSION['first_time'])){ 
if($uid==$who)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}
unset($_SESSION['first_time']); 
}
anderson Developer · 146 posts #6

wap2k wrote: I would have said use a session variable set on the register page but maybe the session isnt started intill you log-in!

$_SESSION['first_time'] = 1; // set on the register page

then

if(isset($_SESSION['first_time'])){ 
if($uid==$who)
{
echo "<br/><b><a href=\"index.php?action=uset&sid=$sid\">[ Edit My  Profile ]</a></b>";
}
unset($_SESSION['first_time']); 
}

Many old mobile phone doesn't support serverside session.

Wait...

wap2k Developer · 168 posts #8

anderson wrote: Many old mobile phone doesn't support serverside session.

I created my own session system for wapside. So i dont really know much about php sessions themselfs.

Thankyou iv learned something new 🙂

kiLLeR-eyEd_14 Senior · 382 posts #9

anderson wrote: Many old mobile phone doesn't support serverside session.

if $_SESSION is not set then i create a cookie and call it with $_COOKIE..That's what i've done in my site..You can also use $_REQUEST['PHPSESSID'] where PHPSESSID is the sessi0n name..To debug, print session_name();

anderson Developer · 146 posts #10

kiLLeR-eyEd_14 wrote: if $_SESSION is not set then i create a cookie and call it with $_COOKIE..That's what i've done in my site..You can also use $_REQUEST['PHPSESSID'] where PHPSESSID is the sessi0n name..To debug, print session_name();

Old mobiles dont suppot both session n cookie. try logging ur site using a WAP 1.0 phone like Motorola C-168 or MAUE WAP browser. If u can log successfully dont' forget to inform me.

Well, riderz did u get ur solution from this thread? @ riderz

Wait...

kiLLeR-eyEd_14 Senior · 382 posts #11

anderson wrote: Old mobiles dont suppot both session n cookie. try logging ur site using a WAP 1.0 phone like Motorola C-168 or MAUE WAP browser. If u can log successfully dont' forget to inform me.

Well, riderz did u get ur solution from this thread? @ riderz

ok.,then try to use $_REQUEST['PHPSESSID']..Php provides the ses id depending on the browser i think?But, i get a problem with functions like parsepm($msg, $sid)..So i came back to SESSION and COOKIE..I think maui wap browsers have a cookie support?Then cookies will work..And other wap1.0..Unless they don't supp0rt c0okies..

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close