Jump to content

Recommended Posts

Hi there

im currently making a site http://www.mydoodle.byethost13.com/ now what i am tryinging to do is create a php script which when you register (registration\login script already made) it will create a folder where it gets the name from the username field and password the folder with the password from the password field it will then create a page in the folder called index.php (i can make the page i just need help with the script to make the folder and page)

 

if you need a look at my login/registration codes i will post them just request them

 

cheers matt

hi

well i tried doing this

 

<?
session_start(); 
include("database.php");
include("login.php");
/**
* Returns true if the username has been taken
* by another user, false otherwise.
*/
function usernameTaken($username){
   global $conn;
   if(!get_magic_quotes_gpc()){
      $username = addslashes($username);
   }
   $q = "select username from users where username = '$username'";
   $result = mysql_query($q,$conn);
   return (mysql_numrows($result) > 0);
}

/**
* Inserts the given (username, password) pair
* into the database. Returns true on success,
* false otherwise.
*/
function addNewUser($username, $password){
   global $conn;
   $q = "INSERT INTO users VALUES ('$username', '$password')";
   return mysql_query($q,$conn);
}

/**
* Displays the appropriate message to the user
* after the registration attempt. It displays a 
* success or failure status depending on a
* session variable set during registration.
*/
function displayStatus(){
   $uname = $_SESSION['reguname'];
   if($_SESSION['regresult']){

/**make the user folder*/
$user = $_POST['username'];
mkdir("$user",0777);

/** make the user page*/
fopen("$userindex.php",0777);
?>

<h1>Registered!</h1>
<p>Thank you <b><? echo $uname; ?></b>, your information has been added to the database, you may now <a href="index.php" title="Login">log in</a>.</p>
<?
//put the folder and file creation script here!!

   }
   else{
?>
<h1>Registration Failed</h1>
<p>We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br>
Please try again at a later time.</p>

<?
   }
   unset($_SESSION['reguname']);
   unset($_SESSION['registered']);
   unset($_SESSION['regresult']);
}

if(isset($_SESSION['registered'])){
/**
* This is the page that will be displayed after the
* registration has been attempted.
*/
?>
<HTML>
<HEAD>
<TITLE>My Doodle- <?php
if($logged_in){
echo "Welcome $_SESSION[username]";}
else{
echo "Welcome Guest";}
?>
</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--

.inputarea {
BORDER-RIGHT: #000000 1px solid;
BORDER-TOP: #000000 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #000000 1px solid;
COLOR: #000000;
BORDER-BOTTOM: #000000 1px solid;
FONT-FAMILY: verdana;
BACKGROUND-COLOR: #A2B3F1;
}
.style12 {
color: #222E58;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
body {
background-image: url(images/main_bg.jpg);
background-color: #93A7F0;
}
.titles {
{font-size: 10px; font-family: Verdana, Arial; color: #000000; font-weight: bold;
}
.style15 {
color: #FFFFFF;
font-weight: bold;
}
.style18 {
color: #333333;
font-size: 18px;
}
-->
</style>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (business_011.psd) -->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td align="center" valign="top"><table width="770" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="251"><IMG SRC="images/index_01.jpg" WIDTH=251 HEIGHT=156 ALT=""></td>
        <td width="267" align="center" valign="top"><table width="267" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="43" align="center" valign="top" background="images/index_02.jpg"><table width="260" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="6" colspan="3"></td>
                </tr>
              <tr>
                <td width="30"> </td>
                <td align="center"><input name="textfield" type="text" size="20" class="inputarea"></td>
                <td><img src="images/go_img_05.jpg" width="26" height="22"></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center"><img src="images/index_09.jpg" width=236 height=88 alt=""></td>
          </tr>
        </table></td>
        <td align="center" valign="top"><table width="252" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="3"><IMG SRC="images/index_03.jpg" WIDTH=252 HEIGHT=25 ALT=""></td>
          </tr>
          <tr>
            <td width="11"> </td>
            <td width="216" valign="top">
<?php displayLogin(); ?>
		</td>
              </tr>
            </table></td>
            <td><IMG SRC="images/index_06.jpg" WIDTH=25 HEIGHT=131 ALT=""></td>
        </tr>
        </table></td>
  </tr>
</table>
      <?php $filename = 'menu.php';
  if (file_exists($filename)) { 
  include("menu.php"); }
  else {
  echo "Error the menu file $filename cannot be found please contact the administrator";}
  ?>
  <!-- PUT ALL CONTENT HERE-->
  <table width="100%" border="2" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#93a7f0">
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Top Uploaders</strong></font></span></td>
    <td rowspan="18" align="center" valign="top" background="images/main_bg_a.jpg">
<!-- Put main content in here -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="center"><img src="images/welcome.png" width="500" height="100"></td>
    </tr>
  <tr>
    <td>
<? displayStatus(); ?>
</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>

<!-- Main end -->	</td>
  </tr>
  <tr>
    <td width="4%"><strong>1)</strong></td>
    <td width="12%" align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>2)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>3)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>4)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>5)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Newest Uploads</strong></font></span></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
</table>

  <!-- CPNTENT END -->
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="top" background="images/index_72.jpg"><table width="724" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="2"></td>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF"></td>
            </tr>
            <tr>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF">
		  <!--CONTENT BETWEEN HERE -->
		  <table width="100%" height="100%" border="1" bordercolor="#666666">

      </table>
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33"><IMG SRC="images/index_73.jpg" WIDTH=33 HEIGHT=30 ALT=""></td>
          <td width="305" background="images/index_74.jpg"><span class="style12">© My Doodle, <? print (date("Y")); ?></span></td>
          <td width="53"><IMG SRC="images/index_75.jpg" ALT="" WIDTH=53 HEIGHT=30 border="0"></a></td>
          <td width="67"><IMG SRC="images/index_76.jpg" ALT="" WIDTH=67 HEIGHT=30 border="0"></a></td>
          <td width="72"><IMG SRC="images/index_77.jpg" ALT="" WIDTH=72 HEIGHT=30 border="0"></a></td>
          <td width="80"><IMG SRC="images/index_78.jpg" ALT="" WIDTH=80 HEIGHT=30 border="0"></a></td>
          <td width="70"><IMG SRC="images/index_79.jpg" ALT="" WIDTH=70 HEIGHT=30 border="0"></a></td>
          <td width="56"><IMG SRC="images/index_80.jpg" WIDTH=56 HEIGHT=30 ALT=""></td>
          <td><IMG SRC="images/index_81.jpg" WIDTH=34 HEIGHT=30 ALT=""></td>
        </tr>
      </table>
      <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_83.jpg">
        <tr>
          <td width="36"><IMG SRC="images/index_82.jpg" WIDTH=36 HEIGHT=8 ALT=""></td>
          <td><IMG SRC="images/index_83.jpg" WIDTH=5 HEIGHT=8 ALT=""></td>
          <td width="34"><IMG SRC="images/index_85.jpg" WIDTH=34 HEIGHT=8 ALT=""></td>
        </tr>
      </table>


<!-- End ImageReady Slices -->
</BODY>
</HTML>
<?
   return;
}

/**
* Determines whether or not to show to sign-up form
* based on whether the form has been submitted, if it
* has, check the database for consistency and create
* the new account.
*/
if(isset($_POST['subjoin'])){
   /* Make sure all fields were entered */
   if(!$_POST['user'] || !$_POST['pass']){
      die('You didn\'t fill in a required field.');
   }

   /* Spruce up username, check length */
   $_POST['user'] = trim($_POST['user']);
   if(strlen($_POST['user']) > 30){
      die("Sorry, the username is longer than 30 characters, please shorten it.");
   }

   /* Check if username is already in use */
   if(usernameTaken($_POST['user'])){
      $use = $_POST['user'];
      die("Sorry, the username: <strong>$use</strong> is already taken, please pick another one.");
   }

   /* Add the new account to the database */
   $md5pass = md5($_POST['pass']);
   $_SESSION['reguname'] = $_POST['user'];
   $_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass);
   $_SESSION['registered'] = true;
   echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[php_SELF]\">";
   return;
}
else{
/**
* This is the page with the sign-up form, the names
* of the input fields are important and should not
* be changed.
*/
?>
<HTML>
<HEAD>
<TITLE>My Doodle- <?php
if($logged_in){
echo "Welcome $_SESSION[username]";}
else{
echo "Welcome Guest";}
?>
</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--

.inputarea {
BORDER-RIGHT: #000000 1px solid;
BORDER-TOP: #000000 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #000000 1px solid;
COLOR: #000000;
BORDER-BOTTOM: #000000 1px solid;
FONT-FAMILY: verdana;
BACKGROUND-COLOR: #A2B3F1;
}
.style12 {
color: #222E58;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
body {
background-image: url(images/main_bg.jpg);
background-color: #93A7F0;
}
.titles {
{font-size: 10px; font-family: Verdana, Arial; color: #000000; font-weight: bold;
}
.style15 {
color: #FFFFFF;
font-weight: bold;
}
.style18 {
color: #333333;
font-size: 18px;
}
-->
</style>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (business_011.psd) -->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td align="center" valign="top"><table width="770" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="251"><IMG SRC="images/index_01.jpg" WIDTH=251 HEIGHT=156 ALT=""></td>
        <td width="267" align="center" valign="top"><table width="267" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="43" align="center" valign="top" background="images/index_02.jpg"><table width="260" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="6" colspan="3"></td>
                </tr>
              <tr>
                <td width="30"> </td>
                <td align="center"><input name="textfield" type="text" size="20" class="inputarea"></td>
                <td><img src="images/go_img_05.jpg" width="26" height="22"></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center"><img src="images/index_09.jpg" width=236 height=88 alt=""></td>
          </tr>
        </table></td>
        <td align="center" valign="top"><table width="252" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="3"><IMG SRC="images/index_03.jpg" WIDTH=252 HEIGHT=25 ALT=""></td>
          </tr>
          <tr>
            <td width="11"> </td>
            <td width="216" valign="top">
<?php displayLogin(); ?>
		</td>
              </tr>
            </table></td>
            <td><IMG SRC="images/index_06.jpg" WIDTH=25 HEIGHT=131 ALT=""></td>
        </tr>
        </table></td>
  </tr>
</table>
      <?php $filename = 'menu.php';
  if (file_exists($filename)) { 
  include("menu.php"); }
  else {
  echo "Error the menu file $filename cannot be found please contact the administrator";}
  ?>
  <!-- PUT ALL CONTENT HERE-->
  <table width="100%" border="2" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#93a7f0">
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Top Uploaders</strong></font></span></td>
    <td rowspan="18" align="center" valign="top" background="images/main_bg_a.jpg">
<!-- Put main content in here -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="center"><img src="images/welcome.png" width="500" height="100"></td>
    </tr>
  <tr>
    <td>
<h1>Welcome and thank you for registering at My Doodle</h1>
<h3>Register</h3>
<form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Join!"></td></tr>
</table>
</form></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>

<!-- Main end -->	</td>
  </tr>
  <tr>
    <td width="4%"><strong>1)</strong></td>
    <td width="12%" align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>2)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>3)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>4)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>5)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Newest Uploads</strong></font></span></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
</table>

  <!-- CPNTENT END -->
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="top" background="images/index_72.jpg"><table width="724" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="2"></td>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF"></td>
            </tr>
            <tr>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF">
		  <!--CONTENT BETWEEN HERE -->
		  <table width="100%" height="100%" border="1" bordercolor="#666666">

      </table>
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33"><IMG SRC="images/index_73.jpg" WIDTH=33 HEIGHT=30 ALT=""></td>
          <td width="305" background="images/index_74.jpg"><span class="style12">© My Doodle, <? print (date("Y")); ?></span></td>
          <td width="53"><IMG SRC="images/index_75.jpg" ALT="" WIDTH=53 HEIGHT=30 border="0"></a></td>
          <td width="67"><IMG SRC="images/index_76.jpg" ALT="" WIDTH=67 HEIGHT=30 border="0"></a></td>
          <td width="72"><IMG SRC="images/index_77.jpg" ALT="" WIDTH=72 HEIGHT=30 border="0"></a></td>
          <td width="80"><IMG SRC="images/index_78.jpg" ALT="" WIDTH=80 HEIGHT=30 border="0"></a></td>
          <td width="70"><IMG SRC="images/index_79.jpg" ALT="" WIDTH=70 HEIGHT=30 border="0"></a></td>
          <td width="56"><IMG SRC="images/index_80.jpg" WIDTH=56 HEIGHT=30 ALT=""></td>
          <td><IMG SRC="images/index_81.jpg" WIDTH=34 HEIGHT=30 ALT=""></td>
        </tr>
      </table>
      <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_83.jpg">
        <tr>
          <td width="36"><IMG SRC="images/index_82.jpg" WIDTH=36 HEIGHT=8 ALT=""></td>
          <td><IMG SRC="images/index_83.jpg" WIDTH=5 HEIGHT=8 ALT=""></td>
          <td width="34"><IMG SRC="images/index_85.jpg" WIDTH=34 HEIGHT=8 ALT=""></td>
        </tr>
      </table>


<!-- End ImageReady Slices -->
</BODY>
</HTML>


<?
}
?>

 

and i get these errors

 

Warning: mkdir() [function.mkdir]: File exists in C:\Documents and Settings\User\My Documents\PHP\HTDOCS\register.php on line 42

Warning: fopen(.php) [function.fopen]: failed to open stream: File exists in C:\Documents and Settings\User\My Documents\PHP\HTDOCS\register.php on line 45
Registered!

Thank you testuser3, your information has been added to the database, you may now log in.

 

any help would be appreciated thanks

mkdir() = your not passing the directory to make example if i wanted to make a dir called test it would look something like mkdir("/home/public_html/test");

 

same with your fopen... its fopen(.php)... you need to put the absolute path... $handle = fopen("/home/public_html/test/whatever.php","0755");

 

you will also need to CHMOD the new directory you made

 

chmod("home/public_html/test", "0777");

 

to figure out absolute paths you can look at your phpinfo file.

ok im getting close i think  :P

 

now the part i am getting errors with is this

 

fopen("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$user"\\index.php","0777");
echo "file created";
?>

thats lines 46/47

 

the error is

faultCode0faultStringParse error:syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/register.php on line 46

 

thanks for any help

yeah it did,

it stopped that error

i will post all relative information

 

DOC ROOT:

/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs

 

register.php

<?
session_start(); 
include("database.php");
include("login.php");
/**
* Returns true if the username has been taken
* by another user, false otherwise.
*/
function usernameTaken($username){
   global $conn;
   if(!get_magic_quotes_gpc()){
      $username = addslashes($username);
   }
   $q = "select username from users where username = '$username'";
   $result = mysql_query($q,$conn);
   return (mysql_numrows($result) > 0);
}

/**
* Inserts the given (username, password) pair
* into the database. Returns true on success,
* false otherwise.
*/
function addNewUser($username, $password){
   global $conn;
   $q = "INSERT INTO users VALUES ('$username', '$password')";
   return mysql_query($q,$conn);
}

/**
* Displays the appropriate message to the user
* after the registration attempt. It displays a 
* success or failure status depending on a
* session variable set during registration.
*/
function displayStatus(){
   $uname = $_SESSION['reguname'];
   if($_SESSION['regresult']){

/**make the user folder*/
mkdir ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname,"0777");
echo "Folder $uname created";
/** make the user page*/

fopen ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname."index.php","0777");
echo "file created";
?>

<h1>Registered!</h1>
<p>Thank you <b><? echo $uname; ?></b>, your information has been added to the database, you may now <a href="index.php" title="Login">log in</a>.</p>
<?

   }
   else{
?>
<h1>Registration Failed</h1>
<p>We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br>
Please try again at a later time.</p>

<?
   }
   unset($_SESSION['reguname']);
   unset($_SESSION['registered']);
   unset($_SESSION['regresult']);
}

if(isset($_SESSION['registered'])){
/**
* This is the page that will be displayed after the
* registration has been attempted.
*/
?>
<HTML>
<HEAD>
<TITLE>My Doodle- <?php
if($logged_in){
echo "Welcome $_SESSION[username]";}
else{
echo "Welcome Guest";}
?>
</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--

.inputarea {
BORDER-RIGHT: #000000 1px solid;
BORDER-TOP: #000000 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #000000 1px solid;
COLOR: #000000;
BORDER-BOTTOM: #000000 1px solid;
FONT-FAMILY: verdana;
BACKGROUND-COLOR: #A2B3F1;
}
.style12 {
color: #222E58;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
body {
background-image: url(images/main_bg.jpg);
background-color: #93A7F0;
}
.titles {
{font-size: 10px; font-family: Verdana, Arial; color: #000000; font-weight: bold;
}
.style15 {
color: #FFFFFF;
font-weight: bold;
}
.style18 {
color: #333333;
font-size: 18px;
}
-->
</style>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (business_011.psd) -->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td align="center" valign="top"><table width="770" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="251"><IMG SRC="images/index_01.jpg" WIDTH=251 HEIGHT=156 ALT=""></td>
        <td width="267" align="center" valign="top"><table width="267" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="43" align="center" valign="top" background="images/index_02.jpg"><table width="260" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="6" colspan="3"></td>
                </tr>
              <tr>
                <td width="30"> </td>
                <td align="center"><input name="textfield" type="text" size="20" class="inputarea"></td>
                <td><img src="images/go_img_05.jpg" width="26" height="22"></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center"><img src="images/index_09.jpg" width=236 height=88 alt=""></td>
          </tr>
        </table></td>
        <td align="center" valign="top"><table width="252" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="3"><IMG SRC="images/index_03.jpg" WIDTH=252 HEIGHT=25 ALT=""></td>
          </tr>
          <tr>
            <td width="11"> </td>
            <td width="216" valign="top">
<?php displayLogin(); ?>
		</td>
              </tr>
            </table></td>
            <td><IMG SRC="images/index_06.jpg" WIDTH=25 HEIGHT=131 ALT=""></td>
        </tr>
        </table></td>
  </tr>
</table>
      <?php $filename = 'menu.php';
  if (file_exists($filename)) { 
  include("menu.php"); }
  else {
  echo "Error the menu file $filename cannot be found please contact the administrator";}
  ?>
  <!-- PUT ALL CONTENT HERE-->
  <table width="100%" border="2" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#93a7f0">
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Top Uploaders</strong></font></span></td>
    <td rowspan="18" align="center" valign="top" background="images/main_bg_a.jpg">
<!-- Put main content in here -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="center"><img src="images/welcome.png" width="500" height="100"></td>
    </tr>
  <tr>
    <td>
<? displayStatus(); ?>
</td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>

<!-- Main end -->	</td>
  </tr>
  <tr>
    <td width="4%"><strong>1)</strong></td>
    <td width="12%" align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>2)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>3)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>4)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>5)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Newest Uploads</strong></font></span></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
</table>

  <!-- CPNTENT END -->
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="top" background="images/index_72.jpg"><table width="724" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="2"></td>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF"></td>
            </tr>
            <tr>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF">
		  <!--CONTENT BETWEEN HERE -->
		  <table width="100%" height="100%" border="1" bordercolor="#666666">

      </table>
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33"><IMG SRC="images/index_73.jpg" WIDTH=33 HEIGHT=30 ALT=""></td>
          <td width="305" background="images/index_74.jpg"><span class="style12">© My Doodle, <? print (date("Y")); ?></span></td>
          <td width="53"><IMG SRC="images/index_75.jpg" ALT="" WIDTH=53 HEIGHT=30 border="0"></a></td>
          <td width="67"><IMG SRC="images/index_76.jpg" ALT="" WIDTH=67 HEIGHT=30 border="0"></a></td>
          <td width="72"><IMG SRC="images/index_77.jpg" ALT="" WIDTH=72 HEIGHT=30 border="0"></a></td>
          <td width="80"><IMG SRC="images/index_78.jpg" ALT="" WIDTH=80 HEIGHT=30 border="0"></a></td>
          <td width="70"><IMG SRC="images/index_79.jpg" ALT="" WIDTH=70 HEIGHT=30 border="0"></a></td>
          <td width="56"><IMG SRC="images/index_80.jpg" WIDTH=56 HEIGHT=30 ALT=""></td>
          <td><IMG SRC="images/index_81.jpg" WIDTH=34 HEIGHT=30 ALT=""></td>
        </tr>
      </table>
      <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_83.jpg">
        <tr>
          <td width="36"><IMG SRC="images/index_82.jpg" WIDTH=36 HEIGHT=8 ALT=""></td>
          <td><IMG SRC="images/index_83.jpg" WIDTH=5 HEIGHT=8 ALT=""></td>
          <td width="34"><IMG SRC="images/index_85.jpg" WIDTH=34 HEIGHT=8 ALT=""></td>
        </tr>
      </table>


<!-- End ImageReady Slices -->
</BODY>
</HTML>
<?
   return;
}

/**
* Determines whether or not to show to sign-up form
* based on whether the form has been submitted, if it
* has, check the database for consistency and create
* the new account.
*/
if(isset($_POST['subjoin'])){
   /* Make sure all fields were entered */
   if(!$_POST['user'] || !$_POST['pass']){
      die('You didn\'t fill in a required field.');
   }

   /* Spruce up username, check length */
   $_POST['user'] = trim($_POST['user']);
   if(strlen($_POST['user']) > 30){
      die("Sorry, the username is longer than 30 characters, please shorten it.");
   }

   /* Check if username is already in use */
   if(usernameTaken($_POST['user'])){
      $use = $_POST['user'];
      die("Sorry, the username: <strong>$use</strong> is already taken, please pick another one.");
   }

   /* Add the new account to the database */
   $md5pass = md5($_POST['pass']);
   $_SESSION['reguname'] = $_POST['user'];
   $_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass);
   $_SESSION['registered'] = true;
   echo "<meta http-equiv=\"Refresh\" content=\"0;url=$HTTP_SERVER_VARS[php_SELF]\">";
   return;
}
else{
/**
* This is the page with the sign-up form, the names
* of the input fields are important and should not
* be changed.
*/
?>
<HTML>
<HEAD>
<TITLE>My Doodle- <?php
if($logged_in){
echo "Welcome $_SESSION[username]";}
else{
echo "Welcome Guest";}
?>
</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
<!--

.inputarea {
BORDER-RIGHT: #000000 1px solid;
BORDER-TOP: #000000 1px solid;
FONT-SIZE: 12px;
BORDER-LEFT: #000000 1px solid;
COLOR: #000000;
BORDER-BOTTOM: #000000 1px solid;
FONT-FAMILY: verdana;
BACKGROUND-COLOR: #A2B3F1;
}
.style12 {
color: #222E58;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
body {
background-image: url(images/main_bg.jpg);
background-color: #93A7F0;
}
.titles {
{font-size: 10px; font-family: Verdana, Arial; color: #000000; font-weight: bold;
}
.style15 {
color: #FFFFFF;
font-weight: bold;
}
.style18 {
color: #333333;
font-size: 18px;
}
-->
</style>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<!-- ImageReady Slices (business_011.psd) -->
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td align="center" valign="top"><table width="770" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="251"><IMG SRC="images/index_01.jpg" WIDTH=251 HEIGHT=156 ALT=""></td>
        <td width="267" align="center" valign="top"><table width="267" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="43" align="center" valign="top" background="images/index_02.jpg"><table width="260" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="6" colspan="3"></td>
                </tr>
              <tr>
                <td width="30"> </td>
                <td align="center"><input name="textfield" type="text" size="20" class="inputarea"></td>
                <td><img src="images/go_img_05.jpg" width="26" height="22"></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td align="center"><img src="images/index_09.jpg" width=236 height=88 alt=""></td>
          </tr>
        </table></td>
        <td align="center" valign="top"><table width="252" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td colspan="3"><IMG SRC="images/index_03.jpg" WIDTH=252 HEIGHT=25 ALT=""></td>
          </tr>
          <tr>
            <td width="11"> </td>
            <td width="216" valign="top">
<?php displayLogin(); ?>
		</td>
              </tr>
            </table></td>
            <td><IMG SRC="images/index_06.jpg" WIDTH=25 HEIGHT=131 ALT=""></td>
        </tr>
        </table></td>
  </tr>
</table>
      <?php $filename = 'menu.php';
  if (file_exists($filename)) { 
  include("menu.php"); }
  else {
  echo "Error the menu file $filename cannot be found please contact the administrator";}
  ?>
  <!-- PUT ALL CONTENT HERE-->
  <table width="100%" border="2" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#93a7f0">
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Top Uploaders</strong></font></span></td>
    <td rowspan="18" align="center" valign="top" background="images/main_bg_a.jpg">
<!-- Put main content in here -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="center"><img src="images/welcome.png" width="500" height="100"></td>
    </tr>
  <tr>
    <td>
<h1>Welcome and thank you for registering at My Doodle</h1>
<h3>Register</h3>
<form action="<? echo $HTTP_SERVER_VARS['PHP_SELF']; ?>" method="post">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30"></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="subjoin" value="Join!"></td></tr>
</table>
</form></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>

<!-- Main end -->	</td>
  </tr>
  <tr>
    <td width="4%"><strong>1)</strong></td>
    <td width="12%" align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>2)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>3)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>4)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td><strong>5)</strong></td>
    <td align="right">Username  </td>
  </tr>
  <tr>
    <td colspan="2" align="center" background="images/index_78.jpg"><span class="style15"><font color="white"><strong>Newest Uploads</strong></font></span></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"><strong>Name</strong> by <em>User</em></td>
  </tr>
  <tr>
    <td colspan="2"> </td>
  </tr>
</table>

  <!-- CPNTENT END -->
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="center" valign="top" background="images/index_72.jpg"><table width="724" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="2"></td>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF"></td>
            </tr>
            <tr>
            </tr>
            <tr>
              <td height="1" bgcolor="#92A6EF">
		  <!--CONTENT BETWEEN HERE -->
		  <table width="100%" height="100%" border="1" bordercolor="#666666">

      </table>
      <table width="770" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="33"><IMG SRC="images/index_73.jpg" WIDTH=33 HEIGHT=30 ALT=""></td>
          <td width="305" background="images/index_74.jpg"><span class="style12">© My Doodle, <? print (date("Y")); ?></span></td>
          <td width="53"><IMG SRC="images/index_75.jpg" ALT="" WIDTH=53 HEIGHT=30 border="0"></a></td>
          <td width="67"><IMG SRC="images/index_76.jpg" ALT="" WIDTH=67 HEIGHT=30 border="0"></a></td>
          <td width="72"><IMG SRC="images/index_77.jpg" ALT="" WIDTH=72 HEIGHT=30 border="0"></a></td>
          <td width="80"><IMG SRC="images/index_78.jpg" ALT="" WIDTH=80 HEIGHT=30 border="0"></a></td>
          <td width="70"><IMG SRC="images/index_79.jpg" ALT="" WIDTH=70 HEIGHT=30 border="0"></a></td>
          <td width="56"><IMG SRC="images/index_80.jpg" WIDTH=56 HEIGHT=30 ALT=""></td>
          <td><IMG SRC="images/index_81.jpg" WIDTH=34 HEIGHT=30 ALT=""></td>
        </tr>
      </table>
      <table width="770" border="0" cellpadding="0" cellspacing="0" background="images/index_83.jpg">
        <tr>
          <td width="36"><IMG SRC="images/index_82.jpg" WIDTH=36 HEIGHT=8 ALT=""></td>
          <td><IMG SRC="images/index_83.jpg" WIDTH=5 HEIGHT=8 ALT=""></td>
          <td width="34"><IMG SRC="images/index_85.jpg" WIDTH=34 HEIGHT=8 ALT=""></td>
        </tr>
      </table>


<!-- End ImageReady Slices -->
</BODY>
</HTML>


<?
}
?>

 

ERROR I AM GETTING FROM THIS CODE:

faultCode0faultStringWarning:mkdir() [function.mkdir]: File exists in /home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/register.php on line 42Folder createdfaultCode0faultStringWarning:fopen(/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/index.php) [function.fopen]: failed to open stream: No such file or directory in /home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/register.php on line 46file created

Registered!

 

Thank you TESTER, your information has been added to the database, you may now log in.

 

basically i want this to work lol :P

 

thanks

well im slowly getting there i now have the folder creation working

but when the file create runs i get error:

Folder test3 created/n/nfaultCode0faultStringWarning:fopen(/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/test3/index.php) [function.fopen]: failed to open stream: Permission denied in /home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/register.php on line 45file created

 

the username was test3

 

my new code is:

/**make the user folder*/
mkdir ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname,"0777");
echo "Folder $uname created/n/n";
/** make the user page*/

fopen ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname."/index.php","0777");
echo "file created";

 

any help appreciated

thanks mate that worked well acctually

 

now heres my code

/**make the user folder*/
mkdir ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname, 0777);
echo "Folder $uname created \n";


/** make the user page*/
fopen ("/home/vol2/byethost13.com/b13_1013561/mydoodle.byethost13.com/htdocs/users/".$uname."/index.php", 'w', 0777);
echo "file created \n";

 

which works perfectly

but now using the fopen command how would i write html data into the file create?

 

cheers

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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