Header problem please help!!

hi I’m trying to redirect my page to another page after a user registers. but every time the user registers, it inputs the detail to the database but it doesn’t allow them to register. it is doing this to every header statement I have on each page on my website.

This is the error:

Warning: Cannot modify header information - headers already sent by (output started at /home/abdulrab/public_html/Kasco/storeuser/user_register.php:2) in /home/abdulrab/public_html/Kasco/storeuser/user_register.php on line 85

I was told it’s because of an echo (html) before the header, I’m new to all this so please can anyone help me

thank you

this is the code to my register page:
[php]
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
 
<?php

 
// Connect to the MySQL database
include "../storescripts/connect_to_mysql.php";
 
 
//This code runs if the form has been submitted
 
if (isset($_POST['submit'])) {
 
 
 
//This makes sure they did not leave any fields blank
 
if (!$_POST['firstname'] | !$_POST['surname'] | !$_POST['address1'] | !$_POST['postcode'] | !$_POST['phonenumber'] | !$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] ) {

header(“location: register_user_fail.php”);
exit();

}
 
 
 
// checks if the username is in use
 
if (!get_magic_quotes_gpc()) {
 
$_POST['username'] = addslashes($_POST['username']);
 
}
 
$usercheck = $_POST['username'];
 
$check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'")
 
or die(mysql_error());
 
$check2 = mysql_num_rows($check);
 
 
 
//if the name exists it gives an error
 
if ($check2 != 0) {
 
 header("location: username_is_used.php");

exit();

} 
 
 
// this makes sure both passwords entered match
 
if ($_POST['pass'] != $_POST['pass2']) {

header(“location: password_don’t_match.php”);
exit();

}
 
 
 
 
 
// now we insert it into the database
 
$insert = "INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email)
 
VALUES ('".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['postcode']."',  '".$_POST['phonenumber']."', '".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";

$add_member = mysql_query($insert);
if (!$add_member) echo “$insert
”.mysql_error();
?>

 <?php
  header("location: register_success.php");

exit(); ?>

<?php
}
 
else
{
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Register</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" />
</head>
<body>
<div align="center" id="wrapper">
<?php include_once("user_login_template_header.php");?>
<div id="content">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="32%" valign="top">
</td>
<td width="35%" valign="top">
 
 
 
 
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
 
<table border="0">
First Name:
<input type="text" name="firstname" maxlength="60">
 
</td></tr>
Surname:
<input type="text" name="surname" maxlength="60">
 
</td></tr>
Address 1:
<input type="text" name="address1" maxlength="60">
 
</td></tr>
Address 2:
<input type="text" name="address2" maxlength="60">
 
</td></tr>
Postcode:
<input type="text" name="postcode" maxlength="9">
 
</td></tr>
Telephone Number:
<input type="text" name="phonenumber" maxlength="12">
 
</td></tr>



<tr><td>Username:</td><td>
 
<input type="text" name="username" maxlength="60">
 
</td></tr>
 
<tr><td>Password:</td><td>
 
<input type="password" name="pass" maxlength="25">
 
</td></tr>
 
<tr><td>Confirm Password:</td><td>
 
<input type="password" name="pass2" maxlength="25">
 
</td></tr>
Email:
<input type="email" name="email" maxlength="60">
 
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Register"></th></tr> </table>
 
</form>
 
 
 
<br />
</p>
<p><br />
</p></td>
<td width="33%" valign="top">
</td>
</tr>
</table>
 
</div>
<?php include_once("../footer.php");?>
</div>
</body>
</html>
<?php
 
}
?>[/php]

You have several blank lines (outside of your php code) before your headers. It appears that the very first line is blank. In addition, you have several php closing tags ( ?> ) with some blank space and then an opening tag ( <?php ). There is no reason to do this, and in this case it is sending blank lines to the browser and will throw an error if a header call is made after the occurrence.

I didn’t look over the code, other than to remove the offending spaces, but see if this works for you: (make sure the <?php tag is the VERY FIRST thing on your page)[php]<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);

// Connect to the MySQL database
include "../storescripts/connect_to_mysql.php";
 
 
//This code runs if the form has been submitted
 
if (isset($_POST['submit'])) {
 
 
 
//This makes sure they did not leave any fields blank
 
if (!$_POST['firstname'] | !$_POST['surname'] | !$_POST['address1'] | !$_POST['postcode'] | !$_POST['phonenumber'] | !$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] ) {

header(“location: register_user_fail.php”);
exit();

}
 
 
 
// checks if the username is in use
 
if (!get_magic_quotes_gpc()) {
 
$_POST['username'] = addslashes($_POST['username']);
 
}
 
$usercheck = $_POST['username'];
 
$check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'")
 
or die(mysql_error());
 
$check2 = mysql_num_rows($check);
 
 
 
//if the name exists it gives an error
 
if ($check2 != 0) {
 
 header("location: username_is_used.php");

exit();

} 
 
 
// this makes sure both passwords entered match
 
if ($_POST['pass'] != $_POST['pass2']) {

header(“location: password_don’t_match.php”);
exit();

}
 
 
 
 
 
// now we insert it into the database
 
$insert = "INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email)
 
VALUES ('".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['postcode']."',  '".$_POST['phonenumber']."', '".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";

$add_member = mysql_query($insert);
if (!$add_member) echo “$insert
”.mysql_error();

  header("location: register_success.php");

exit();
}

else
{
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Register</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" />
</head>
<body>
<div align="center" id="wrapper">
<?php include_once("user_login_template_header.php");?>
<div id="content">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="32%" valign="top">
</td>
<td width="35%" valign="top">
 
 
 
 
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
 
<table border="0">
First Name:
<input type="text" name="firstname" maxlength="60">
 
</td></tr>
Surname:
<input type="text" name="surname" maxlength="60">
 
</td></tr>
Address 1:
<input type="text" name="address1" maxlength="60">
 
</td></tr>
Address 2:
<input type="text" name="address2" maxlength="60">
 
</td></tr>
Postcode:
<input type="text" name="postcode" maxlength="9">
 
</td></tr>
Telephone Number:
<input type="text" name="phonenumber" maxlength="12">
 
</td></tr>



<tr><td>Username:</td><td>
 
<input type="text" name="username" maxlength="60">
 
</td></tr>
 
<tr><td>Password:</td><td>
 
<input type="password" name="pass" maxlength="25">
 
</td></tr>
 
<tr><td>Confirm Password:</td><td>
 
<input type="password" name="pass2" maxlength="25">
 
</td></tr>
Email:
<input type="email" name="email" maxlength="60">
 
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Register"></th></tr> </table>
 
</form>
 
 
 
<br />
</p>
<p><br />
</p></td>
<td width="33%" valign="top">
</td>
</tr>
</table>
 
</div>
<?php include_once("../footer.php");?>
</div>
</body>
</html>
<?php
 
}[/php]

Please let me know if this doesn’t resolve the issue and we will look at it a little deeper.

It seems to work for me (I had to comment out the references and the SQL queries). However, have a look at this section of your code. Lines 73 - 80… First your exiting and entering php a lot when you do not need to like here why exit php ?> after the exit(); statement? your next piece of code is just more php so you have to open php again. Also this if then statement is formatted strangely best I can tell try my version…

Yours:
[php]
$add_member = mysql_query($insert);
if (!$add_member) echo “$insert
”.mysql_error();

  header("location: register_success.php");

exit(); ?>

<?php

[/php]

Mine:

[php] $add_member = mysql_query($insert);
if (!$add_member) {
echo “$insert
”.mysql_error();
} else {
header(“location: register_success.php”);
exit();
}
[/php]

Thank you for your reply both of you I tryed both advice but it still does the same :slight_smile:

I did that here, but it still says the same error

Warning: Cannot modify header information - headers already sent by (output started at /home/abdulrab/public_html/Kasco/storeuser/user_register.php:1) in /home/abdulrab/public_html/Kasco/storeuser/user_register.php on line 40

I heared something about UTF-8 but not sure what that is, it says it on top of my code editor

this is the modified code:
[php] <?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);
?>
<?php
// Connect to the MySQL database
include “…/storescripts/connect_to_mysql.php”;
//This code runs if the form has been submitted
if (isset($_POST[‘submit’])) {
//This makes sure they did not leave any fields blank
if (!$_POST[‘firstname’] | !$_POST[‘surname’] | !$_POST[‘address1’] | !$_POST[‘postcode’] | !$_POST[‘phonenumber’] | !$_POST[‘username’] | !$_POST[‘pass’] | !$_POST[‘pass2’] | !$_POST[‘email’] ) {
header(“location: register_user_fail.php”);
exit();
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST[‘username’] = addslashes($_POST[‘username’]);
}
$usercheck = $_POST[‘username’];
$check = mysql_query(“SELECT username FROM user WHERE username = ‘$usercheck’”)
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
header(“location: username_is_used.php”);
exit();
}
// this makes sure both passwords entered match
if ($_POST[‘pass’] != $_POST[‘pass2’]) {
header(“location: password_don’t_match.php”);
exit();
}
// now we insert it into the database
$insert = “INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email)
VALUES (’”.$_POST[‘firstname’]."’, ‘".$_POST[‘surname’]."’, ‘".$_POST[‘address1’]."’, ‘".$_POST[‘address2’]."’, ‘".$_POST[‘postcode’]."’, ‘".$_POST[‘phonenumber’]."’, ‘".$_POST[‘username’]."’, ‘".$_POST[‘pass’]."’, ‘".$_POST[‘email’]."’)";
$add_member = mysql_query($insert);
if (!$add_member) {
echo “$insert
”.mysql_error();
} else {
header(“location: register_success.php”);
exit();
}
?>
<?php
}
else
{
?>




User Register




<?php include_once("user_login_template_header.php");?>








First Name:

Surname:
Address 1:
Address 2:
Postcode:
Telephone Number:
Username:
Password:
Confirm Password:
Email:


<?php include_once("../footer.php");?>
<?php } ?>[/php]

Try placing ob_start(); as the first thing after the <?php line.

I did that still the same problem

you have any other ideas that might help please

thanks :slight_smile:

Please try the following:[php]<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);

// Connect to the MySQL database
include “…/storescripts/connect_to_mysql.php”;

//This code runs if the form has been submitted
if (isset($_POST[‘submit’]))
{
//This makes sure they did not leave any fields blank
if (!$_POST[‘firstname’] || !$_POST[‘surname’] || !$_POST[‘address1’] || !$_POST[‘postcode’] || !$_POST[‘phonenumber’] || !$_POST[‘username’] || !$_POST[‘pass’] || !$_POST[‘pass2’] || !$_POST[‘email’])
{
header(“location: register_user_fail.php”);
exit();
}

  // checks if the username is in use
  if (!get_magic_quotes_gpc())
    {
        $_POST['username'] = addslashes($_POST['username']);
    }
 
  $usercheck = $_POST['username'];
  $check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'") or die(mysql_error());
  $check2 = mysql_num_rows($check);
 
  //if the name exists it gives an error
  if ($check2 != 0)
    {
        header("location: username_is_used.php");
        exit(); 
    } 
 
  // this makes sure both passwords entered match
  if ($_POST['pass'] != $_POST['pass2'])
    {
        header("location: password_don't_match.php");
        exit(); 
    }
 
  // now we insert it into the database
  $insert = "INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email) VALUES ('".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['postcode']."',  '".$_POST['phonenumber']."', '".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";
 
  $add_member = mysql_query($insert);
  
  if ($add_member)
    {
        header("location: register_success.php");
        exit();
    }
  else echo "$insert<br/>".mysql_error();

}
else
{
?>




User Register




<?php include_once("user_login_template_header.php");?>





<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
 
<table border="0">
First Name:
<input type="text" name="firstname" maxlength="60">
 
</td></tr>
Surname:
<input type="text" name="surname" maxlength="60">
 
</td></tr>
Address 1:
<input type="text" name="address1" maxlength="60">
 
</td></tr>
Address 2:
<input type="text" name="address2" maxlength="60">
 
</td></tr>
Postcode:
<input type="text" name="postcode" maxlength="9">
 
</td></tr>
Telephone Number:
<input type="text" name="phonenumber" maxlength="12">
 
</td></tr>



<tr><td>Username:</td><td>
 
<input type="text" name="username" maxlength="60">
 
</td></tr>
 
<tr><td>Password:</td><td>
 
<input type="password" name="pass" maxlength="25">
 
</td></tr>
 
<tr><td>Confirm Password:</td><td>
 
<input type="password" name="pass2" maxlength="25">
 
</td></tr>
Email:
<input type="email" name="email" maxlength="60">
 
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Register"></th></tr> </table>
 
</form>
 
 
 
<br />
</p>
<p><br />
</p></td>
<td width="33%" valign="top">
</td>
</tr>
</table>
 
</div>
<?php include_once("../footer.php");?>
</div>
</body>
</html>
<?php
 
}
?>
[/php]

I have setup a database and successfully tested this (minus your includes). If it throws the same error (I suspect it will), the problem is likely with your first included file ("…/storescripts/connect_to_mysql.php"). Check it for any whitespace outside of your php open and close tags (<?php ... ?>)

Once you get this resolved, you need to sanitize your post variables before sending them to your database! I would also change your password handling, you should be hashing the values - not storing them in plain text. I would also recommend some changes to your html markup. We will tackle these after you have a working script… Let us know.

comment out the include line at the top and hard code a mysql connector instead and see if that fixes the issue. Basically everything I can find points to the include line.

Thanks

I tried it and it didn’t work

this is the connect ot my sql file and i can’t see anything wrong with it

[php] <?php
// Created BY Adam Khoury @ www.flashbuilding.com - 6/19/2008
/*
1: “die()” will exit the script and show an error statement if something goes wrong with the “connect” or “select” functions.
2: A “mysql_connect()” error usually means your username/password are wrong
3: A “mysql_select_db()” error usually means the database does not exist.
*/
// Place db host name. Sometimes “localhost” but
// sometimes looks like this: >> ???mysql??.someserver.net
$db_host = “localhost”;
// Place the username for the MySQL database here
$db_username = “xxxxxxx”;
// Place the password for the MySQL database here
$db_pass = “xxxxxxx”;
// Place the name for the MySQL database here
$db_name = “xxxxxxxx”;
// Run the actual connection here
mysql_connect("$db_host","$db_username","$db_pass") or die (“could not connect to mysql”);
mysql_select_db("$db_name") or die (“no database”);
?>[/php]

Why is all the code your posting tabbed over once? your <?php opener should not have anything in front of it.

thanks

I added this line instead of the include and it works

[php]mysql_connect(“localhost”, “xxxxxxxx”, “xxxxxxxx”) or die(mysql_error());
mysql_select_db(“xxxxxxxxx”) or die(mysql_error());[/php]

I’m new to PHP so I don’t know a lot about the syntax

if you could help, I’d love to learn more about it

thanks to both of you

You do not return from a header(); command it is a one way trip so they have to be executed before any other html code is used. In your case all those white spaces in front of your <?php basically starts your html file. That is why you were throwing the error.

I would vet all your php for white spaces and or blank lines. Here is what your php script looks like with standard tabbing practices and no white spaces or blank lines.

[php]<?php
error_reporting(E_ALL);
ini_set(‘display_errors’, ‘1’);
// Connect to the MySQL database
include “…/storescripts/connect_to_mysql.php”;
//This code runs if the form has been submitted
if (isset($_POST[‘submit’])) {
//This makes sure they did not leave any fields blank
if (!$_POST[‘firstname’] | !$_POST[‘surname’] | !$_POST[‘address1’] | !$_POST[‘postcode’] | !$_POST[‘phonenumber’] | !$_POST[‘username’] | !$_POST[‘pass’] | !$_POST[‘pass2’] | !$_POST[‘email’] ) {
header(“location: register_user_fail.php”);
exit();
}
// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST[‘username’] = addslashes($_POST[‘username’]);
}
$usercheck = $_POST[‘username’];
$check = mysql_query(“SELECT username FROM user WHERE username = ‘$usercheck’”)
or die(mysql_error());
$check2 = mysql_num_rows($check);
//if the name exists it gives an error
if ($check2 != 0) {
header(“location: username_is_used.php”);
exit();
}
// this makes sure both passwords entered match
if ($_POST[‘pass’] != $_POST[‘pass2’]) {
header(“location: password_don’t_match.php”);
exit();
}
// now we insert it into the database
$insert = “INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email)
VALUES (’”.$_POST[‘firstname’]."’, ‘".$_POST[‘surname’]."’, ‘".$_POST[‘address1’]."’, ‘".$_POST[‘address2’]."’, ‘".$_POST[‘postcode’]."’, ‘".$_POST[‘phonenumber’]."’, ‘".$_POST[‘username’]."’, ‘".$_POST[‘pass’]."’, ‘".$_POST[‘email’]."’)";
$add_member = mysql_query($insert);
$add_member = 1;
if (!$add_member) {
echo “$insert
”.mysql_error();
} else {
header(“location: register_success.php”);
exit();
}
} else {
?>
User Register



<?php include_once("user_login_template_header.php");?>





















































First Name:

Surname:

Address 1:

Address 2:
Postcode:
Telephone Number:
Username:
Password:
Confirm Password:
Email:




<?php include_once("../footer.php");?>

<?php } ?>[/php]

Compared to what you were posting

[php]
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
 
<?php

 
// Connect to the MySQL database
include "../storescripts/connect_to_mysql.php";
 
 
//This code runs if the form has been submitted
 
if (isset($_POST['submit'])) {
 
 
 
//This makes sure they did not leave any fields blank
 
if (!$_POST['firstname'] | !$_POST['surname'] | !$_POST['address1'] | !$_POST['postcode'] | !$_POST['phonenumber'] | !$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] | !$_POST['email'] ) {

header(“location: register_user_fail.php”);
exit();

}
 
 
 
// checks if the username is in use
 
if (!get_magic_quotes_gpc()) {
 
$_POST['username'] = addslashes($_POST['username']);
 
}
 
$usercheck = $_POST['username'];
 
$check = mysql_query("SELECT username FROM user WHERE username = '$usercheck'")
 
or die(mysql_error());
 
$check2 = mysql_num_rows($check);
 
 
 
//if the name exists it gives an error
 
if ($check2 != 0) {
 
 header("location: username_is_used.php");

exit();

} 
 
 
// this makes sure both passwords entered match
 
if ($_POST['pass'] != $_POST['pass2']) {

header(“location: password_don’t_match.php”);
exit();

}
 
 
 
 
 
// now we insert it into the database
 
$insert = "INSERT INTO user (firstname, surname, address1, address2, postcode, phonenumber, username, password, email)
 
VALUES ('".$_POST['firstname']."', '".$_POST['surname']."', '".$_POST['address1']."', '".$_POST['address2']."', '".$_POST['postcode']."',  '".$_POST['phonenumber']."', '".$_POST['username']."', '".$_POST['pass']."', '".$_POST['email']."')";

$add_member = mysql_query($insert);
if (!$add_member) echo “$insert
”.mysql_error();
?>

 <?php
  header("location: register_success.php");

exit(); ?>

<?php
}
 
else
{
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>User Register</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" media="screen" />
</head>
<body>
<div align="center" id="wrapper">
<?php include_once("user_login_template_header.php");?>
<div id="content">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td width="32%" valign="top">
</td>
<td width="35%" valign="top">
 
 
 
 
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
 
<table border="0">
First Name:
<input type="text" name="firstname" maxlength="60">
 
</td></tr>
Surname:
<input type="text" name="surname" maxlength="60">
 
</td></tr>
Address 1:
<input type="text" name="address1" maxlength="60">
 
</td></tr>
Address 2:
<input type="text" name="address2" maxlength="60">
 
</td></tr>
Postcode:
<input type="text" name="postcode" maxlength="9">
 
</td></tr>
Telephone Number:
<input type="text" name="phonenumber" maxlength="12">
 
</td></tr>



<tr><td>Username:</td><td>
 
<input type="text" name="username" maxlength="60">
 
</td></tr>
 
<tr><td>Password:</td><td>
 
<input type="password" name="pass" maxlength="25">
 
</td></tr>
 
<tr><td>Confirm Password:</td><td>
 
<input type="password" name="pass2" maxlength="25">
 
</td></tr>
Email:
<input type="email" name="email" maxlength="60">
 
</td></tr>
<tr><th colspan=2><input type="submit" name="submit"
value="Register"></th></tr> </table>
 
</form>
 
 
 
<br />
</p>
<p><br />
</p></td>
<td width="33%" valign="top">
</td>
</tr>
</table>
 
</div>
<?php include_once("../footer.php");?>
</div>
</body>
</html>
<?php
 
}
?>[/php]

notice all the white space before the <?php in your version event your connect_to_mysql.php file had whitespace before the <?php which could have thrown the include line out of whack.

Sponsor our Newsletter | Privacy Policy | Terms of Service