View previous topic :: View next topic |
Author |
Message |
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Wed Dec 02, 2009 9:05 am Post subject: Integrate program in smarty site |
|
|
Hi,
I have a smarty site (datingsite) and everything is working great...now i'm implement a ecard program so members can sent ecards to each other.
Its allmost finished but the final step i can not solve.
I use a Iframe where the program is in...and to prevent members sending cards under a false name it must fill the name of the sender in the formfields automatic using smarty.
On the page where the Iframe is in (nickpage.tpl) i can call these variables with no problem.
These variables are unfortunately lost in the Iframe..its makes a new session that holds the vistors variables.
I have surched and tryed everything but nothing seems to work..even in popup.
Have someone a solution for this?....
You can logon to my testsite :
http://kroon.hostoi.com/index.php
login: demotest
password: demotest
and than click on a member: Fortune and than on the tekst "stuur een ecard" or on the button (popup) ect ect
greetings
Paris |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Thu Dec 03, 2009 8:02 pm Post subject: |
|
|
I tried to show of the session_id witch I can use in the frame but i can't get it?
[url]
Above the blue line i can extrakt the variables that i need from session,
but under de blue line i attempt to get the session_id...with no result..
What I am doing wrong??[/url] |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Dec 04, 2009 1:42 am Post subject: |
|
|
This line:
Code: | echo session_id($_SESSION) |
makes no sense. passing a value to session_id() tries to SET the session id to the given value. |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Fri Dec 04, 2009 10:40 am Post subject: |
|
|
Thx, but what do i ad to get the session_id?...you must know that I am a not soooo
good with php and sessions..(but you already notice that I gess )
regards
Paris |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Dec 04, 2009 2:48 pm Post subject: |
|
|
To get the id:
$sid = session_id();
It's all in the PHP manual. |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Sat Dec 05, 2009 11:55 am Post subject: |
|
|
thx..but it din't work
here the code i am using, the strange thing is, there is a session active because i can extract : {$smarty.session.email} and username with succes...
Code: | to:: {$user.email}<br />
from: {$smarty.session.email}<br />
sender: {$smarty.session.UserName}<br />
$sid = session_id();<br />
smarty.session_id($_SESSION);<br />
session_id()<br />
$_SESSION['name'] =<YourSession><br />
(getSessionId()<br />
getIds(),...)<br />
session.getAttributeNames()<br />
($_SESSION['id']) <br />
$smarty.session.id} <br />
$sid = session_id(); <br /> |
why the attempts won't work is the question.. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Dec 05, 2009 2:45 pm Post subject: |
|
|
are you doing this in PHP? This is PHP code, not template code. (the session_id() stuff) |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Sat Dec 05, 2009 3:35 pm Post subject: |
|
|
oo i think you hit it right on the spot..its indeed a tpl page...the first page is called: showprofile.php ....and than it loads nickpage.tpl ..the page here in the examples..
o dear..you made my day..but what do i do now to see the id?
regards
Paris |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Dec 05, 2009 3:43 pm Post subject: |
|
|
In the PHP code:
$sid = session_id();
If you need the id in the template, you need to assign it.
$smarty->assign('sid',session_id());
Then the template:
{$sid} |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Sat Dec 05, 2009 4:55 pm Post subject: |
|
|
it worked !!! you made my week
Now i know the session_id on with the:
to: {$user.email}
from: {$smarty.session.email}
sender: {$smarty.session.UserName}
is working...the final thing is how do I load the session_id and make it active in the php page where I need the variables (see above) |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Dec 05, 2009 8:30 pm Post subject: |
|
|
you set the sesion id with:
session_id($sid);
I don't know why you need to do all this, PHP tracks the sessions automatically with cookies. All you need to do is start_session() at the top of your PHP script. |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Sat Dec 05, 2009 9:34 pm Post subject: |
|
|
Yes but not in an Iframe...and there is the problem with the continuing with the session on the same page...when loading the content of the frame there is made a new session...and the old session of the page (but still active) is no longer approachable.
I dit what you suggest and the error i reseved was:
Warning: Unknown: The session id contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
Thats strange because with {$sid} i get on the org. page:
the session_id /2ab3eb7a0f6cbdcfcb9a9ccfce1fb234/
there are no illegal characters in it..
hmmm hoe to solve this?
regards
Paris |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat Dec 05, 2009 9:36 pm Post subject: |
|
|
Just before you set the session_id() print out the value you are setting it to, see what it looks like. |
|
Back to top |
|
Paris Smarty Rookie
Joined: 02 Dec 2009 Posts: 13
|
Posted: Sun Dec 06, 2009 10:14 am Post subject: |
|
|
Hi Mohrt,
Many thanks for your time and help but I stop with it al...days and days i am trying now to get this to work and the only thing i am getting is errors and more errors..its to frustrating to go on...
I read many many artikels on forums about difficulty with passing sessions to IFrames and window popups and I notice that I have to little experiance and skils to solve this on my website, even with your help...
Its to bad because it would had been a very nice future for al of my members but I must think about my own well-being...
Therefore, again many thanks!
regards
Paris |
|
Back to top |
|
|