Why Doesn't This Code Work On Computinghost?

free web hosting
Open Discussion > Xisto Network Sites > ComputingHost Forum > Technical Support

Why Doesn't This Code Work On Computinghost?

krap
Here is the script:
CODE
<html>
<head><title>Rcon Connection Client</title></head>
<body>
<form name="rcon" method="post" action="rcon.php">
IP: <input type="text" name="ip" value="127.0.0.1">
Port: <input type="text" name="port" value="7777">
Password <input type="text" name="pass" size="25"><br>
Cmd: <input type="text" name="cmd" size="100"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
<?
$ip = $_POST['ip']; if (!$ip) die();
$port = $_POST['port']; if (!$port) die();

$pass = $_POST['pass']; if (!$pass) die();
$passlen = strlen($pass);
$cmd = $_POST['cmd']; if (!$cmd) die();
$cmdlen = strlen($cmd);

$packet = 'SAMP';
$packet .= chr(strtok($ip, '.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));
$packet .= chr($port & 0xFF).chr($port >> 8 & 0xFF);
$packet .= "x";
$packet .= chr($passlen & 0xFF).chr($passlen >> 8 & 0xFF).$pass;
$packet .= chr($cmdlen & 0xFF).chr($cmdlen >> 8 & 0xFF).$cmd;

$fp =fsockopen('udp://' . $ip, $port, $errno, $errstr);
fwrite($fp, $packet);
while(!feof($fp)) {
$str=fread($fp,128);
$str=substr($str,13,strlen($str)-13);
if (!$str) break;
echo $str."<br>";
}
fclose($fp);
?>


It seems to work for some other people on different hosts and I've tried on both my websites (one is on alpha, the other on iota) and it doesn't seem to be working. It is a remote control script for the game server I run and it just times out after 60 secs without executing the command on the server sad.gif I am of course replacing the default 127.0.0.1, I know that wouldn't work and I've tested it on another host and it worked fine.
Thanks
Andre

 

 

 


Reply

etycto
excuse me if i'm wrong: i'm not great with PHP, but i think i see two thing wrong with that. should the script <? ?> be insite the HTML or body tag
like this:
CODE
<html><head><title>Rcon Connection Client</title></head><body><form name="rcon" method="post" action="rcon.php">IP: <input type="text" name="ip" value="127.0.0.1">Port: <input type="text" name="port" value="7777">Password <input type="text" name="pass" size="25"><br>Cmd: <input type="text" name="cmd" size="100"><br><input type="submit" name="submit"></form>
<?  $ip = $_POST['ip'];  if (!$ip) die();  $port = $_POST['port']; if (!$port) die();  $pass = $_POST['pass']; if (!$pass) die();  $passlen = strlen($pass);  $cmd = $_POST['cmd']; if (!$cmd) die();  $cmdlen = strlen($cmd);  $packet = 'SAMP';  $packet .= chr(strtok($ip, '.')).chr(strtok('.')).chr(strtok('.')).chr(strtok('.'));  $packet .= chr($port & 0xFF).chr($port >> 8 & 0xFF);  $packet .= "x";  $packet .= chr($passlen & 0xFF).chr($passlen >> 8 & 0xFF).$pass;  $packet .= chr($cmdlen & 0xFF).chr($cmdlen >> 8 & 0xFF).$cmd;  $fp =fsockopen('udp://' . $ip, $port, $errno, $errstr);  fwrite($fp, $packet);  while(!feof($fp)) {    $str=fread($fp,128);    $str=substr($str,13,strlen($str)-13);    if (!$str) break;    echo $str."<br>";   }  fclose($fp);?>

</body></html>


also should there be a decleration that says it's a PHP script. (maybe it works only for a certain version of PHP did you check that by any chance)

 

 

 


Reply

galexcd
I'm assuming the page doesn't time out when you comment out the while loop? Since you mentioned this script works on other hosts and not this one I'm assuming it may be an issue with the servers attempting to block data over the ud protocol. I may be mistaken, however that seems to be the only issue I can find. The code should run fine, as long as the server has PHP 4 or higher installed.

@etycto: None of those solutions would cause the page to timeout, however the point about echoing information outside of the body tag might be a good idea if he wants to keep his page at least partly up to par with today's web standards.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. computinghost server ip address - 415.24 hr back. (1)
  2. samp rcon client - 803.73 hr back. (1)
  3. submitting, form, timeout, issues more:xisto - 938.72 hr back. (1)
Similar Topics

Keywords : doesnt code computinghost

  1. True Or False Mail From Computinghost ? [resolved] - about billing system (8)
  2. Computinghost Has Lost My Web Site. [resolved] - (5)
    I purchased hosting plan compute_plan3s on May 1 2007 with a static IP and an SSL, and now no one at
    ComputingHost can find my site. My welcome mail said that my IP address is 208.70.xx.xxx, but tech
    support sais that is not one of their IP address. My web site was fully functionial two weeks ago,
    and now its gone. This was sbmited under ticket ID:TYQ-607193. Can someone please look into this
    as my customer wants there site back up and running, and I don't have any anwsers for them....
  3. Can't Login To Cpanel And The Computinghost Website [resolved] - (6)
    i just registered and made my payment. When i first accessed the cpanel site, my Firefox started to
    show me all these "Do you trust computinghost?"-like windows that i accidentally clicked "no" to. Or
    just one of them. I'm not sure. I thought that's the reason why i can't log into cpanel,
    but when i tried logging into computinghost's client control panel, it wouldn't let me login
    either. And i tried to resend my login details but it says my email address is not valid. I've
    already sent a ticket over with no response for at least 20 minutes now. ...
  4. Can I Upgrade Computinghost Paid Plan? [resolved] - Need Your Help... (3)
    Hi there, guys, here is my problem: I signed up for your 3S hosting plan ( www.sonorama.net ) for
    one whole year in december (or something) 2006, i think. In that precise moment, the number of
    daily visitors were kinda increasing, but quite slow. Nowadays my site has increased the visits and
    obviously my bandwidth is not enough anymore. Yesterday afternoon I experienced a suspention (the
    second in this year, i guess...) of my site, because of the bandwidth limit exceeded (509). What I
    wanted to ask you guys is if you allow me to pay for the difference between 3S and 7...
  5. Delay With Computinghost Customer Support - (5)
    For last 2 days I have asked to upgrade my plan by sending emails to sales@computinghost.com but
    have yet to recieve a response. My bandwidth has now been exceeded. Where the... is customer
    support?...
  6. Help On Script For Wap - Line Ip Shower - For Computinghost.com (3)
    hi dear sir's i bought a hosting account & domain at computinghost.com some days ago...i tried
    on line ip shower script in my new computinghost account but nt work.can any one tell me how to fix
    this prob bkos am new at that hosting...please help me soon..... address is http://2-wap.net check
    it now from your mobile.. check there your info or online info ( not working )...computinghost.com
    gave me this trap17.com link for help.... please tell me how to fix this? Topic title is very
    important. Modified. ...
  7. How To Cancel Computinghost Reseller's Account - (6)
    Well i have a reseller here and i am just hating it! i love trap17's hosting i just hate
    the resellers they were down for more than the 99.9% /mad.gif" style="vertical-align:middle"
    emoid=":angry:" border="0" alt="mad.gif" /> so i was wundering how to shut down a reseller
    account. Thanks, - John...
  8. Computinghost Server Seems Slow - (19)
    My sites been going slow all day. www.phpbb1.net...
  9. Transfering My Website From Trap17.com To Computinghost - (5)
    Hello, I just purchased the 33.3 GB BW plan from Computinghost.com and am wondering how long it
    will take for the transfer to take effect. My website was suspended today due to inactivity on the
    forums. Also, will I have to change nameservers if I am coming from trap17 to computinghost?
    Thanks! /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />...
  10. Remote Acces To Mysql In Computinghost.com Server? - I need accessing mysql from another server (2)
    Hi, A little question, I need to access to my mysql computinghost.com serveur from another server
    form some little update. I found the option 'Mysql/Access Hosts' in the cpanel and I put
    the other server ip. But wich server name I have to put to access to my computinghost.com/localhost
    ? I've tried the ip and the adress from my website hosted on computinghost.com, I suppose there
    is a spécific adress. I tried too to find this adress myself in the forum, but I failed.
    Thank's for you help. Js....
  11. Can't "manage" Domain - Searched and Doesn't Appear (6)
    I followed the instructions to search for my domain so that I can modify it (add ftp users and so
    on) and it does not appear under the search function. I searched for both the domain and order id
    and neither appear. Order Details Order ID: 2916259 Domain Name: 2secsurf.com No of Years: 1 Cost
    Price: USD7.99 ETA: The hosting plan is a domain plus the $3.33 monthly hosting. (I'd
    also like to inform you that the cost price was $9.95 and not $7.99 like the e-mail and
    order pages say)...
  12. Computinghost Helpdesk Support - (1)
    Hi, For Support Queries, Please use the helpdesk. Send mail to support AT computinghost DOT com.
    Also, When sending mail, Please give us your cpanel login details and domain name. A link where you
    are facing the error or Error message that you recieve will help us further to solve your query
    quickly. Thanks. -OpaQue...
  13. Transferring Files From Trap17 To Computinghost - (2)
    I just purchased hosting today and was wondering if there was a way to transfer the files from my
    blog and forums over to computing host (like a transloader). Since I don't even see fantastico
    on computing host, and I don't have the time to upload all the files for phpbb and wordpress
    again, it would be really handy :\ Any help is appriceated...
  14. Computinghost Cpanel Login Question - can't login - new account (7)
    Info Domain : crucibleofheroes.com registered with computinghost.com name: Thomas Vincent cpanel
    name: crucibl (name assigned to me) contact email: kid3rv@yahoo.com ticket: ZTQ-4907-145 problem,
    i cant login to cpanel with the supplied login information. i need this resolved asap. -Thomas...
  15. Cannot Email To Support Team Email Id - at computinghost dot com (2)
    I want to inform some technical problem to the support team at support@computinghost.com but the
    mail returned with the following message: QUOTE A message that you sent could not be delivered
    to one or more of its recipients. This is a permanent error. The following address(es) failed:
    pipe to |/usr/bin/php -q /home/xisto/public_html/helpdesk/emailpipe.php   generated by
    helpdesk@xisto.com   (ultimately generated from support@computinghost.com) I do not want to
    pen down in this forum what I want to send to the support team. Please help me what could be the ...
  16. Moving From Trap17.com To Computinghost.com - (4)
    OK, dudes, this is the point: I have my domain (Sonorama.NET) currently hosted here in Trap17.com,
    but due to my short time for keeping posting here in your forums (thing that i really enjoy), I
    decided to move to your paid hosting service at Computinghosting.com. I purchased the S3 permium
    service and in response I got a few mails, in which they said that my space was ready to be used by
    me... But NO!!!! what a big lie: I was told that my temporary site would be:
    http://64.69.35.170/~sonoram/ and I could have access to my cPanel thru http://64.69.35.1...



Looking for doesnt, code, work, computinghost,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for doesnt, code, work, computinghost,

*MORE FROM TRAP17.COM*
advertisement



Why Doesn't This Code Work On Computinghost?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE