PHP - Check If Port On Remote Server Is Open From Client Side
Hi All - I'm trying to see if the below is possible using PHP. is it possible for php to allow a user to check if a port is open/listening on a remote server/PC, from their local machine. I've seen scripts on the web that talk about opening cmd.exe - this won't work as not all of my users will be on windows. Also saw fsock.. but the remote server is not serving http page(s). Also saw telnet, but again, some of my users may not have that windows feature enabled. Desired workflow: 1. user enters the server hostname/IP and a port 2. my php webapp will emulate checking if that hostname and port is open from the local user's computer.
thanks! Similar TutorialsI wish to create validation rules once which are used both on the client and on the server.
For instance, I will start off with the following PHP object:
stdClass Object ( [rules] => stdClass Object ( [email] => stdClass Object ( [required] => 1 [email] => 1 [remote] => stdClass Object ( [url] => check-email.php [type] => post [data] => stdClass Object ( [username] => function() {return $( '#username' ).val();} ) ) ) ) [messages] => stdClass Object ( [email] => stdClass Object ( [required] => an email is required ) ) )When the edit page is downloaded to the client, I will include this object in some format suitable to the client. The client will then use the jQuery Validation plugin (http://jqueryvalidation.org/) along with the validation object, and client side validate the page. When the form passes client side validation and is uploaded, PHP will use the same validation object to serverside validate the form (I have this part working as desired). My question is how should I pass this data to the client? Originally, I would just use PHP to write some JavaScript. exit('var myObj='.json_encode($myObj));Note that when I json_encode the object, the value of $myObj->rules->email->remote->data->username is a string with quotes around it, however, I can easily use PHP to strip these tags before sending it to the client. As Jacques1 pointed out in http://forums.phpfre...ascript-client/, I should never ever use PHP to generate JavaScript, and should use AJAX to download the JSON directly. I tried doing the later, but found that a callback function could not be included in the JSON. Please advise on the best way to accomplish this. Thank you I have a web portal which is scripted using client side scripting language i.e HTML. I want to create a login page in .php and want the other pages to be in .hmtl. Can i do so? I want to do this because i want the login password to be stored in a database. Also I want the password to get encrypted (by either MD5 javascript or OpenSSL ) when user enters it inside the login form. I cannot create the entire portal in php because my portal makes use of C code. And php doesn't have an interface with C language. Can a user get directed to a .html page after a secure login from login.php page ? My main aim is to secure the access to my web portal using a password. I tried to authenticate the login using javascript where the password was stored in an array. But i feel any one having moderate knowledge can easily break that password. Any help would be greatly appreciated!! is it true that all the server side code runs before the client side code when accessing a webpage? if that is true, what about PHP code that is embedded inside HTML tags? wouldn't that result in an error a lot of times? I need to check (from a Debian server to a Mac CLIENT (not server) machine) to see if a file exists on the file system...not an http server. Here's what I've tried (based on reading at http://www.php.net/manual/en/function.ssh2-exec.php) Code: [Select] <?php function check_remote_files($username, $hostname, $remote_file) { $connection = ssh2_connect($hostname, 22, array('hostkey'=>'ssh-rsa')); if (ssh2_auth_pubkey_file($connection, $username, '/root/.ssh/id_rsa.pub', '/root/.ssh/id_rsa', '')) { echo "Public Key Authentication On Server #2 Successful\n"; } $url = "if ssh $hostname stat $remote_file \> /dev/null 2\>\&1"; $stream=ssh2_exec($connection,$url); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); $stream=ssh2_exec($connection,"then"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); $stream=ssh2_exec($connection,"echo File exists"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); $stream=ssh2_exec($connection,"else"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); $stream=ssh2_exec($connection,"echo Not found"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); $stream=ssh2_exec($connection,"fi"); stream_set_blocking( $stream, true ); $cmd=fread($stream,4096); fclose($stream); } ?> NOTHING happens after the echo of Public Key Authentication On Server #2 Successful. I'm running this script from a bash shell. Any ideas what might be wrong? Thanks. Hey All, I will be marketing a simple php script shortly and would like to Obfuscate my code and have it check to see if the person is running the script on the proper domain, much like other Purchased Scripts, you have to buy licenses and some are limited to a Per Domain basis. Could I use cURL to run a script on another server (mine) that takes the URL it came from, and a variable "the auth key" and check if the person is using the script on the proper domain? If the domain and auth key don't match in the DB i would return a message saying invalid key or something, else continue to execute the script. <?php //authkey would be defined in config file $authkey = "769870afhljkzxf90436"; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,"http://example.com/page.php?authkey=$authkey"); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) { print "Sorry, AuthServ is performing maintenance.....<p>"; } else { print $buffer; } ?> Is there a smarter way to do this? I don't have an extra 300 bucks to use something like ioncube, just looking for a general proper direction on going about this as I am totally clueless. thanks Stupid question but why would it need the port contained inside the URL for redirection later on? Code: [Select] /* The servername and serverport tells PayPal where the buyer should be directed back to after authorizing payment. In this case, its the local webserver that is running this script Using the servername and serverport, the return URL is the first portion of the URL that buyers will return to after authorizing payment */ $serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; $url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']); hello and good day dear joomla-experts well i want to add a business-directory to joomla and want to run this below mentioned code on overpass-turbo.eu see this http://overpass-turbo.eu/s/5pv and include the results into businessdirectory see the option for the code http://overpass-turbo.eu/ [adiff:"2014-07-01T00:00:00Z"]; area[name="Argentina"][boundary=administrative]->.a; ( node (area.a) [amenity=school][website]; way (area.a) [amenity=school][website]; ); out meta geom; and then see the results <?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="Overpass API"> <note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note> <meta osm_base="2014-10-12T14:10:02Z" areas="2014-10-12T03:37:02Z"/> <action type="modify"> <old> <node id="961544799" lat="-34.6064077" lon="-58.3749056" version="4" timestamp="2013-10-04T06:43:38Z" changeset="18172855" uid="79602" user="Zalitoar"> <tag k="addr:housenumber" v="165"/> <tag k="addr:street" v="Florida"/> <tag k="amenity" v="school"/> <tag k="name" v="IBL - International Bureau of Language"/> <tag k="website" v="http://www.ibl.com.ar"/> </node> </old> <new> <node id="961544799" lat="-34.6065440" lon="-58.3750010" version="5" timestamp="2014-07-11T17:43:16Z" changeset="24086663" uid="79602" user="Zalitoar"> <tag k="addr:housenumber" v="165"/> <tag k="addr:street" v="Florida"/> <tag k="amenity" v="school"/> <tag k="name" v="IBL - International Bureau of Language"/> <tag k="website" v="http://www.ibl.com.ar"/> </node> </new> </action> <action type="modify"> <old> <node id="2512237096" lat="-34.5636728" lon="-58.4422897" version="2" timestamp="2014-01-30T22:19:42Z" changeset="20291654" uid="255141" user="Souchong"> <tag k="addr:housenumber" v="1395"/> <tag k="addr:street" v="Avenida Luis María Campos"/> <tag k="amenity" v="school"/> <tag k="name" v="Método DeRose Belgrano"/> <tag k="phone" v="+54 11 47854882"/> <tag k="website" v="http://derosebelgrano.com.ar/"/> </node> </old> <new> <node id="2512237096" lat="-34.5636835" lon="-58.4423120" version="3" timestamp="2014-08-23T04:01:26Z" changeset="24947372" uid="331218" user="AgusQui"> <tag k="addr:housenumber" v="1395"/> <tag k="addr:street" v="Avenida Luis María Campos"/> <tag k="amenity" v="school"/> <tag k="name" v="Método DeRose Belgrano"/> <tag k="phone" v="+54 11 47854882"/> <tag k="website" v="http://derosebelgrano.com.ar/"/> </node> </new> </action> <action type="create"> <node id="2934940034" lat="-34.6181407" lon="-58.5235741" version="2" timestamp="2014-08-06T03:29:38Z" changeset="24567582" uid="648570" user="Abejo"> <tag k="addr:housenumber" v="5490"/> <tag k="addr:street" v="Simbrón"/> <tag k="amenity" v="school"/> <tag k="name" v="I.M.E.P."/> <tag k="phone" v="+54 011 45676610"/> <tag k="website" v="http://formarfuturo.org.ar"/> </node> </action> <action ty i love to do this - many many thanks for all help This isn't exactly an application design question, but rather a system design one.
I am about to install an Inventory Control System inside this store I work in.
The store itself also owns a Linode VPS running Centos 6.4 which hosts our website.
This new Inventory System will come built in with a Microsoft SQL Server, and supposedly it is a SQL Anywhere database, but I'm not too sure what that means.
I need to make this database publicly accessible, but only via the Linode VPS. Surely, setting restrictions is easy enough to address that issue. That isn't my question.
My first idea is to put this server into the DMZ, easy. But it doesn't exactly sound safe. So my next idea was to put a middleman server in the DMZ, this way the Linode can send queries to that middleman server and it will send that data to the SQL Server and back. This is very vaguely described I know, but I don't want to get too much into details, but rather, understand how I can create that middleman server, and what could Install onto it that would allow me to securely process queries?
My first thought was to install a webservice, that accepts an XML/JSON request and returns an XML/JSON response.
Then, I realized directly afterwards that I don't have any experience setting up a webservice like that.
What kind of options are there out there? Ultimately, my question is, should I just put the Server in the DMZ or should I create the middleman, and if so, can someone point me in the right direction as to getting a webservice set up? Edited by Zane, 15 July 2014 - 11:28 PM. Hello Is it possible to uses PHP, to grap incoming packets from a port, on the PHP server ?? hello and good day dear php-freaks which is the passwd for the mysql db run opensuse - therein i have installed a myql serfver and an apache now i want to port over a cms-system from a server to the localhost. question: the passwd of the configuriatin of the cms has got the following db connecgtion host : localhost db-name db-passwd question: does the db passwd need to match the passwd of the local mysql server!? is this true love to hear from you Hello guys. I was thinking on posting this under the mysql thread. but i think this can be solved by php.. anyway, i want to dump mysql data on the client side whenever a user logs out. how can i do this? thanks in advance. I'm in the habit of verifying input client side. For example, there is a field to enter a number, and I ensure that it is within a particular range using Javascript. My backend PHP code does not do such checking... Is this bad? Should I be doing checking using my backend code and send a response back to the client to display a message? Admittedly, I avoid it, since it's a little extra work -- well more extra than just javascripts, IF-THEN-ALERT type statement. I was wondering about developing simple client side graphical apps.
I was thinking of using php with an ODBC connection to the data store.
The data store might be a text file in CSV format or something similar. (maybe even a spreadsheet)!
I was wondering what would be a very simple minimally useful web server to run on the client?
The client would probably be MS Windows XP/7.
What are your thoughts?
We have a website that allows the user to upload his/her picture so we use the ftp_put() command. I use Code: [Select] <?php $path = getcwd(); echo $path; ?> This is the output: Code: [Select] /home/vol10/000a.biz/a000b_7363341/htdocs/gankgame to determine the absolute path where my website is stored. My website "CAN" connect to the ftp server but it can't upload files. Uploading always fail. I can't determine the right path. "My code is attached" I want to do simple client side validation but I don't know Javascript. Can someone point me to an easy example on how to implement or post something here? Is it possible adding a button with PHP, which could be used for adding an optional text input field by client side user? My purpose is actually very simple: The client side users could be free creating and adding more and customized variables, which are intended to be used as strings and related or associated variables. So, am I able to do these kind of tasks simply using PHP alone? Or, should I use some JavaScript like technologies to make those functions available in real world's practices? Hi, I upgraded my XAMPP to the version 1.8.3 (win32) recently. Apache failed to start and I got the following error Hi, I need to make web site, which will get requests from users that log in and activate those scripts. But, the problem is that the server has to, when the script is activated, send request to another PC with the static IP address. Then, that PC should execute the script, send its results to server, and then the server will notice user who activated it (clicked on the link). So, the main problem is that server - client (static ip) communication, when the server is the first who sends request, not the client. Any instructions would be appreciated, thanks in advance. I have a client and a server solution setup at the moment. We are currently creating an API that will be run on the clients end that will allow their clients to connect to them. On our end, we want to log the number of attempts are API is being used so that we may charge the clients appropriately. My question is this. How is the most efficient way of doing this? Do I call mysql_connect from the client and just shoot the insert log statements across the web. Should I create a php script on our end that looks for post/get input and takes the data and inserts it? What if the client can't connect to our server; should I cache the data and send it off all at once? Should I create a job that every hour shoots up x records API requests happened? Relatively confused at what angle I should be taking when approaching this. I want this to be scalable to a point where we can have thousands of requests an hour, and not horribly slow down apache/mysql running at either end (Specially if the server is talking with several clients). I've been looking for a function or a couple of functions which will allow me to get the Certificate Expiration date for a given website. I've tried openSSL, but their functions only seem to work on the current server, which is useless to me because my server doesn't allow SSL or certificates. I just want the certificate of an external website, e.g. www.gna.org has a certificate (signed by themselves, but a certificate nonetheless). I've also tried cURL, since that allows you to access a remote server, but that will just check their certificate - it doesn't offer any functionality for e.g. checking when it will expire. This seems like a simple enough question, but I haven't found anything about it anywhere, so I'm asking here. Thanks a bunch in advance, -IsmAvatar |