Hi
I am putting a website together for a client who wants to have a form for their clients to login to their own sub domains.
For example, form sits on http://www.mainwebsite.com
Their client goes to a login page on the main website, where they fill in a form for Client Name, Username and Password ( the UN and PW will be issued manually to each client)
By using the On submit code (after sending email) I would like the form to redirect the user to the correct sub domain by using the Client Name field as part of the redirect URL
For example clientname.mainwebsite.com
Be nice to also pass the UN and PW as well so I can make the pages on the sub domain for Registered users only!
All would be running on Joomla 1.5.10 using the latest version of ChronoForms
Many Thanks
Peter
I am putting a website together for a client who wants to have a form for their clients to login to their own sub domains.
For example, form sits on http://www.mainwebsite.com
Their client goes to a login page on the main website, where they fill in a form for Client Name, Username and Password ( the UN and PW will be issued manually to each client)
By using the On submit code (after sending email) I would like the form to redirect the user to the correct sub domain by using the Client Name field as part of the redirect URL
For example clientname.mainwebsite.com
Be nice to also pass the UN and PW as well so I can make the pages on the sub domain for Registered users only!
All would be running on Joomla 1.5.10 using the latest version of ChronoForms
Many Thanks
Peter
Hi Peter,
this is easy, example:
where "name" is the client field name! you can add more data the same way!
Regards
Max
this is easy, example:
<?php
global $mainframe;
$mainframe->redirect(JRequest::getVar('name').'.mydomain.com');
?>
where "name" is the client field name! you can add more data the same way!
Regards
Max
Hello,
I'm trying to use the code snippet
However, the redirect becomes mydomain.com/name.mydomain.com.
What do I need to do so that it is just the subdomain that is redirected.
Regards.
I'm trying to use the code snippet
<?php
global $mainframe;
$mainframe->redirect(JRequest::getVar('name').'.mydomain.com');
?>
However, the redirect becomes mydomain.com/name.mydomain.com.
What do I need to do so that it is just the subdomain that is redirected.
Regards.
Hi frydesign,
I think that you'll have to add the full URL http://. . . into the redirect - otherwise Joomla (or the browser) will treat it as being relative to the current site.
Bob
I think that you'll have to add the full URL http://. . . into the redirect - otherwise Joomla (or the browser) will treat it as being relative to the current site.
Bob
thanks for the quick response.
I don't know php syntax. How do I integrate 'http://' into the code snipped shown above.
Thanks again
-Andrew
I don't know php syntax. How do I integrate 'http://' into the code snipped shown above.
Thanks again
-Andrew
Hi Andrew,
Try
Bob
Try
$mainframe->redirect('http://'.JRequest::getVar('name').'.mydomain.com');
Bob
Thanks so much. The solution can look soooooo simple sometimes.
Regards,
-Andrew
Regards,
-Andrew
This code works to redirect to the subdomain:
I also need to pass the username and the password since the subdomain is username/password protected.
Can you help with this.
Thanks,
-Andrew
<?php
global $mainframe;
$mainframe->redirect('http://'.JRequest::getVar('username').'.mydomain.com');
?>
I also need to pass the username and the password since the subdomain is username/password protected.
Can you help with this.
Thanks,
-Andrew
Hi Andrew,
Errr . . . I've no idea - can you pass them in a URL - I know that you can for FTP but don't know about HTTP. Sorry.
Bob
Errr . . . I've no idea - can you pass them in a URL - I know that you can for FTP but don't know about HTTP. Sorry.
Bob
Hi Bob & Andrew,
If you are referring to the HTTP Auth mechanism, it's rather trivial, although considered very unsecure; simply create the url as follows:
http://user:pass@host.tld/path/to/file
However, if you are using some custom logon-form, you'd first have to check that this system allows the use of login credentials through GET requests (most, such as Joomla, use POST request, where the username and password is not shown in the url). If it does, it's a "trivial" matter of figuring out which field names are used, and construct your url as follows:
http://host.tld/path/to/file?field1=value1&field2=value2
There is, however, no way to craft an url that will contain "POST-style" data, you'll need to submit a form for this. Hence this won't work for redirects.
/Fredrik
If you are referring to the HTTP Auth mechanism, it's rather trivial, although considered very unsecure; simply create the url as follows:
http://user:pass@host.tld/path/to/file
However, if you are using some custom logon-form, you'd first have to check that this system allows the use of login credentials through GET requests (most, such as Joomla, use POST request, where the username and password is not shown in the url). If it does, it's a "trivial" matter of figuring out which field names are used, and construct your url as follows:
http://host.tld/path/to/file?field1=value1&field2=value2
There is, however, no way to craft an url that will contain "POST-style" data, you'll need to submit a form for this. Hence this won't work for redirects.
/Fredrik
This topic is locked and no more replies can be posted.