Jump to content
xisto Community
EiyuRO

Php Script Testing/checking

Recommended Posts

I have two scripts I would like checked one is a server status script


<?php$l_ip = 'xx.xxx.xxx.26'; //Login IP$l_port = '6901'; //Login Port$c_ip = 'xx.xxx.xxx.68'; //Char IP$c_port = '6121'; //Char Port$m_ip = 'xx.xxx.xxx.68'; //Map IP$m_port = '5121'; //Map Port$checktime = '.3'; //How long to check each server for before determining that it's offline//Check Login-Serverif ( @fsockopen( $l_ip, $l_port, $errno, $errstr, $checktime) ) { echo "Login: <font color=\"green\">Online</font><br>";} else { echo "Login: <font color=\"red\">Offline</font><br>";}//Check Char-Serverif ( @fsockopen( $c_ip, $c_port, $errno, $errstr, $checktime) ) { echo "Char: <font color=\"green\">Online</font><br>";} else { echo "Char: <font color=\"red\">Offline</font><br>";}//Check Map-Serverif ( @fsockopen( $m_ip, $m_port, $errno, $errstr, $checktime) ) { echo "Map: <font color=\"green\">Online</font><br>";} else { echo "Map: <font color=\"red\">Offline</font><br>";}?>



Second is a reg. form but the thing is im not sure how to get it to email from the form and not from the users outlook express.


<html><head><title>EiyuRO PHP Contact Form</title><?php// your name$recipientname = "EiyuRO";// your email$recipientemail = "EiyuRO@yahoo.com";// subject of the email sent to you$subject = "eRO Registration Information for $recipientname";// send an autoresponse to the user?$autoresponse = "yes";// subject of autoresponse$autosubject = "Thank you for registering for EiyuRO!!";// autoresponse message$automessage = "This is an auto response to let you know that we've successfully received your registration information sent through our registration form. Thanks! We'll send you an e-mail regarding your account verification as soon as possible. Once you received it, you will be able to play!";// thankyou displayed after the user clicks "submit"$thanks = "Thank you for contacting us.<br>We will get back to you as soon as possible.<br> // END OF NECESSARY MODIFICATIONS?><style type="text/css"><!--td,body,input,textarea {	font-size:12px;	font-family:Verdana,Arial,Helvetica,sans-serif;	color:#000000}--></style></head><body><table width="100%" height="100%"><tr><td valign="top"><font face="Verdana,Arial,Helvetica" size="2"><?phpif($_POST['submitform']) {$Name = $HTTP_POST_VARS['Name'];$Email = $HTTP_POST_VARS['Email'];$Comments = $HTTP_POST_VARS['Comments'];// check required fields$dcheck = explode(",",$require);while(list($check) = each($dcheck)) {if(!$$dcheck[$check]) {$error .= "Missing $dcheck[$check]<br>";}}// check email addressif ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){$error .= "Invalid email address<br>";}// display errorsif($error) {?><b>Error</b><br><?php echo $error; ?><br><a href="#" onClick="history.go(-1)">try again</a><?php}else {$browser = $HTTP_USER_AGENT;$ip = $REMOTE_ADDR;// format message$message = "Online-Form Response for $recipientname:User Name: $NameEmail: $EmailComments: $Comments-----------------------------Browser: $browserUser IP: $ip";// send mail and print success messagemail($recipientemail,"$subject","$message","From: $Name <$Email>");if($autoresponse == "yes") {$autosubject = stripslashes($autosubject);$automessage = stripslashes($automessage);mail($Email,"$autosubject","$automessage","From: $recipientname <$recipientemail>");}echo "$thanks";}} else {?><form name="contactform" action="<?php echo $PHP_SELF; ?>" method="post"><input type="hidden" name="require" value="User Name,Email,Comments"><table><tr><td colspan="2" align="center"><b>eRO Registration Form</b><p></td></tr><tr><td valign="top" align="right">Desired ID (Account Name):</td><td valign="top"><input name="ID" size="25"></td></tr><tr><td valign="top" align="right">Desired Password (Use a non-universal one):</td><td valign="top"><input name="Password" type="Password" size="25"></td></tr><tr><td valign="top" align="right">Re-type Password:</td><td valign="top"><input name="RePassword" type="Password" size="25"></td></tr><tr><td valign="top" align="right">Gender:</td><td valign="top"><input type ="radio" name="Gender" value="Male">Male <input type ="radio" name="Gender" value="Female">Female</td></tr><tr><td valign="top" align="right">E-mail:</td><td valign="top"><input name="Email" size="25"></td></tr><tr><td valign="top" align="right">How did you come across eRO?:</td><td valign="top"><textarea name="How" rows="5" cols="35"></textarea></td></tr><tr><td colspan="2" align="center">*Accounts will be made on a daily basis<br><input type="submit" value="Submit" name="SubmitForm"><input type="reset" value="Reset" name="reset"></td></tr></table><br> </form><?php } ?></font><p></td></tr><tr><td valign="bottom"><font face="Verdana" size="1">Mailform Copyright Š 2002 <a href="http://http://www.xentrik.net/ Web Shoppe</a>.</font></td></tr></table></body></html>


Anything Im doing wrong please let me know any corrections please post. Thanks !!!

Notice from vizskywalker:
made the title of the topic better reflect the content

Share this post


Link to post
Share on other sites

My recommendation would be to find free hosting elsewhere and try your scripts there. Or simply use Apache or xamp to create a local server on your computer with php support to test your scripts rather than post them here.~Viz

Share this post


Link to post
Share on other sites

My recommendation would be to find free hosting elsewhere and try your scripts there.  Or simply use Apache or xamp to create a local server on your computer with php support to test your scripts rather than post them here.

 

~Viz

<{POST_SNAPBACK}>


I wasn't asking anyone to test them I get errors when using them. And I was asking if someone would look to see if anything looked wrong.

The second one I cant seem to get to work right as far as the email stuff. I want it to mail from the form and it opens outlook express.

Share this post


Link to post
Share on other sites

OK, sorry about the misunderstanding. If you could post the error messages it would be helpful. For the first one, I don't know how the page is accessed to know what to check for. It looks like you are using sockets, but I don't from where to where.For the second one, you are missing a double quote after the thank you message. I tested it with the quote in it and sent off a sample form with all a's so you can see if that was the only problem or not.To better diagnose the scripts and debug, error messageswould be useful.~Viz

Share this post


Link to post
Share on other sites

Hey Eiyuro,You should use numbers as numbers, e.g.$l_port = 6901;instead of $l_port = '6901';Computers work better with numbers than strings of characters which again are just more numbers to compute, sometimes being more bytes than necessary.Since PHP can store any data type without declaration, it can sometimes not determine the correct type you need and can end up sending the wrong type needed. This could be a possible reason why it doesn't work, but we can't be sure about this, we need error messages or at least determine where our code gets to before it stops processing.You should work on your HTML skills and try to get it up to standard, I don't like seeing browser specific codes used.I'll look at this more when I've got more time, just a hint to produce some errors, add after the start <?php error_reporting(E_ALL); if that doesn't work try error_reporting(on); then remove the '@'s in front of those fsockopen and see if there are errors being produced. The '@'s are used to supress errors/warnings from displaying it to the client (browser/viewers).Try and see if you can eliminate all those errors that are produced, if there are any. It's a good way to learn how to fix your own applications when they don't work, and you will encounter the same or similar errors over the time but it becomes fewer over time.Cheers,MC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.