Jump to content

Link HTML to PHP Process


MrBloop

Recommended Posts

Hi Everyone!

I could not find if this topic has been covered before, but I have written a php project in Eclipse and it runs wonderfully in Eclipse, so I have exported the files. I now worked on my HTM frontend in Deamweaver but saved it as PHP for ease of use and have linked a image to the PHP file that will perform my search function but all that comes up in the browser as the PHP code. I presume that eclipse perhaps emulates a local server? and is that why the process wont run? I am not collecting any input from the user or using POST or GET, because the PHP Class just searches all IP ports Displays them. Please Help!!

I thank you in advanced for any help....

Link to comment
Share on other sites

Um, that is what Xampp and Wampserver are. Pre-packaged setups of the Apache http server. You hinted in your initial post that you didn't actually have a server installed.

 

So what exactly IS your problem / question?

Link to comment
Share on other sites

 

Hey there, thanks for your help and urgent replies so far...

 

Okay I have a script that searches what IP'S are on a server, written in PHP of course, now I created a PHP File in Dreamweaver (Interface) that has a specific button linking to the PHP class/function. I have tested the script on Eclipse and it works there fine...

 

I want to know do I have to have a Database to run this script?

I have only ever used PHPMYADMIN to create sql databses for Joomla and Drupal CMS sites, but I really do not know how to run anything else through my localhost besides a cms...

 

So if I need a database and I create it in PHPMYADMIN how do I run this simple script?

Link to comment
Share on other sites

This is the script: I got it from the internet somewhere and wanted to use it on the school server that I manage, but I just needed to create a nice looking front-end which I did in deamweaver...I just linked a button from my dreamweaver to the PHP file that has this function in it... ALL I WANT IT TO DO IS JUST RUN IT FUNCTION...when it people click on the button and it calls this PHP file what you see below is excatly what I get in the browser....

 

host=$host; } // get IP address public function getIp(){ if(!$ip=gethostbyname($this->host)){ throw new Exception('Error resolving host IP address.'); } return $ip; } // get list of IP addresses public function getIpList(){ if(!$ips=implode(' - ',gethostbynamel($this->host))){ throw new Exception('Error getting list of IP addresses for the provided hostname.'); } return $ips; } // get host name public function getHost(){ if(!$host=gethostbyaddr($this->getIp())){ throw new Exception('Error resolving host name.'); } return $host; } // get TCP ports of Internet services public function getServicePorts(){ $output='Retrieving services ports...Please wait.

'; foreach($this->services as $service){ if(!$port=getservbyname($service,'tcp')){ $output.='Error retrieving port of service '.$service.'

'; } else{ $output.='Service '.$service. ' runs on TCP port :'. $port.'

'; } } return $output; } // get Services by TCP ports public function getServiceNames(){ $output='Retrieving services names...Please wait.

'; foreach($this->ports as $port){ if(!$service=getservbyport($port,'tcp')){ $output.='Error retrieving service name on port '.$port.'

'; } else{ $output.='TCP Port '.$port. ' is used by service :'. $service.'

'; } } return $output; } } try{ // instantiate 'QueryProcessor' object $queryProc=new QueryProcessor('hotmail.com'); // display host IP address //echo $queryProc->getIp(); // displays 64.4.32.7 // display host name //echo $queryProc->getHost(); // displays 'hotmail.com.br' // display IP list //echo $queryProc->getIpList(); // displays 64.4.32.7 - 64.4.33.7 // display services ports echo $queryProc->getServicePorts(); /* displays the following list Retrieving services ports...Please wait. Service http runs on TCP port :80 Service https runs on TCP port :443 Service ftp runs on TCP port :21 Service telnet runs on TCP port :23 Service imap runs on TCP port :143 Service smtp runs on TCP port :25 Service nicname runs on TCP port :43 Service gopher runs on TCP port :70 Service finger runs on TCP port :79 Service pop3 runs on TCP port :110 Service www runs on TCP port :80 */ // display service names echo $queryProc->getServiceNames(); /* displays the following list Retrieving services names...Please wait. TCP Port 21 is used by service :ftp TCP Port 23 is used by service :telnet TCP Port 25 is used by service :smtp TCP Port 43 is used by service :nicname TCP Port 70 is used by service :gopher TCP Port 79 is used by service :finger TCP Port 80 is used by service :http TCP Port 110 is used by service :pop3 TCP Port 143 is used by service :imap TCP Port 443 is used by service :https */ } catch(Exception $e){ echo $e->getMessage(); exit(); } ?>

 

But when I run it in eclipse this is what I get and this is what I want to see in the browser...

 

Retrieving services ports...Please wait.

Service http runs on TCP port :80

Service https runs on TCP port :443

Service ftp runs on TCP port :21

Service telnet runs on TCP port :23

Service imap runs on TCP port :143

Service smtp runs on TCP port :25

Service nicname runs on TCP port :43

Service gopher runs on TCP port :70

Service finger runs on TCP port :79

Service pop3 runs on TCP port :110

Service www runs on TCP port :80

Retrieving services names...Please wait.

TCP Port 21 is used by service :ftp

TCP Port 23 is used by service :telnet

TCP Port 25 is used by service :smtp

TCP Port 43 is used by service :nicname

TCP Port 70 is used by service :gopher

TCP Port 79 is used by service :finger

TCP Port 80 is used by service :http

TCP Port 110 is used by service :pop3

TCP Port 143 is used by service :imap

TCP Port 443 is used by service :https

 

I HOPE THIS INFO HELPS  :D

 

Link to comment
Share on other sites

Please put your code between PHP tags [/code] so we can read it properly. Also, what happened to all the linebreaks?

 

From glancing at it, I don't see any references to a database, so I don't think that could be your problem. Obviously if you actually see the PHP code rather than it's output in the browser, it means that PHP isn't parsing the code. Rather, Apache is sending it directly to the client as plain text. If you are running this on your local computer and access it thru http://localhost/scriptname.php you'll need to verify that PHP is started and running, and that Apache's configuration is set up to send requests for .php files to the PHP Hypertext Preprocessor. If the site is hosted remotely, then you'll have to contact your host and tell them that PHP isn't working properly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.