|
|
|
|
![]() ![]() |
Jun 15 2005, 06:10 PM
Post
#1
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 3 Joined: 23-May 05 Member No.: 5,360 |
I have two scripts I would like checked one is a server status script
CODE <?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-Server if ( @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-Server if ( @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-Server if ( @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. CODE <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"> <?php if($_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 address if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){ $error .= "Invalid email address<br>";} // display errors if($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: $Name Email: $Email Comments: $Comments ----------------------------- Browser: $browser User IP: $ip"; // send mail and print success message mail($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://www.xentrik.net/">Kali's 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
|
|
|
|
Jun 15 2005, 06:56 PM
Post
#2
|
|
|
Techno-Necromancer Group: Members Posts: 1,018 Joined: 13-January 05 From: The Net Member No.: 2,127 |
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 |
|
|
|
Jun 17 2005, 09:13 PM
Post
#3
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 3 Joined: 23-May 05 Member No.: 5,360 |
QUOTE(vizskywalker @ Jun 15 2005, 01:56 PM) 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 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. |
|
|
|
Jun 17 2005, 09:29 PM
Post
#4
|
|
|
Techno-Necromancer Group: Members Posts: 1,018 Joined: 13-January 05 From: The Net Member No.: 2,127 |
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 |
|
|
|
Jun 17 2005, 09:54 PM
Post
#5
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 3 Joined: 23-May 05 Member No.: 5,360 |
Thanks awsome
|
|
|
|
Jun 17 2005, 10:04 PM
Post
#6
|
|
|
Techno-Necromancer Group: Members Posts: 1,018 Joined: 13-January 05 From: The Net Member No.: 2,127 |
I retested the first script, it works. Just make sure that you replace the x's with real numbers in your script if you in your version they are x's.
~Viz |
|
|
|
Jun 17 2005, 10:04 PM
Post
#7
|
|
|
PESTICIDAL MANIAC Group: Members Posts: 626 Joined: 1-September 04 From: Auckland, New Zealand Member No.: 27 |
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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 04:24 PM |