• 09-02-2009, 18:01:49
    #1
    <?
    	include_once("header.php");
    	include_once("class/member.class.php");
    
    
    	$user = new Member();
    	
    	$note = "";
    
    
    	if (isset($_GET["c"]))
    	{
    		if ($user->Active($_GET["c"]))
    		{
    			$confirm = "Thank you! Your membership has been confirmed.";
    		}else
    		{
    			$confirm = "Invalid active code.";
    		}
    		
    		$template->set_filenames(array("body" => "confirm.html"));
    		$template->assign_vars(array(
    			'COMFIRMMESS'=> "<div style='font-size: 13px; font-family: arial, helvetica;'>".$confirm."</div>"
    		));
    		
    		$template->pparse("body");
    	}
    	else
    	{
    		$ok = 0;
    		if(isset($_POST['register']))
    		{
    					
    			//Check valid registration
    			$ok = 1;
    			if (!isset($_POST["username"])|| strlen($_POST["username"])<3 || strlen($_POST["username"])>16)
    			{
    				$username_alert = "<img src = '".$template_dir."/images/alert.gif'> Username must be between 3 and 16 characters long";
    				$ok = 0;
    			}else
    				$username_alert = "";
    			
    			if (!isset($_POST["password"])|| strlen($_POST["password"])<=0)
    			{
    				$password_alert = "<img src = '".$template_dir."/images/alert.gif'> Missing password";
    				$ok = 0;
    			}else
    				if ($_POST["repassword"] != $_POST["password"])
    				{
    					$repassword_alert = "<img src = '".$template_dir."/images/alert.gif'> Retype password doesn't match with password";
    					$ok = 0;
    				}else
    				{
    					$repassword_alert = $password_alert = "";
    				}
    				
    			if (!isset($_POST["email"])|| $_POST["email"] == "" || !CheckEmail($_POST["email"]))
    			{
    				$email_alert = "<img src = '".$template_dir."/images/alert.gif'> Please enter a valid email address to continue";
    				$ok = 0;
    			}else
    				$email_alert = "";
    			
    			if (isset($_POST["pemail"]) && $_POST["pemail"] == "" || !CheckEmail($_POST["pemail"]))
    			{
    				$pemail_alert = "<img src = '".$template_dir."/images/alert.gif'> Invalid email address";
    				$ok = 0;
    			}else
    				$pemail_alert = "";
    
    			if (isset($_POST["semail"]) && $_POST["semail"] != "" && !CheckEmail($_POST["semail"]))
    			{
    				$semail_alert = "<img src = '".$template_dir."/images/alert.gif'> Invalid email address";
    				$ok = 0;
    			}else
    				$semail_alert = "";
    			
    			if (!isset($_POST["country"]) || $_POST["country"] == "")
    			{
    				$country_alert = "<img src = '".$template_dir."/images/alert.gif'> Please select one";
    				$ok = 0;
    			}else
    				$country_alert = "";
    		}
    		
    
    		 // Addnew user
    		 //------------------------------------------------------
    		 if ($ok == 1)		
    		 {
    			$ok = 0;
    			
    			if ($user->CheckExistsUserName($_POST["username"]))
    			{
    				$username_alert =  "<img src = '".$template_dir."/images/alert.gif'> Username is already in use";
    			}
    			else
    			if ($user->CheckExistsEmail($_POST["email"]))
    			{
    				$email_alert =  "<img src = '".$template_dir."/images/alert.gif'> Email is already in use.";
    			}
    			else
    			{ 
    			//Save data
    				$members_status = 0;
    				$member_activationcode = md5(time());
    		  
    				$user->AddNew($_POST['username'], $_POST['password'], $_POST['realname'], $_POST['email'],
    					$_POST['address'], $_POST['country'] , $_POST['pemail'], $_POST['semail'] , time(), $members_status, $member_activationcode, $_POST["ref"]);
    
    				//Gui mail thong bao
    				$to = $_POST['email'];
    				$subject = 'Action Required: Membership Activation' ;
    				$body = str_replace("{ACTIVE_LINK}", "<a href=". YOURDOMAIN."/register.php?c=". $member_activationcode.">". YOURDOMAIN."/register.php?c=". $member_activationcode."</a>", REGMAILDETAIL);	
    				$headers = "Content-Type: text/html; charset=iso-8859-1\n";
    				@mail($to, $subject, $body, $headers);
    
    				//Gui mail to admin
    				$body = str_replace("{SIGNUP_TIME}", date("m/d/Y", time()), REG_ADMIN_INFORM_DETAIL);
    				$body = str_replace("{USERNAME}", $_POST['username'], $body);
    				$body = str_replace("{EMAIL}", $_POST['email'], $body);
    				@mail($admin_email, REG_ADMIN_INFORM_SUBJECT, $body, $headers);
    
    				//    redirect("login.php");
    				$template->set_filenames(array("body" => "comfirm.html"));	 
    				  
    				$template->assign_vars(array(
    						'COMFIRMMESS'=> "<div style='font-size: 13px; font-family: arial, helvetica;'>
    							<b>Thank you for registering </b><br><br>
    							Please check mail to active your account</div>"
    				));  
    
    				$template->pparse("body");
    				$ok = 1;
    			}
    		}
    
    		if ($ok == 0)
    		{
    			$template->set_filenames(array("body" => "register.html"));
    		
    			$country = ($_POST["country"] == "")?"<option value='' selected>Please Select One</option>":
    			  "<option value='".$_POST["country"]."' selected>".$_POST["country"]."</option>";
    
    
            			$template->assign_vars(array(
    					'ERROR' => $error,
    					'USERNAMEALERT' => $username_alert,
    					'PASSWORDALERT' => $password_alert,
    					'REPASSWORDALERT' => $repassword_alert,
    
    					'EMAILALERT' => $email_alert,
    					'PEMAILALERT' => $pemail_alert,
    					'SEMAILALERT' => $semail_alert,
    					'COUNTRYALERT' => $country_alert,
    					
    					'USERNAME' => $_POST["username"],
    					'PASSWORD' => $_POST["password"],
    					'REPASSWORD' => $_POST["repassword"],
    					'EMAIL' => $_POST["email"],
    					'PEMAIL' => $_POST["pemail"],
    					'SEMAIL' => $_POST["semail"],
    
    					'REALNAME' => $_POST["realname"],
    					'ADDRESS' => $_POST["address"],
    					'COUNTRY' => $country,
    					'REF' => $suid,
    					'NOTE' => $note
    			));        	
    			
    
    			$template->pparse("body");
    		}
    	}
    	
    	include_once ("footer.php");
    ?>
    böyle bi register sayfam var www.sitem.com/register.php sayfasına giriyorum herşey normal fakat bilgileri girip register butonuna bastığımda şöyle bir hata veriyo
    500 Error - Internal Server Error
    This error was caused due to an unexpected difficulty in fulfilling the user request. The most likely cause of this error is a crashed or error'd CGI script or program. Please verify that the program is properly compiled and/or operational and carry out any necessary debugging.
    If you are not responsible for this resource, please send a bug-report to the address listed below describing your problem. Please include in the report the date, time, your e-mail address, the website on which this error occured and what you were attempting to do when this error occured. Your compliance is appreciated.
    önceden böyle bir hata yoktu şuan böyle bir hata veriyor başka hiçbir sayfamda böyle bir sorun yok hostla ilgili bir sorunmu? veya kodlama ile ilgilimi gerçi öyle olsa hiç çalışmazdı önceden çalışıyordu çünkü. yardımlarınızı bekliyorum
  • 09-02-2009, 19:19:47
    #2
    Üyeliği durduruldu
    bir scriptin tamamen obje içerikli olan ve tamplate kullanan kodlarını vermişsiniz tek tek debug yapmaniz lazim
  • 09-02-2009, 19:24:38
    #3
    bunu nasıl yapabilirim?
  • 09-02-2009, 19:58:21
    #4
    Üyeliği durduruldu
    sum41 adlı üyeden alıntı: mesajı görüntüle
    bunu nasıl yapabilirim?
    kodları /**/ açıklama kodlarını kullanarak parça parça iptal edebilirsiniz.

    inceleyrek hatalı kısmı bulmalısınız

    kod içindeki bir kısımda sorun oluşuyordur. ikinci bir seçenekte .htacess dosaysından kaynaklanabilir. dosyanın içeriğini tümden silmenize ragmen hata mesajı devam ediyorsa htaccess dosaysındandır
  • 09-02-2009, 20:33:31
    #5
    denicem yardımlarınız için teşekkürler.