Logged in User - UserID
Permalink
Hey all,
I have built a site with c5 for one of our customers and everything works fine so far.
Now, my customer needs a solution, to provide his logged in users specific data from a insurance-comparison webtool, provided by another company.
To get this information, the user regularly needs to login to the insurance-comparison tool, by opening a specific link, holding its username & password; e.g.:
https://www.insurancecompany-xy.tld/xxx/formulare.pl?user=USERNAME&a...
To provide a "single-sign-on"-solution, I decided to add this information into the user-table of concrete5 by adding attributes to the user.
After that, I wrote a small script, which connects to the database, gets me the specific values, and generates the link for me.
My problem is, how can I use the userID of the logged-in user in my WHERE-clause to get the specific values?
I'm new to php (to be honest for 2 days now), so please don't flame if the answer to this is too obvious!
Thanks for your suggestions!
I have built a site with c5 for one of our customers and everything works fine so far.
Now, my customer needs a solution, to provide his logged in users specific data from a insurance-comparison webtool, provided by another company.
To get this information, the user regularly needs to login to the insurance-comparison tool, by opening a specific link, holding its username & password; e.g.:
https://www.insurancecompany-xy.tld/xxx/formulare.pl?user=USERNAME&a...
To provide a "single-sign-on"-solution, I decided to add this information into the user-table of concrete5 by adding attributes to the user.
After that, I wrote a small script, which connects to the database, gets me the specific values, and generates the link for me.
My problem is, how can I use the userID of the logged-in user in my WHERE-clause to get the specific values?
I'm new to php (to be honest for 2 days now), so please don't flame if the answer to this is too obvious!
Thanks for your suggestions!
thanks for your reply.
as I already mentioned, I'm a complete newbie, and if I just add this snippet to my script, I get an parse error saying: "syntax error, unexpected T_VARIABLE in ..." :(
here's my script without the where-clause:
any suggestions?
as I already mentioned, I'm a complete newbie, and if I just add this snippet to my script, I get an parse error saying: "syntax error, unexpected T_VARIABLE in ..." :(
here's my script without the where-clause:
<?php $host = "mysql_host"; $user = "mysql_user"; $password = "mysql_password"; $dbname = "mysql_database"; $table ="mysql_table"; $dbconnect = mysql_connect ($host, $user, $password); $dbquery = "SELECT ak_inno_user, ak_inno_pass from $table"; $result = mysql_db_query($dbname, $dbquery, $dbconnect) OR die(mysql_error()); while ($ausgabe = mysql_fetch_array($result)) { header("Location:https://ssl.companyname.tld/formulare.pl?user=...{$ausgabe['ak_inno_user']}&pw={$ausgabe['ak_inno_pass']}"); } mysql_close ($dbconnect) ?>
any suggestions?