frankthefixer
Posts: 52
|
| Posted: 01/06/2009, 11:56 AM |
|
CodeChargeStudio Personal Edition-PHP 3.0.1.5
I’m trying to figure out how I would go about using info handed off from a referring page to login to a Code Charge project at one of my sites.
There are two sites: the first site is setup to use personalized url’s – (like JohnSmith.somedomain.com) fed by a csv list of names and other variables.
The second site would be my Codecharge project, (www.myCCdomain.com)
If I added a variable to the first site, like UniqueLoginName, one that corresponds to a login name in my codecharge site can I then link users out of the first site with something like www.myCCdomain.com/Login.php?Login=($UniqueLoginName) and use that variable to auto-login into my Codecharge site? If I didn’t use passwords in the CC users table would that work? I know I can make the codecharge site with user info identical to the first site, and I can create and store one or more variables in the first site that can be used in the codecharge site (like groupID if needed) I’m just not sure if this would actually work or if I would also need to alter the standard codecharge login page to accommodate this. Is there a better variable to use than login name, like userID. I kinda wanted to figure this out before I actually made the CC project. Is this the way I would go about accommodating this kind of crossover between two sites like this? Thanks for any help.
|
 |
 |
mentecky
Posts: 321
|
| Posted: 01/06/2009, 7:27 PM |
|
frankthefixer,
This can be done, but I'm not sure of what your security implications would be. In the CCS page you are redirecting to from the first site you need to do something like this in the page After Initialize:
$db = new clsDBInternet();// Set for your DB
// Get the username from the URL param
$user_name = CCGetParam("UniqueLoginName","");
// Get the password from the DB (Change the field names here for your DB)
$password = CCDLookup("PasswordField", "Users", "UniqueLoginName=".$db->ToSQL($user_name, ccsText), $db);
// If we have a password then log the user in
if (strlen($password))
{
CCLoginUser($user_name, $password);
}
Hope that helps,
Rick
_________________
http://www.ccselite.com |
 |
 |
frankthefixer
Posts: 52
|
| Posted: 01/07/2009, 5:59 AM |
|
thank you Rick! I'm going to give your reccomendation a try sometime today, that CCGetParam was what i was looking for- I was intially thinking i would put something like a 'submit form' in the onChange event of the login field, but that was just concept- thank you for that snippet, it's a big help. Incidentally, i'm not too worried about security as this project is basically customized marketing info-
|
 |
 |
jjrjr1
Posts: 942
|
| Posted: 01/10/2009, 9:56 AM |
|
Hi
Could you do this with sessions or cookies to help reduce the security risk?
Can you refering program set a session say called Referrer_ID
Then you can do like Rick Suggested. This way the users ID will not be seen on the address bar.
Don't know if possible.
Have fun
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com |
 |
 |
|