![]() | | ||||||||
| | #1 |
| Warrior Member Join Date: Jan 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hello all. So I am trying to write a simple script that will let me put forwarding on a godaddy domain for example forward-this-domain1 dot com to redirect-to-here dot com. The php file can sit on the redirect-to-here dot com server and in godaddy i want to forward to say redirect-to-here dot com/ redirection/ index.php? domain=forward-this-domain1 dot com. I want this whole process to be logged. So here is my first script written mostly by me ever. PHP Code: Code: January 5, 2010, 3:09 pm: xx.xxx.xx.xxx from domain Array and referrer January 5, 2010, 3:09 pm: xx.xxx.xx.xxx from domain Array and referrer ##Referral directory if called from a director with no index## Hope I make sense. And I hope I didnt fudge the code so bad lol. I thought it was going pretty well until it didnt do what I really wanted it to lol. Ps. didnt mean to obscure the links so much but the forum thought I was trying to spam it. I dont know if any domain other than the network tool is active or owned. |
| | |
| | #2 |
| Warrior Member Join Date: Jan 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
What the duece? I guess it did let me post the code. I apologize for the double post.
|
| | |
| | #3 |
| A rat after money... War Room Member Join Date: Jul 2009 Location: Inside a cheese...
Posts: 598
Thanks: 363
Thanked 54 Times in 47 Posts
|
It is something wrong with the forum then you post code in the blogpost...
|
| | |
| | |
| | #4 | |
| HyperActive Warrior War Room Member Join Date: May 2009 Location: U.K
Posts: 197
Thanks: 5
Thanked 39 Times in 36 Posts
| Quote:
The value of $domain has no value - since it is an array. The value of $domain[''forward-this-domain1 dot com'] is 'forward-this2 dot com' This is why you are getting "Array" as the output. You need to output is as the above; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http: network-tools dot com/default.asp?prog=whois&host='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>' . ' from domain ' . $domain['forward-this-domain1 dot com'] . ' and referrer ' . $refer; Assuming you are only working with the one element in your array. If you have more elements in the array, you will need to work out what array key you need to use. In your example above, this is as easy as; $requested_url=$_GET['domain']; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http: network-tools dot com/default.asp?prog=whois&host='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>' . ' from domain ' . $domain[$requested_url] . ' and referrer ' . $refer; Disclaimer: You should check the value that is stored in $_GET['domain'] is valid or you may end up with some unexpected results. Always clean the data, and check its what you are expecting. In this case, you can check if the requested domain exists in your array by using the array_key_exists function. | |
| Best Ways To Make Money Online Eight bytes walk into a bar. The bartender asks, “Can I get you anything?” “Yeah,” reply the bytes. “Make us a double.” | ||
| | |
| | #5 |
| Crazy Internet Marketer War Room Member Join Date: Jan 2010 Location: Germany
Posts: 101
Thanks: 0
Thanked 15 Times in 12 Posts
|
If SEO is important to you you should add this header right before the "Location" header is sent to the browser: header("HTTP/1.0 301 Moved Permanently"); As chaos69 has written - always check the values for the domain - otherwise it could easily be used to redirect to SPAM domains by spammers with your domain name in the URL. |
|
** Get my ViralListMachine software now for free and build your own list virally by giving away free stuff @ http://www.virallistmachinegiveaway.com **
| |
| | |
| | #6 |
| Warrior Member Join Date: Jan 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
Thanks for both your advice. Isnt SEO important to everyone?! hehe. I been really busy the last couple days but I will definitely fool around with the suggestions yall made. Thanks again!
|
| | |
![]() |
|
| Tags |
| program, world |
| Thread Tools | |
| |
![]() |