www.webdeveloper.com
Results 1 to 5 of 5

Thread: [RESOLVED] Create username directories upon email activation

  1. #1
    Join Date
    Jun 2009
    Posts
    11

    resolved [RESOLVED] Create username directories upon email activation

    I am looking to create directories inside of an "uploads" folder on my server based on the username of the person upon activation of their account..this will be where their uploads will reside. I am not a programmer and know very little php...here is where I believe I would need to integrate the mkdir() but please tell me if Im wrong and if anyone could make this happen for me by posting an example I would love you until my wife told me to stop..lmao Thanks

    Code:
    <?
    	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["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=".$webroot."register.php?c=". $member_activationcode."'>".$webroot."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" => "confirm.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");
    ?>

  2. #2
    Join Date
    Jun 2009
    Posts
    11
    hmmm no takers..understandable..I wouldnt either lmao thanks anyway tc

  3. #3
    Join Date
    Jun 2009
    Posts
    131
    I don't think people are ignoring you, you are just being a little vague. I am not sure what you are asking here. That script looks pretty intense, and probably works for whatever purpose it was going to serve.

    Are you having problems with the script?
    Refreshed | Web Design
    Your Dreams. Our Reality. Refreshing, isn't it?
    Pierce@RefreshedWeb.com
    https://www.RefreshedWeb.com

  4. #4
    Join Date
    Jun 2009
    Posts
    11
    thank you for the reply...no the script runs great. I am trying to add this feature to the script and I know its extensive thats why im here, hopefully a point in the right direction..not vague

    if(!user_exists($this->elementDir()) && !mkdir($this->elementDir(),0711)) {
    $this->setError( 1, 'Failed to create directory "' . $this->elementDir() . '"' );
    return false;
    }


    <?php
    mkdir('(USERNAME)',0711);
    ?>

    just some examples of where im trying to go with this...sorry im a noob lol cheers!

  5. #5
    Join Date
    Jun 2009
    Posts
    11
    what about?

    if($user->Active($this->mkdir("uploads/".$user->username, 0711)) {
    $this->setError( 1, 'Failed to create directory "' . $this->elementDir() . '"' );
    return false;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles