PHP - Getting Domain Name From Ip Address
I know how to get an ip adress from a domain by using gethostbyname(), but I wanted to know if it was possible to get the domain name from the ip address.
As in a website address (example.com) has a ip address of xxx.xx.xxx.xxx What I am trying to do is to get the 'example.com' domain name from the ip address. Is this at all possible, if so, how can it be done? Thanks in advance for any that helps out. Similar TutorialsThe html Form I'm using works successfully with this php code:
<?php //check if form was sent if($_POST){ $to = 's@hmail.com'; $subject = 'Form1'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = $name; $message .= "\r\n\r\n" . $name; if( empty($_POST["some_place"]) or $_POST['some_place'] != "glory" ) { header("HTTP/1.0 403 Forbidden"); }else{ mail( $to, $subject, $message, $email, $headers ); } header('Location: https://.......com'); exit; } ?>
The problem is that when the email is received it shows the (from) email address to be my domain account user name @ the server name, like this: Any help or suggested remedy will be appreciated I have a form with PHP validation and also a mysqli query checking for duplicates in the database for mailing address and email address in mysql.
It works fine but the customers are adding spaces in the mailing address for example 111 mailing address A V E, 1 1 1 ma iling address A V E etc. and my sql query doesn't see that as an address that's a duplicate.
Their alslo adding email address like my@emailaddress.com and m.y@emailaddress.com, m.y.2@emailaddress.com etc to bypass that comparision also.
Is there anyway to stop this from happening?
This topic has been moved to the corner of 3rd Avenue and mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359430.0 I have two domains both running SSL. Let's call them old-domain and new-domain. old-domain is permanently redirecting traffic to new-domain. There are still a lot of links out there to old-domain with https://. If I were to remove SSL from old-domain but keep SSL on new-domain, I am betting that users will be getting some sort of certificate error. Right? Any way around that if I want to remove SSL from old-domain?
I was wondering if anyone knew of a good way to query domain name availability with php? Hi, I am trying to see if the domain name in the string is in an array. eg; Code: [Select] mystring='http://google.com/somethingelse'; myarray[]='google.com'; myarray[]='anotherdomain.com'; in this case return TRUE Code: [Select] mystring='http://phpfreaks.com/adir'; myarray[]='google.com'; myarray[]='anotherdomain.com'; in this case return FALSE How would I do this? Thanks, -mme This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=359139.0 I have a website on wordpress, at first it was on a friends server, but he switched it so its on bluehost. The website URL is an IP address with a slash and a name. However, I registered a domain name at godaddy. I was able to change the nameservers so that the URL of the index page of my website was changed to the domain name, however, when I click onto any other page from that page, it goes back to the IP address URL. What can I do? Thanks. hey guys im making a script where the user gets redirected...but im wanting to make sure the redirection is within the same domain and not being shipped off to another site when using ($_SERVER['HTTP_REFERER'])
now what im using seems to do the trick but im wondering if there is a better method of doing this?...i dont want to use regex either
thank you guys
<?php $match = strpos("http://127.0.0.1/login", $_SERVER['SERVER_NAME']); if ($match && $match > 0 || $match === 0) { echo "domain match"; } ?> Hi I have written a server session on login in the main domain and am trying to read it when they are sent to their sub domain. Unfortunately it won't read the session. I have searched for a solution, which points to altering the php ini. Is there another option that anyone knows about. Thanks I have two questions: 1. Is it the best way to get the domain of a url by parse_url? or preg_match or str_replace can be better alternatives? 2. What is the best way to remove www from the domains? Note that the domain name itself may contain www too (like www.1www.com) Thank for your attention I'm sorry if this is in the wrong section. I'm working on coding a page that will pull data from a servlet that's already been coded. Right now I'm just trying to get it to pull and display any information. The developer who coded the servlet says it works on his server and I'd rather not badger him with questions. Any help you can provide would be greatly appreciated. So I am running Wampserver 2.5 a basic installation as I have not changed any settings and my HTML page is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd"> i want to get all the domain name on the internet and put them into a database. is there a way to get this. Hello everyone, I have a site where the folders are set up in this arrangement: Code: [Select] _ ClientsFolder - client1 - | page-folder - pages are here (index.php) | | image-folder - images here | |_include-folder - style.css and database connections here _ client2 - | page-folder - pages are here (index.php) | | image-folder - images here | |_include-folder - style.css and database connections here PageIncludeFolder - include pages here (index.inc.php) The reason my folders are set up this way is because multiple clients will be using my site, but each client will have a customized sub-domain, yet all the code on the pages will be the same. All of the pages for the clients site are placed in ClientsFolder/client1/page-folder. Each page in this folder is a page that simply includes an entire page from the PageIncludeFolder. For example: ClientsFolder/client1/page-folder/index.php and ClientsFolder/client2/page-folder/index.php are exactly the same, file, which simply has the following code: Code: [Select] <?php include("../../../PageIncludeFolder/index.inc.php"); ?>The reason for this is so that I can easily modify all the client sites by only modifying the files that are in the PageIncludeFolder. (Trying to work smarter, not harder!) The images, style.css, and script.js files are called from the index.inc.php, which is included on the index.php page. For example, style.css is located at ClientsFolder/client1/page-folder/include-folder/style.css. So to link to the .css file, I have the following code in the index.inc.php file: Code: [Select] <link href="../include-folder/style.css" rel="sytlesheet" type="text/css" /> And images are linked using code similar to this: Code: [Select] <img src="../image-folder/image.jpg" /> Now, when I visit the index.php page by entering the entire url (http://www.mysite.com/ClientsFolder/client1/page-folder/index.php) everything works perfectly. However, as I stated, each client is being set up with a sub-domain. Client 1 has the sub-domain of http://client1/mysite.com, which is pointed to http://www.mysite.com/ClientsFolder/client1/page-folder/index.php. When I try to visit client 1's site using the sub-domain, the index.inc.php page is included perfectly, but the images and the style.css files are not being linked. I know this is kind of confusing, but as you can probably tell, I have spent many, many hours putting this together and now I need help to figure out what is wrong and why certain files are not linking properly ONLY when the page is visited using the sub-domain. ANY help or suggestions are GREATLY appreciated! Thanks everyone! Hello I am curious if it is even possible to get the domain when using iframes/frames? eg. domain2 shows a file from domain1 in an iframe. Can domain1 grab domain name "domian2"? I have a client, that wants an affiliate driven service, which is fine. However they want to offer the affiliates the ability to forward there own domains to the service and have that work as the initial affiliate id token. Now my question is. I know I can find what the domain is that the scripts I am writing run off of using $_SERVER['HTTP_HOST'] however I'm not to sure how that would work for a domain that is forwarded with a 301 or 302 redirect status and masked for use on the service I am building up. I want to say I could use $_SERVER['HTTP_REFERER']. But as I said I'm not to sure how thats going to work for a forwarded domain thats masked as its not part of the actual host conf files its landing on in the end. Hopefully I am making sense with the above. So what would be my best choice of options to work with when handling a domain that will be masked and landing on another domain as it will be forwarded. I am only taking the inital landing with a domain and setting the tokens I need set for it to run as that affiliate and setting them in sessions and cookie and various other variables. But I guess I am just wondering which would be better for me to catch that inital landing with the domain thats forwarded. This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315341.0 Hey Im trying to extract urls from inputted data so i can seperate it from the rest of the text but can't seem to work out what regex i need to use. The main issue is im trying to extract a specific domain example (google.com) But it could be written 4 ways (google.com, http://google.com, http://www.google.com, www.google.com). Does any one know how you do it ? Sorry if this is a stupid question http://www.dinksoftware.com/fig/index.php looks as it should with the php includes working. However if you go to http://www.dinksoftware.com/fig or http://www.dinksoftware.com/fig/ the php includes don't work for some reason. index.php Code: [Select] <?php session_start(); ?> <?php include('header.php'); ?> <?php include('topMenu.php'); ?> <?php include('sidenav.php'); ?> <div id="content"> <h3>Introducing 'The Business Sim'!</h3> <?php $errorMessage1 = $_SESSION['errorMessage1']; echo("$errorMessage1 <p>"); $_SESSION['errorMessage1'] = ""; ?> The Business Sim is an online, free to play educational game currently under development. <strong>The first round of gameplay will commence in Q1, 2011. </strong><br /> <p>Have gameplay ideas/suggestions or any other comments? Want to help mould the game? </p> <br/> <?php include('footer.php'); ?> </div> </body> </html> header.php part (no other includes or anything in this) Code: [Select] <a href="index.php"><img src="header.png" alt="The Business Sim" width="550" height="100" border="0"/></a> How do I fix this? I want http://www.dinksoftware.com/fig and http://www.dinksoftware.com/fig/ to work like it does when you go/fig/index.php etc. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353448.0 |