Jump to content

This short code works on my local database, but not on host´s. Why?


Fenhopi

Recommended Posts

Hi, this code worked on my local database, but not when I uploaded it to 000webhost. The tables I have set up there is exactly the same as the ones I have on my local server. Here's the code:

<?

include("include/session.php");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Opheim Online - Blog</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- start header -->
<div id="contmain">
<div id="main">
<div id="header">
<div id="logo">
<h1><a href="#"></a></h1>
<h2><a href="" id="metamorph"></a></h2>
</div>
<div id="menu">
		  <?
if($session->logged_in){
?>
	<ul>
		<li><a href="index.php">Home</a></li>
		<li><a href="blog.php">Blogs</a></li>
            <li><a href="aboutme.php">About me</a></li>  
		<li><? echo "[<a href=\"userinfo.php?user=$session->username\">My Account</a>]"; ?></li>
		<li><? echo "[<a href=\"useredit.php\">Edit Account</a>]"; ?></li>
            <li><? echo "[<a href=\"viewmembers.php\">View Members</a>] "; ?></li>         
	</ul>
    <?
}
else{
?>
    	 <ul>
		<li><a href="index.php">Home</a></li>
	</ul>
    <?
}
?>
</div>	
<!-- end header -->
</div>
<!-- start page -->
<div id="page">
<!-- start content -->
<div id="content">
            <div class="box2">

     <?
if($session->logged_in){
/* Requested Username error checking */
$req_user = trim($_GET['myfriend']);
if(!$req_user || strlen($req_user) == 0 ||
   		!eregi("^([0-9a-z])+$", $req_user) ||
  		!$database->usernameTaken($req_user)){
  		die("Username not registered");
}
	$req_user_info = $database->getUserInfo($req_user);

	$id = $_GET['myfriend'];
	$username = $_SESSION['username'];


	$sql2 = "SELECT * FROM friends2 WHERE user1='$username'";
	$query2 = mysql_query($sql2);
	$check2 = mysql_num_rows($query2);

// if you want the limit to be 50, you put 49 after < (the number minus 1)

	$sql = "INSERT INTO friends2 (rid, user1, user2, status) VALUES('', '$username', '$id', '0')";
	mysql_query($sql);
	echo "Friend added";
}


?>

</div></div>

<!-- end content -->
<!-- start sidebar two -->

</div><!-- end sidebar two -->
<div id="bottom" style="clear: both;"></div>
</div><!-- end page -->
<!-- start footer -->
<div id="footer">
<p>Copyright ©  2010, Opheim Online </p>
</div>
</div>
</div>
<!-- end footer -->

</html>





 

Please point it out to me if there's something you can tell is obviously wrong. Thank you!

 

Link to comment
Share on other sites

Have you only just setup the account, I think that 000webhost has to check and confirm your site isn't using any copyrighted material and complys to the terms of service before they activate your account, which they do manually...

Link to comment
Share on other sites

If your using a database, I think that 000webhost uses something otherthan localhost for mysql connection?

 

try adding:

 

error_reporting(E_ALL);
ini_set('display_errors', 'on');

 

To the top of your script.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.