السلام عليكم
واجهتني مشكلة في كود php ولا ادري السبب!!
المشكلة في الكود التالي عند سطر
$IPaddress = getenv("REMOTE_ADDR");
وهذا الكود كامل
كود:
<?php
include("includes/header.php");
require_once("includes/config.php");
require_once("includes/settings.php");
require_once("includes/functions.php");
include("classes/class_user_register.php");
$register=trim($_GET['register']);
//-------------------------------------------------------
//Check and submit registration
if($register == "send"){
$username = trim($_POST['username']);
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$password = trim($_POST['password']);
$password1 = trim($_POST['password1']);
$passwordhint = trim($_POST['passwordhint']);
$email = trim($_POST['email']);
$email1 = trim($_POST['email1']);
$secret_question = trim($_POST['security_answer']);
$spam_answer = trim($_POST['captchacode']);
$membership_type = $_POST['membership_type'];
$birth_day = $_POST['birth_day'];
$birth_month = $_POST['birth_month'];
$birth_year = intval(trim($_POST['birth_year']));
$IPaddress = getenv("REMOTE_ADDR"); //$_SERVER["REMOTE_ADDR"];
$hostaddress = $_SERVER['REMOTE_HOST'];
if($username == ""){
echo "<div class=\"error_center\">You forgot to enter a user name.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if(check_user_format($username) == 0){
echo "<div class=\"error_center\">Make sure you use the correct format for the username.<br />
Use only the following carecters 0-9, a-z, whitespace, - and _<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if($firstname == ""){
echo "<div class=\"error_center\">You forgot to enter a first name.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if($lastname == ""){
echo "<div class=\"error_center\">You forgot to enter a last name.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if($password != $password1){
echo "<div class=\"error_center\">You forgot to enter a last name.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if(strlen($password) <= 6){
echo "<div class=\"error_center\">The password length should be at least 7 charecters in length<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if($email != $email1){
echo "<div class=\"error_center\">Your email does not match the confermation email you provided.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if(strlen($password) <= 6){
echo "<div class=\"error_center\">The password length should be at least 7 charecters in length<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if($secret_question == ""){
echo "<div class=\"error_center\">You forgot to enter a security answer.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
/*
if(($spam_answer != $_cookie["captchacode"]) OR (!isset($_cookie["captchacode"])) )
{
echo "<div class=\"error_center\">You enterd the incorect spam answer.<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back and enter the correct spam answer.</div>";
exit();
}
*/
if( empty($membership_type)){
echo "<div class=\"error_center\">You have to select your membership type<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if( empty($birth_day)){
echo "<div class=\"error_center\">You have to select your day of birth<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if( empty($birth_month)){
echo "<div class=\"error_center\">You have to select your month of birth<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
if( empty($birth_year) OR ($birth_year < 1900) OR ($birth_year > date('Y') )){
echo "<div class=\"error_center\">You forgot to enter your year of birth or enter a worng format year. ex 1985<br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
exit();
}
//Make sure the username or email does not exists already!
$check_if_user_exists = mysql_query("SELECT id,username,membership_email FROM users WHERE username LIKE '%$username%' OR membership_email LIKE '%$email%' ");
$total_data_found = mysql_num_rows($check_if_user_exists);
if($total_data_found > 0){
$data_found = mysql_fetch_array($check_if_user_exists );
if( $data_found_username == $username){
echo "<div class=\"error_center\">Sorry, the username you try already exists.<br /></div><div class=\"div_center\">
If you own this account but fogot your password <a href=\"login.php?password=recovery\">Click Here</a> to reset your password.
Or, <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
}
if( $data_found_email == $email){
echo "<div class=\"error_center\">Sorry, the email you try already exists.<br /></div><div class=\"div_center\">
If you own this account but fogot your password <a href=\"login.php?password=recovery\">Click Here</a> to reset your password.
Or, <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
}
exit();
}
if($membership_type == "trial"){
//head
echo "<img src=\"images/trial_finish_current.png\" border=\"0\" /><br />";
$new_reg = new user_register($username, $password, $passwordhint, $firstname, $lastname, $membership_type, $email, $IPaddress, $hostaddress,$secret_question,$birth_day,$birth_month,$birth_year);
if($new_reg){
echo "<div class=\"pass_center\">You have completed your registration sucsessfuly. </div><br /><div class=\"div_center\">You can start creating you profile at this time <a href=\"control/user_control.php\">(Click here to create your profile)</a> Thank you for registering with us. </div>";
} else {
echo "<div class=\"error_center\">Unknown Error (0001): Can't add new user. Please try again. Homever, if you contenio to get the same error please contect our constomer care and provide the error number for help. <br />
</div><div class=\"div_center\">Please <a href=\"javascript:history.go(-1)\">Click Here</a> to go back</div>";
}
//end the tiral statment
}
if( ($membership_type == "monthly") || ($membership_type == "anual") ){
echo "<img src=\"images/full_registration_current.png\" border=\"0\" /><br /><br />";
if($membership_type == "monthly"){
$payment_amount = $SETTINGS['full_member_monthly_cost'];
} else {
$payment_amount = $SETTINGS['full_member_anual_cost'];
}
echo "<form action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">
<input type=\"hidden\" name=\"cmd\" value=\"_xclick\">
<input type=\"hidden\" name=\"business\" value=\"".$SETTINGS['paypal_email']."\">
<input type=\"text\" name=\"amount\" value=\"$payment_amount\" disabled >
<input type=\"hidden\" name=\"no_shipping\" value=\"0\">
<input type=\"hidden\" name=\"no_note\" value=\"1\">
<input type=\"hidden\" name=\"currency_code\" value=\"USD\">
<input type=\"hidden\" name=\"lc\" value=\"AU\">
<input type=\"hidden\" name=\"bn\" value=\"PP-BuyNowBF\">
<input type=\"hidden\" name=\"return\" value=\"".$SETTINGS['site_domain']."/payment-complete/\">
<br /><br />
<input type=\"submit\" value=\"Pay with PayPal!\">
</form>";
}
//exit at the end
exit();
}
//head
echo "<img src=\"images/trial_registration_current.png\" border=\"0\" /><br /><br />";
//form
echo"<fieldset>
<legend>Registration Forum</legend><form method=\"post\" action=\"$PHP_SELF?register=send\">
<table class=\"flex_table\" width=\"100%\" style=\"border: 1px solid gray;\">
<tr>
<th colspan=\"2\" class=\"cat\">Personal Information</th>
</tr>
<tr>
<td class=\"alt\">
User Name:<br />
<font class=\"smallnote\">Use only the following carecters <br />0-9, a-z, whitespace, - and _</font>
</td>
<td class=\"alt\">
<input type=\"text\" name=\"username\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt2\">
First Name:
</td>
<td class=\"alt2\">
<input type=\"text\" name=\"firstname\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt\">
Last Name:
</td>
<td class=\"alt\">
<input type=\"text\" name=\"lastname\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt2\">
Password:<br />
<font class=\"smallnote\">Minimum of 7 carecters long</font>
</td>
<td class=\"alt2\">
<input type=\"password\" name=\"password\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt\">
Confirm Password:
</td>
<td class=\"alt\">
<input type=\"password\" name=\"password1\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt2\">
Password Hint:
</td>
<td class=\"alt2\">
<input type=\"text\" name=\"passwordhint\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt\">
Email:
</td>
<td class=\"alt\">
<input type=\"text\" name=\"email\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt2\">
Confirm Email:</td>
<td class=\"alt2\">
<input type=\"text\" name=\"email1\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt\">
Birth Date:</td>
<td class=\"alt\">
<select name=\"birth_month\">
<option value=\"1\" selected>January</option>
<option value=\"2\">February</option>
<option value=\"3\">March</option>
<option value=\"4\">April</option>
<option value=\"5\">May</option>
<option value=\"6\">June</option>
<option value=\"7\">July</option>
<option value=\"8\">August</option>
<option value=\"9\">September</option>
<option value=\"10\">October</option>
<option value=\"11\">November</option>
<option value=\"12\">Desember</option>
</select>
<select name=\"birth_day\">";
for($i=1; $i<32; $i++){
if($i == 1)
$checked = "selected";
else
$checked = "";
echo "<option value=\"$i\" $checked>$i</option>";
}
echo "</select>
<input type=\"text\" name=\"birth_year\" value=\"\" size=\"4\" maxlength=\"4\" class=\"input\" />
</td>
</tr>
<tr>
<td class=\"alt2\">
Security Question:<br />
What is your mother Maiden Name?
</td>
<td class=\"alt2\">
<input type=\"text\" name=\"security_answer\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>";
/*
<tr>
<td class=\"alt\" width=\"170\">
Spam check:
<div class=\"smallnote\">Please type in the box the word or number you see in the image.</div>
<br />
</td>
<td class=\"alt\">";
echo "<img src=\"includes/captcha.php\" /><br />
<input type=\"text\" name=\"captchacode\" value=\"\" size=\"28\" class=\"input\" />
</td>
</tr>
*/
echo "<tr>
<th colspan=\"2\" class=\"cat\">Membership Type</th>
</tr>
<tr>
<td class=\"alt2\" width=\"170\">
Membership Type:
</td>
<td class=\"alt2\">
<input type=\"radio\" name=\"membership_type\" value=\"trial\" CHECKED /> Trial Member <font color=\"red\">(".$SETTINGS['trial_length'].")</font><br />
<br />
Full Membership (Paid) <br />
<input type=\"radio\" name=\"membership_type\" value=\"full_monthly\" /> ".$SETTINGS['full_member_monthly']." ".$SETTINGS['full_member_monthly_cost']."<br />
<input type=\"radio\" name=\"membership_type\" value=\"full_anual\" /> ".$SETTINGS['full_member_anual']." ".$SETTINGS['full_member_anual_cost']."
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\" class=\"alt\">
<input type=\"submit\" name=\"mysubmit\" value=\"Submit\" />
</td>
</tr>
</table>
</form>
</fieldset>";
include("includes/footer.php");
?>