Jump to content

500 internal server error?


shorty3

Recommended Posts

This is My Code Which Works BUT when some one registers they get 500 internal server error? . This is my code

<?php
session_start();
include_once"includes/db_connect.php";
if (isset($_SESSION['username'])){
header("Location: authenticated.php");
exit();
}

function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
;$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
;$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}

$curpage = curPageURL();

function parse_url_query($url) {  
$url = parse_url($url);  
$refquery = array();  
foreach(explode('&',$url['query']) as $segment) {    
list($var, $val) = explode('=', $segment);    
$refquery[$var] = $val;  
}  
return $refquery;
} 
$url= $curpage;

$refquery = parse_url_query($url);
$refusername = $refquery['ref'];

$findusername = mysql_query("SELECT username FROM users");

$from_user=strip_tags($_POST['ref']);
if ($_POST['Submit']){

// Define post fields into simple variables 
$reg_username = $_POST['reg_username']; 

$email = $_POST['email'];
$email1 = $_POST['email1']; 
$location=strip_tags($_POST['location']); 
$reg_username=trim($reg_username);

$today = gmdate('Y-m-d h:i:s');


$reg_username = stripslashes($reg_username); 
$email = stripslashes($email); 
$quote = stripslashes($quote); 
$reg_username = strip_tags($reg_username); 
$email = strip_tags($email); 




if((!$reg_username) || (!$email) || (!$location)){ 
$message="Fill in all fields";
}else{
if ($email != $email1){
$message="Emails do not match";
}elseif ($email == $email1){

if (ereg('[^A-Za-z0-9]', $reg_username)) {  $message="Your username can only contain letters and numbers.";
}elseif (!ereg('[^A-Za-z0-9]', $reg_username)) { 


if (strlen($reg_username) <= 3 || strlen($reg_username) >= 9){
$message= "Username must be over 3 and under 9";
}elseif (strlen($reg_username) > 3 || strlen($reg_username) < 9){


$sql_email_check = mysql_query("SELECT email FROM users 
            WHERE email='$email' AND status='Alive'"); 
$sql_username_check = mysql_query("SELECT username FROM users 
            WHERE username='$reg_username'"); 

$email_check = mysql_num_rows($sql_email_check); 
$username_check = mysql_num_rows($sql_username_check); 

if(($email_check > 0) || ($username_check > 0)){ 
    echo "Im sorry but there has been an error please read on..<br />"; 
    if($email_check > 0){ 
        $message= "Your email address has already been used!"; 
        unset($email); 
    } 
    if($username_check > 0){ 
        $message="Your desired username is already in use!"; 
        unset($reg_username); 
    } 
  
   
}else{

////England
if ($location == 'England'){
$uk[0] = rand(51,104);
$uk[1] = rand(90,412);
$uk[2] = rand(68,296);
$uk[3] = rand(23,47);
$uk[4] = rand(2705,3312);
$implodething = implode("-", $uk);
$city="London";
////America////
}elseif ($location == 'America'){
$amer[0] = rand(149,259);
$amer[1] = rand(113,582);
$amer[2] = rand(12,74);
$amer[3] = rand(82,150);
$amer[4] = rand(1700,2832);
$city="New York";
$implodething = implode("-", $amer);
///Australia///
}elseif ($location == 'Australia'){
$aus[0] = rand(31,301);
$aus[1] = rand(80,397);
$aus[2] = rand(23,118);
$aus[3] = rand(90,123);
$aus[4] = rand(316,812);
$city="Sydney";
$implodething = implode("-", $aus);
///Japan////
}elseif ($location == 'Japan'){
$japan[0] = rand(51,104);
$japan[1] = rand(90,412);
$japan[2] = rand(60,192);
$japan[3] = rand(98,116);
$japan[4] = rand(472,1003);
$city="Tokyo";
$implodething = implode("-", $japan);
///France////
}elseif ($location == 'France'){
$fra[0] = rand(78,112);
$fra[1] = rand(170,194);
$fra[2] = rand(118,132);
$fra[3] = rand(110,506);
$fra[4] = rand(1500,1703);
$city="Paris";
$implodething = implode("-", $fra);
//Germany//
}elseif ($location == 'Germany'){
$ger[0] = rand(70,159);
$ger[1] = rand(33,68);
$ger[2] = rand(110,191);
$ger[3] = rand(12,19);
$ger[4] = rand(1001,1308);
$city="Berlin";
$implodething = implode("-", $ger);

}



$ip = $_SERVER['REMOTE_ADDR'];

$random_password22=rand(11111,99999999);

mysql_query("INSERT INTO `user_info` ( `id` , `username`) 
VALUES (
'', '$reg_username')");

mysql_query("INSERT INTO `users` ( `id` , `username` , `password` , `activated` , `regged` , `email` , `location` , `r_ip`) 
VALUES (
'', '$reg_username', '$random_password22', '0', '$today', '$email', '$location', '$ip')");





     $userid = mysql_insert_id();
    // Let's mail the user! 
    $subject = "www.Quick-Shift.co.uk Online RPG"; 
    $message = "$reg_username, 
    Hello $reg_username , Thank You For Choosing Quick-Shift Your Login Information Is Below.
    
  Click to activate:http://www.quick-shift.co.uk/activate.php?id=$userid&code=$random_password22&r=$from_user

    
    Login Information:
    Username: $reg_username
    Password: $random_password22 
     
    Thanks 
    Quick-Shift Staff.
     
    This Is An Automated Response, Please Do Not Reply!"; 
     
    mail($email, $subject, $message, 
        "From: Quick-Shift<[email protected]>"); 
   $message= 'Account Created, Check E-mail Inbox Or Junk Mail To Activate Your Account.'; 
} }}}}}

?>


<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="includes/in.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="form2" method="post" action="">
        <table width="543" border="0" align="center" cellpadding="2" cellspacing="2"  class=thinline>
          <tr>
                  <td colspan="2" align="center"><font color=red> 
                      <? echo "$message"; ?>
                      </font></td>
          </tr>
          <tr>
            <td colspan="2" align="center">Must Fill Section * </td>
          </tr>
                <tr> 
                  <td width="23%">Username:</td>
                  <td width="77%"><input name="reg_username" type="text" id="reg_username" value="" size="30" maxlength="40">
                    *</td>
                </tr>
                <tr> 
                  <td>Email address:</td>
                  <td><input name="email" type="text" id="username3" value="" size="30" >
                    *</td>
                </tr>
                <tr> 
                  <td>Confirm email:</td>
                  <td><input name="email1" type="text" id="email" value="" size="30">
                    *</td>
                </tr>
                <tr> 
                  <td height="8">Starting location:</td>
                  <td><select name="location" id="starting" >
                      <option value="England" selected>England - London</option>
                      <option value="America">America - New York</option>
                      <option value="Australia">Australia - Sydney</option>
                      <option value="Japan">Japan - Tokyo</option>
                      <option value="France">France - Paris</option>
                      <option value="Germany">Germany - Berlin</option> 
                  </select> <input type=hidden name="ref" value="<?php echo "$_GET[ref]"; ?>"> 
                  *                  </td>
                </tr>
                <tr>
                  <td height="3" colspan="2"><p>Personal Information </p>
                  </td>
                </tr>
                <tr>
                  <td height="0">First Name : </td>
                  <td><label>
                    <input name="" type="text" id="" value="" size="30" maxlength="40">
                  </label></td>
                </tr>
                <tr>
                  <td height="-1">Second Name : </td>
                  <td><input name="" type="text" id="" value="" size="30" maxlength="40"></td>
                </tr>
                <tr>
                  <td height="1">Sex:</td>
                  <td><input name="" type="text" id="" value="" size="30" maxlength="40"></td>
                </tr>
                <tr>
                  <td height="1">Favourite Car: </td>
                  <td><input name="" type="text" id="" value="" size="30" maxlength="40"></td>
                </tr>
                <tr>
                  <td height="1">Favourite Bike: </td>
                  <td><input name="" type="text" id="" value="" size="30" maxlength="40"></td>
                </tr>
                <tr>
                  <td height="1">About Me: </td>
                  <td><input name="" type="text" id="" value="" size="30" maxlength="40"></td>
                </tr>
                <tr>
                  <td height="2" colspan="2"> </td>
                </tr>
                <tr> 
                  <td colspan="2" align="center"><input type="submit" name="Submit" value="Register"></td>
                </tr>
                <tr> 
                  <td colspan="2" align="center"><table width="300" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class="thinline">
                                    <tr>
                                      <td align="center">By Clicking this button you are agreeing with the Terms Of Service please read them here. Although the game is about street life and crime there Are Rules!!!! </td>
                                    </tr>
                                  </table></td>
                </tr>
</table>
        </td>
  

 

 

This is what they get

 

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

 

--------------------------------------------------------------------------------

 

Apache/2.0.52 (Red Hat) Server at www.quick-shift.co.uk Port 80

Link to comment
https://forums.phpfreaks.com/topic/201929-500-internal-server-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.