Jump to content

mkdir help please!!!


discojacob

Recommended Posts

Hi. i have a login code implemented and am wanting each user to have their own folder. My register script is below, what and where do i implement into my register file (so that when a user successfully registers a folder will be created at the root of the site with the same name as the name specified at registration.)

Here is my code:

<?

/**

* Register.php

*

* Displays the registration form if the user needs to sign-up,

* or lets the user know, if he's already logged in, that he

* can't register another name.

*

* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)

* Last Updated: August 19, 2004

*/

include("include/session.php");

?>

 

<!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>Untitled Document</title>

<style type="text/css">

<!--

body {

font: 100% Verdana, Arial, Helvetica, sans-serif;

background: #666666;

margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */

padding: 0;

text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */

color: #000000;

background-color: #666666;

}

 

/* Tips for Elastic layouts

1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.

2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.

3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.

*/

.oneColElsCtrHdr #container {

width: 46em;  /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */

background: #FFFFFF;

margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */

border: 0px solid #FFFFFF;

text-align: middle; /* this overrides the text-align: center on the body element. */

}

.oneColElsCtrHdr #header {

background: #DDDDDD;

padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */

}

.oneColElsCtrHdr #header h1 {

margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */

padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

}

.oneColElsCtrHdr #mainContent {

padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */

background: #FFFFFF;

}

.oneColElsCtrHdr #footer {

padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */

background:#666666;

}

.oneColElsCtrHdr #footer p {

margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */

padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */

}

.style6 {color: #FFFFFF}

.style10 { font-size: 36%;

color: #999999;

}

.style11 {

font-size: small

}

.style12 {color: #666666}

a:link {

text-decoration: none;

}

a:visited {

text-decoration: none;

}

a:hover {

text-decoration: none;

}

a:active {

text-decoration: none;

}

.style13 {color: #009933; }

-->

</style></head>

 

<body class="oneColElsCtrHdr">

 

<div id="container">

  <div id="header">

    <h1 align="left"><img src="Pictures/red.png" alt="Schematic Logo" width="110" height="97" /><span class="style10"><a href="main.php">Login</a>     <a href="userinfo.php">My Account</a></span></h1>

  <!-- end #header --></div>

  <div id="mainContent">

    <table width="716" height="385" border="0" align="center">

      <tr>

        <th width="444" scope="row"><div align="left">

          <?

/**

* The user is already logged in, not allowed to register.

*/

if($session->logged_in){

  echo "<h1>Registered</h1>";

  echo "<p>We're sorry <b>$session->username</b>, but you've already registered. "

      ."<a href=\"main.php\">Main</a>.</p>";

}

/**

* The user has submitted the registration form and the

* results have been processed.

*/

else if(isset($_SESSION['regsuccess'])){

  /* Registration was successful */

  if($_SESSION['regsuccess']){

   

  echo "<h1>Registered!</h1>";

      echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "

          ."you may now <a href=\"main.php\">log in</a>.</p>";

  }

  /* Registration failed */

  else{

      echo "<h1>Registration Failed</h1>";

      echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "

          ."could not be completed.<br>Please try again at a later time.</p>";

  }

  unset($_SESSION['regsuccess']);

  unset($_SESSION['reguname']);

}

/**

* The user has not filled out the registration form yet.

* Below is the page with the sign-up form, the names

* of the input fields are important and should not

* be changed.

*/

else{

?>

 

<h1 class="style12">Register</h1>

<?

if($form->num_errors > 0){

  echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";

}

?>

<form action="process.php" method="POST">

<table align="left" border="0" cellspacing="0" cellpadding="3">

<tr><td width="97"><p class="style13">Step 1.</p>

    <p class="style12">Username:</p></td>

<td width="194"><input name="user" type="text" value="<? echo $form->value("user"); ?>" maxlength="30"></td>

<td width="114"><? echo $form->error("user"); ?></td>

</tr>

<tr><td><p class="style13">Step 2.</p>

    <p class="style12">Password:</p></td>

<td><input name="pass" type="password" value="<? echo $form->value("pass"); ?>" maxlength="30"></td>

<td><? echo $form->error("pass"); ?></td></tr>

<tr><td><p class="style13">Step 3.</p>

    <p class="style12">Email:</p></td>

<td><input name="email" type="text" value="<? echo $form->value("email"); ?>" maxlength="50"></td>

<td><? echo $form->error("email"); ?></td></tr>

<tr><td colspan="2" align="right">

  <span class="style12">

<input type="hidden" name="subjoin" value="1">

<input type="submit" value="Join!" <?php /* wherever this particular script will be installed, I want to create a subfolder */

 

 

}

?> >

  </span></td>

</tr>

<tr>

  <td colspan="2" align="left"><a href="main.php" class="style12">Back to Login</a></td>

</tr>

</table>

 

</form>

 

          <p> </p>

          <p> </p>

          <p> </p>

        </div></th>

        <td width="343" bgcolor="#999999"><p align="right">

          <label></label>

        </p>

          <p align="left">              <strong>Why do we only need your email?</strong></p>          <p align="left" class="style11">Schematics is a safe and protected community, and in order to protect you and your designs we only ask for your email so that if we need to contact you about possible deals or password arrangements we can do so.</p></td>

      </tr>

<tr></tr>

  </table>

    <p class="style6"> </p>

  </div>

  <div id="footer">

    <p align="right" class="style6">Copyright Schematics Limited</p>

  <!-- end #footer --></div>

<!-- end #container --></div>

 

</td>

<td width="1" bgcolor="white" valign="bottom" align="right"></td>

<form enctype="multipart/form-data" action="mkdir.php" method="POST">

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/178585-mkdir-help-please/
Share on other sites

I still don't see the point in each user having there own directory.

 

Besides that however, it would simply be a matter of calling....

 

mkdir($_SESSION['reguname']);

 

Within the....

 

if($_SESSION['regsuccess']){

 

There isn't actually any code within the posted script however that does any registering of users.

Link to comment
https://forums.phpfreaks.com/topic/178585-mkdir-help-please/#findComment-941825
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.