Bogey Posted March 8, 2012 Share Posted March 8, 2012 Hey hey, This is going on:1.) a user fills in a form to make an account on my website;2.) temp account is made, and confirmation mail is send to user;3.) user clicks link in confirmation mail, to activate account. This all works PERFECTBUT....!!!! This is a piece of code from them confirmation.php: (calling when activationlink in confirmation mail is clicked) <P align='center'>Bla bla bla is send to <?php echo $row['email'];?> <BR />also check your spam-box, for the mail!<BR /> <BR />click <A href=<?php echo $_SERVER['SERVER_NAME'];?>>here</A> to go back to homepage of website</P> the email adres in showing OK!the link is NOT!!!!Link looks like this: www.mywebsite.nl/modules/moduleX/www.mywebsite.nlinstead of this:www.mywebsite.nl Hope I made myself clear?Anyone knows why/how $_SERVER['SERVER_NAME'] adds the directory of confirmation.php in front of the servername?Or has it something to do with de href part? Thanx in advance Link to comment Share on other sites More sharing options...
justsomeguy Posted March 8, 2012 Share Posted March 8, 2012 The server name does not include the protocol. You need to add the protocol to the link, right now the browser assumes it is a relative link. Link to comment Share on other sites More sharing options...
Bogey Posted March 8, 2012 Author Share Posted March 8, 2012 Could you explain a bit more? I dont quite understand... :S What do you mean with the protocol? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 8, 2012 Share Posted March 8, 2012 The protocol is HTTP. If the URL in a link does not include the protocol then the browser assumes it is a relative link. If you have a page at http://www.domain.com/page.html, and that page has a link like this: <a href="page2.html"> There is no protocol there, so the browser assumes it is a relative link and that it points to http://www.domain.com/page2.html. Likewise, if the link has this: <a href="www.google.com"> Again, no protocol, so the browser assumes it is pointing to http://www.domain.com/www.google.com. If you want an absolute link then it needs to be fully-qualified, which means you need to include the protocol. Link to comment Share on other sites More sharing options...
Bogey Posted March 11, 2012 Author Share Posted March 11, 2012 Ok, got it working! thnx thnx thnxt...!!!! <?php$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https')=== FALSE ? 'http' : 'https';$host = $_SERVER['HTTP_HOST'];$website = $protocol . '://' . $host;?> Link to comment Share on other sites More sharing options...
Bogey Posted March 11, 2012 Author Share Posted March 11, 2012 One more thing! How do I pass a emailadress by mail as a string?In the info mail towards the user, there is the loginname and password... The loginname I would like to been shown as text in the mail, but now I only get it, that the mailadress is a clickable link... this pieces of code I tried, but none worked $email=$row['email'];$email1 = strval($email);$email2 = (string)$email;$email3 = settype($email, 'string'); All of above give a clickable link, except the last one, this gives a '1'...How do I get just a plain text?!?!?! Link to comment Share on other sites More sharing options...
birbal Posted March 11, 2012 Share Posted March 11, 2012 what does echo $row['email'] prints? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 12, 2012 Share Posted March 12, 2012 The mail client makes it a link automatically. You can't control how mail clients use your email. You can add a content-type header to set the email to be a plain text email, but the mail client can ignore that if it wants to. Link to comment Share on other sites More sharing options...
Bogey Posted March 14, 2012 Author Share Posted March 14, 2012 what does echo $row['email'] prints? Is echo's the email-adress (f.e. someone@gmail.com) Link to comment Share on other sites More sharing options...
Bogey Posted March 14, 2012 Author Share Posted March 14, 2012 The mail client makes it a link automatically. You can't control how mail clients use your email. You can add a content-type header to set the email to be a plain text email, but the mail client can ignore that if it wants to. Hmzzz.... bummer....! :SThanx again anyway Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.