Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

MySQL Errors


  • Please log in to reply

#1
Linden

Linden

    Member

  • Member
  • PipPip
  • 57 posts
Hi,
I am working on a new webpage. It has some code to see if my server is up. The result is in a little iFrame. When i get an error it fills up the iFrame. My question: Is there a way to stop it from showing errors?
Thanks

Code ATM:(VERRY Messy)

<html>
<?php
if(!$u){
   // Realm Status

   $h = "epswow.servegame.com";	//server address
   $p = "3724";		//default realmd port
   $s = fsockopen($h, $p, $errno, $errstr, 2);

   if(!$s){
	   echo "<font color=darkblue><strong>server is:</font></strong>"." <font color=red><strong>Down!</strong></font>";
   }
   else
   {
	   echo " <font color=darkblue><strong>server is:</font></strong>" ." <font color=darkgreen><strong>Online!</strong></font>";
   }
}
else
{
   // Sql protection
   if (!get_magic_quotes_gpc()) {
	  $u = addslashes($_POST['user']);
	  $p = addslashes($_POST['pass']);
	  $e = $_POST['email'];
   } else {
	  $u = $_POST['user'];
	  $P = $_POST['pass'];
	  $e = $_POST['email'];
   }

   // hehehe
   @$link = mysql_connect("$db_host", "$db_u", "$db_p");
   if (!$link) {
	  die('Could not connect: ' . mysql_error());
   }
   mysql_select_db('realmd');
   $q = "insert into account ( username,password,gmlevel,sessionkey,joindate,banned,last_ip,failed_logins,locked,last_login,online) values ('$u','$p','0','',NOW(),'0','127.0.0.1','0','0','2000-01-01 00:00:00','0')";

}
?>
</html>

  • 0

Advertisements


#2
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
error_reporting(0);

That will turn of sending errors.

If you have PHP 5 it is possible catch errors and then do something else. Do you know if you have PHP 5?
  • 0

#3
Linden

Linden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 57 posts
Umm let me check
  • 0

#4
Linden

Linden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 57 posts
YAY!!! IT WORKED!!! Thanks sexy :whistling:.
Does anyone mind helping me clean the code? :S
  • 0

#5
mpfeif101

mpfeif101

    Member 1K

  • Retired Staff
  • 1,411 posts

Does anyone mind helping me clean the code? :S


Choose better, more descriptive variables and comment your code.
  • 0

#6
Linden

Linden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 57 posts
I just copy + Pasted this from an account creation script.
After "else" is some account creation code. I have tried getting rid of it. but it kills the status -_-. any specific parts i need to remove?
Thanks

Edited by Linden, 08 January 2007 - 06:21 AM.

  • 0

#7
Michael

Michael

    Retired Staff

  • Retired Staff
  • 1,869 posts
??

<html>
<?php
   // Realm Status

   $h = "epswow.servegame.com";	//server address
   $p = "3724";		//default realmd port
   $s = fsockopen($h, $p, $errno, $errstr, 2);

   if(!$s){
	   echo "<font color=darkblue><strong>server is:</font></strong>"." <font color=red><strong>Down!</strong></font>";
   }
   else
   {
	   echo " <font color=darkblue><strong>server is:</font></strong>" ." <font color=darkgreen><strong>Online!</strong></font>";
   }

?>
</html>

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP