Talk Forums
DALE! ¬_¬ - Printable Version

+- Talk Forums (https://talk.tf)
+-- Forum: Lifestyle (https://talk.tf/forum-6.html)
+--- Forum: Techno (https://talk.tf/forum-14.html)
+--- Thread: DALE! ¬_¬ (/thread-163.html)



DALE! ¬_¬ - Mathew - 02-07-2006

Hia dale, sort this out cuz im confused and cba to look good. ;[



Error:

Parse error: syntax error, unexpected ';' in /home/th/public_html/admin/users.php on line 45



PHP Code:
<?php

// ## Fansite Group - Admin CP - User



if($_REQUEST['do'] == "add_user" AND $th->permissions['cp']['add_users'])

{

    
$show_form true;

    if(
$_POST['action'] == "process_user")

    {

        if(!
$_POST['username']) { $errormsg .= "[*]The username field was blank"; }

        if(!
$_POST['password']) { $errormsg .= "[*]The password field was blank"; }

        if(!
$_POST['email']) { $errormsg .= "[*]The email field was blank"; }

    

        if(
$errormsg != '')

        {

            
$show_form true;

            
print_message("<b>The following errors occured:</b>[list]".$errormsg."[/list]");

        }

        else

        {

            
$show_form false;

            

            
$new_user = array(

                
"username" => $_POST['username'],

                
"password" => md5($_POST['password']),

                
"email" => $_POST['email'],

                
"displaygroupid" => $_POST['usergroupid'],

                
"usergroupid" => $_POST['usergroupid'],

                
"membergroupids" => '',

                
"regdate" => time(),

                
"signature" => '',

                
"avatarurl" => $th->data['default_avatar'],

                
"banned" => 0,

                
"active" => 1,

            );

            

            
$db->insert_query($new_user"user");

            

            
print_message("The user ".$_POST['username']." has been successfully added to the database.""index.php?page=users&do=manage_users");

        }

    }

    

    if(
$show_form);

    {

?>

<form action="<? echo ; ?>" method="post">

  <input type="hidden" name="action" value="process_user">

  <input type="hidden" name="field" value="<? echo $fields; ?>">

  <p class="page_title">Add User


  <table width="100%" cellspacing="2" cellpadding="1" border="0">

    <tr>

      <td><b>Username</b></td>

      <td><input type="text" name="username" size="60"<? if($_POST['username']) { echo " value=\"".$_POST['username']."\""; } ?>></td>

    </tr>

    <tr>

      <td><b>Password</b></td>

      <td><input type="password" name="password" size="60"></td>

    </tr>

    <tr>

      <td><b>Email</b></td>

      <td><input type="text" name="email" size="60"<? if($_POST['email']) { echo " value=\"".$_POST['email']."\""; } ?>></td>

    </tr>

    <tr>

      <td><b>Usergroup</b></td>

      <td>

        <select name="usergroupid">

          <option>------</option>

<?php

        $query 
$db->query("SELECT * FROM `usergroups` ORDER BY `title` ASC");

        while(
$usergroups $db->fetch_array($query))

        {

?>

          <option value="<?php echo $usergroups['usergroupid']; ?>"><?php echo $usergroups['title']; ?></option>

<?php        

        
}

?>

        </select>

      </td>

    </tr>    

    <tr>

      <td colspan="2"> </td>

    </tr>

    <tr>

      <td> </td>

      <td><input type="submit" value="Add User"></td>

    </tr>

  </table>

</form>

<?

    }

}



if($_REQUEST['do'] == "edit_user" AND $th->permissions['cp']['edit_users'])

{

    if($_GET['id'])

    {

        $get_euser = mysql_query("SELECT * FROM `user` WHERE `userid` = '".$_GET['id']."' LIMIT 1");

        if(mysql_num_rows($get_euser) == 1)

        {

            $euser = mysql_fetch_array($get_euser);

            $show_form = true;

            if($_POST['action'] == "update_user")

            {

                if(!$_POST['username']) { $errormsg .= "[*]The username field was blank"; }

                if(!$_POST['email']) { $errormsg .= "[*]The email field was blank"; }

    

                if($errormsg != '')

                {

                    $show_form = true;

                    print_message("<b>The following errors occured:</b>[list]".$errormsg."[/list]");

                }

                else

                {

                    $show_form = false;

                    

                    if(is_array($_POST['membergroupids']))

                    {

                        $membergroupids = implode(',', $_POST['membergroupids']);

                    }

                    

                    $new_user = array(

                        "username" => $_POST['username'],

                        "email" => $_POST['email'],

                        "displaygroupid" => $_POST['usergroupid'],

                        "usergroupid" => $_POST['usergroupid'],

                        "membergroupids" => $membergroupids,

                        "signature" => $_POST['signature'],

                        "avatarurl" => $_POST['avatarurl'],

                    );

                    

                    if($_POST['password'])

                    {

                        $new_user['password'] = md5($_POST['password']);

                    }

                    

                    $db->update_query($new_user, "user", "`userid` = '" . $euser['userid'] . "'");

                    

                    print_message("The user ".$_POST['username']." has been successfully updated.", "index.php?page=users&do=manage_users");

                }

            }

    

            if($show_form)

            {

?>

<form action="<? echo ; ?>" method="post">

  <input type="hidden" name="action" value="update_user">

  <input type="hidden" name="field" value="<? echo $fields; ?>">

  <p class="page_title">Edit User - <? echo $euser['username']; ?>


  <table width="100%" cellspacing="2" cellpadding="1" border="0">

    <tr>

      <td><b>Username</b></td>

      <td><input type="text" name="username" size="60"<? if($_POST['username']) { echo " value=\"".$_POST['username']."\""; } else { ?>value="<? echo $euser['username']; ?>"<? } ?>></td>

    </tr>

    <tr>

      <td><b>Password</b></td>

      <td><input type="password" name="password" size="60"></td>

    </tr>

    <tr>

      <td><b>Email</b></td>

      <td><input type="text" name="email" size="60"<? if($_POST['email']) { echo " value=\"".$_POST['email']."\""; } else { ?>value="<? echo $euser['email']; ?>"<? } ?>></td>

    </tr>

    <tr>

      <td><b>Display Group</b></td>

      <td>

        <select name="displaygroup">

          <option>------</option>

<?php

            
if($euser['membergroupids']) { $usergroup_array explode(','$euser['membergroupids']); }

            
$usergroup_array[] = $euser['usergroupid'];

            

            foreach(
$usergroup_array as $usergroup)

            {

                
$usergroup_details $db->fetch_array($db->query("SELECT * FROM `usergroups` WHERE `usergroupid` = '" $usergroup "' LIMIT 1"));

                echo 
"          <option value=\"" $usergroup_details['usergroupid'] . "\"";

                if(
$usergroup_details['usergroupid'] == $euser['displaygroupid']) { echo " selected=\"selected\""; }

                echo 
">" $usergroup_details['title'] . "</option>\n";

            }

?>          

        </select>

      </td>

    </tr>

    <tr>

      <td><b>Usergroup</b></td>

      <td>

        <select name="usergroupid">

          <option>------</option>

<?php

            $query 
$db->query("SELECT * FROM `usergroups` ORDER BY `title`");

            while(
$usergroups $db->fetch_array($query))

            {

?>

          <option value="<?php echo $usergroups['usergroupid']; ?>"<?php if($usergroups['usergroupid'] == $euser['usergroupid']) { echo " selected=\"selected\""; } ?>><?php echo $usergroups['title']; ?></option>

<?php            

            
}

?>

        </select>

      </td>

    </tr>

    <tr>

      <td valign="top"><b>Membergroups</b></td>

      <td>

        <select name="membergroupids[]" multiple="multiple" style="height: 100px;">

<?php

            $query 
$db->query("SELECT * FROM `usergroups` ORDER BY `title`");

            while(
$usergroups $db->fetch_array($query))

            {

?>

          <option value="<?php echo $usergroups['usergroupid']; ?>"><?php echo $usergroups['title']; ?></option>

<?php            

            
}

?>

        </select>

      </td>

    </tr>

    <tr>

      <td><b>Signature</b></td>

      <td><textarea name="signature" cols="60" rows="6"><?php echo $euser['signature']; ?></textarea></td>

    </tr>

    <tr>

      <td colspan="2"> </td>

    </tr>

    <tr>

      <td> </td>

      <td><input type="submit" value="Update User"></td>

    </tr>

  </table>

</form>

<?

            }

        }

        else

        {

            print_message("No user found with this ID", "index.php?page=users&do=manage_users");

        }    

    }

    else

    {

        print_message("No user ID specified","index.php?page=users&do=manage_users");

    }        

}



if($_REQUEST['do'] == "manage_users" AND $th->permissions['cp']['edit_users'] OR $_REQUEST['do'] == "manage_users" AND $th->permissions['cp']['delete_users'])

{

    if($_POST['action'] == "delete")

    {

        foreach($_POST['select'] as $id)

        {

            mysql_query("DELETE FROM `user` WHERE `userid` = '".$id."' LIMIT 1");

        }

        print_message("Selected users successfully deleted.","index.php?page=news&do=manage_users");

    }

    else

    {

?>

<table width="100%" cellspacing="2" cellpadding="0" border="0" align="center">

  <tr>

    <td class="page_title">Manage Users</td>

  </tr>

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td>Here is a list of all users currently in the system; to edit a user just click on their name, to delete, send a pm or another option select their name and select an option from the bottom.</td>

  </tr>

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td>

      <form method="get">

        <input type="hidden" name="page" value="users">

        <input type="hidden" name="do" value="manage_users">

        <b>Search for a specific user:</b> 

        <input type="text" name="search"> 

        <input type="submit" value="Search">

      </form>

    </td>

  </tr>

  <tr>

    <td>

      <form action="" method="post" name="memberlist" onsubmit="return confirmRequest('Are you sure you want to delete the selected users? This action can not be un-done!')">

      <table width="100%" cellspacing="2" cellpadding="0" border="0">

        <tr>

          <td width="22%" class="admin_footer"><b>Username</b></td>

          <td width="29%" class="admin_footer"><b>Default Usergroup</b></td>

          <td width="33%" class="admin_footer"><b>Account Creation Date</b></td>

          <td class="admin_footer"><b>Options</b></td>

        </tr>

<?php

if(!isset($_REQUEST['show']))

{

    
$show 1;



else 

{

    
$show $_REQUEST['show'];

}



$max_results 30;

$from = (($show $max_results) - $max_results);

$bgc 1;



if(isset(
$_REQUEST['search']))

{

    
$get_all_users_manage mysql_query("SELECT * FROM `user` WHERE `username` LIKE '%".$_REQUEST['search']."%' ORDER BY `userid` ASC LIMIT $from$max_results");

}

else 

{

    
$get_all_users_manage mysql_query("SELECT * FROM `user` ORDER BY `userid` ASC LIMIT $from$max_results");

}



while(
$all_users_manage mysql_fetch_array($get_all_users_manage))

{

    if(
$bgc == 1) { $color "#F7F6F4"$bgc 0; }

    else if (
$bgc == 0) { $color "#FFFFFF"$bgc 1; }   

?>

        <tr bgcolor="<? echo $color; ?>">

          <td>[url=index.php?page=users&do=edit_user&id=<? echo $all_users_manage['userid']; ?>]<? echo $all_users_manage['username']; ?>[/url]</td>

          <td>

<?

    $default_usergroup = $db->fetch_array($db->query("SELECT `title` FROM `usergroups` WHERE `usergroupid` = '" . $all_users_manage['displaygroupid'] . "' LIMIT 1"));

    echo $default_usergroup['title'];

?>          

          </td>

          <td><? echo date("j M y", $all_users_manage['regdate']); ?></td>

          <td><input type="checkbox" name="select[]" value="<? echo $all_users_manage['userid']; ?>"></td>

        </tr>

<?

}

?>

        <tr>

          <td> </td>

        </tr>

        <tr>

          <td align="right" colspan="4"><input type="submit" value="Delete selected users"></td>

        </tr>

      </table>

      </form>

    </td>

  </tr>      

  <tr>

    <td align="center">        

<?

$get_all_users_query = mysql_query("SELECT `userid` FROM `user`");

$total_results = mysql_num_rows($get_all_users_query);

$total_pages = ceil($total_results / $max_results);



        for($i = 1; $i <= $total_pages; $i++){

        if($show == $i){

        echo "[$i] ";

        } else {

        echo "[<a href=\"index.php?page=user&do=manage_users&show=$i\">$i</a>] ";

        }

}

?>      

    </td>

  </tr> 

</table>

<?

    }

}



$cp_perms = array(



    array("title" => "Edit Site Settings",

          "var" => "site_settings"),

          

    array("title" => "Add Users",

          "var" => "add_users"),

          

    array("title" => "Edit Users",

          "var" => "edit_users"),

          

    array("title" => "Delete Users",

          "var" => "delete_users"),

          

    array("title" => "Add Usergroups",

          "var" => "add_usergroups"),

          

    array("title" => "Edit Usergroups",

          "var" => "edit_usergroups"),

          

    array("title" => "Delete Usergroups",

          "var" => "delete_usergroups"),

          

    array("title" => "Ban Users (Temporarily)",

          "var" => "ban_users_temp"),

        

    array("title" => "Ban Users (Permanently)",

          "var" => "ban_users_perm"),

          

    array("title" => "Unban Users",

          "var" => "unban_users"),

          

    array("title" => "Add News",

          "var" => "add_news"),

          

    array("title" => "Edit Own News",

          "var" => "edit_own_news"),

          

    array("title" => "Edit Others' News",

          "var" => "edit_others_news"),

          

    array("title" => "Delete Own News",

          "var" => "delete_own_news"),

          

    array("title" => "Delete Others' News",

          "var" => "delete_others_news"),

          

    array("title" => "Add News Category",

          "var" => "add_news_category"),

          

    array("title" => "Edit News Categories",

          "var" => "edit_news_categories"),

          

    array("title" => "Delete News Categories",

          "var" => "delete_news_categories"),

          

    array("title" => "Add Newsie",

          "var" => "add_newsie"),

          

    array("title" => "Edit Newsie",

          "var" => "edit_newsie"),

          

    array("title" => "Delete Newsie",

          "var" => "delete_newsie"),

          

    array("title" => "Publish Newsie",

          "var" => "publish_newsie"),

          

    array("title" => "Unpublish Newsie",

          "var" => "unpublish_newsie"),

          

    array("title" => "Add Profile Field",

          "var" => "add_profile_field"),

          

    array("title" => "Edit Profole Field",

          "var" => "edit_profile_field"),

          

    array("title" => "Delete Profile Field",

          "var" => "delete_profile_field")

);





if($_REQUEST['do'] == "add_usergroup" AND $th->permissions['cp']['add_usergroups'])

{

    $show_form = true;

    if($_POST['action'] == "submit")

    {

        foreach($cp_perms as $cp_perm)

        {

            $tmp_cp_permissions[$cp_perm['var']] = $_POST['cp_' . $cp_perm['var']];

        }

        

        $cp_permissions = serialize($tmp_cp_permissions);

        

        $new_usergroup = array(

            "title" => $_POST['usergroup_title'],

            "opentag" => $_POST['usergroup_opentag'],

            "closetag" => $_POST['usergroup_closetag'],

            "smod" => $_POST['smod'],

            "sadmin" => $_POST['sadmin'],

            "usecp" => $_POST['usecp'],

            "cp_permissions" => $cp_permissions,

            "news_permissions" => $news_permissions,

            "avatarsize" => $_POST['avatarsize']

        );

        

        $db->insert_query($new_usergroup, "usergroups");

        

        $show_form = false;

        print_message("The usergroup was successfully added to the database.", "index.php?page=users&do=manage_usergroups");

    }

    if($show_form)

    {

?>

<form action="<?php echo ; ?>" method="post">

  <input type="hidden" name="action" value="submit">

  <p class="page_title">Add Usergroup


  <table width="100%" cellspacing="2" cellpadding="0" border="0">

  

    <!-- begin general usergroup details -->

    <tr>

      <td><b>Title</b></td>

      <td><input type="text" name="usergroup_title" size="40"></td>

    </tr>

    <tr>

      <td><b>Open + Close Tag</b></td>

      <td><input type="text" name="usergroup_opentag" size="15"> <input type="text" name="usergroup_closetag" size="15"></td>

    </tr>

    <tr>

      <td><b>Super Moderator</b></td>

      <td><input type="checkbox" name="smod" value="1"></td>

    </tr>

    <tr>

      <td><b>Super Administrator</b></td>

      <td><input type="checkbox" name="sadmin" value="1"></td>

    </tr>

    <tr>

      <td><b>Use Control Panel</b></td>

      <td><input type="checkbox" name="usecp" value="1"></td>

    </tr>

    <tr>

      <td><b>Avatar Size</b></td>

      <td><input type="text" name="avatarsize" value="10x10" size="40" /></td>

    </tr>

    <!-- end general usergroup details -->

    

    <tr>

      <td colspan="2" style="padding-top: 6px;">Control Panel Permissions</td>

    </tr>

    

    <!-- begin cp permissions -->

<?php

foreach($cp_perms as $cp_perm)

{

?>

    <tr>

      <td><b><?php echo $cp_perm['title']; ?></b></td>

      <td><input type="radio" name="cp_<?php echo $cp_perm['var']; ?>" value="1"> Yes <input type="radio" name="cp_<?php echo $cp_perm['var']; ?>" value="0" checked="checked"> No</td>

    </tr>

<?php

}

?>    

    <!-- end cp permissions -->

    

    <tr>

      <td> </td>

      <td><input type="submit" value="Submit"></td>

    </tr>

    

  </table>

</form>

<?php    

    
}

}



if(
$_REQUEST['do'] == "manage_usergroups" AND $th->permissions['cp']['edit_usergroups'] OR $_REQUEST['do'] == "manage_usergroups" AND $th->permissions['cp']['delete_usergroups'])

{

?>

<p class="page_title">Manage Usergroups


<table width="100%" cellspacing="2" cellpadding="2" border="0">

  <tr>

    <td class="admin_footer">#</td>

    <td class="admin_footer">Title</td>

    <td class="admin_footer">Options</td>

  </tr>

<?php

    $query 
$db->query("SELECT * FROM `usergroups` ORDER BY `title`");

    while(
$usergroup $db->fetch_array($query))

    {

        if(
$bgc == 1) { $color "#F7F6F4"$bgc 0; }

        else if (
$bgc == 0) { $color "#FFFFFF"$bgc 1; }

?>

  <tr bgcolor="<?php echo $color?>">

    <td><?php echo $usergroup['usergroupid']; ?></td>

    <td>[url=index.php?page=users&do=edit_usergroup&id=<?php echo $usergroup['usergroupid']; ?>]<?php echo $usergroup['title']; ?>[/url]</td>

    <td>[[url=index.php?page=users&do=delete_usergroup&id=<?php echo $usergroup['usergroupid']; ?>]delete[/url]] [[url=index.php?page=users&do=edit_usergroup&id=<?php echo $usergroup['usergroupid']; ?>]edit[/url]]</td>

  </tr>

<?php

    
}

?>

</table>

<?php

}



if(
$_REQUEST['do'] == "delete_usergroup" AND $th->permissions['cp']['delete_usergroups'])

{

    if(
$_REQUEST['id'])

    {

        
$query $db->query("SELECT `usergroupid` FROM `usergroups` WHERE `usergroupid` = '" $_REQUEST['id'] . "' LIMIT 1");

        if(
$db->num_rows($query))

        {

            
$query $db->query("SELECT * FROM `users` WHERE `usergroupid` = '" $_REQUEST['id'] . "' OR `membergroupids` = '%" $_REQUEST['id'] . "%'");

            if(!
$db->num_rows($query))

            {

                
$db->query("DELETE FROM `usergroups` WHERE `usergroupid` = '" $_REQUEST['id'] . "' LIMIT 1");

                
print_message("Usergroup deleted successfully.""index.php?page=users&do=manage_usergroups");

            }

            else

            {

                
print_message("You are unable to delete this usergroup.  There are users still in it.""index.php?page=users&do=manage_usergroup");

            }

        }

    }

}



if(
$_REQUEST['do'] == "edit_usergroup" AND $th->permissions['cp']['edit_usergroups'])

{

    if(
$_REQUEST['id'])

    {

        
$query $db->query("SELECT * FROM `usergroups` WHERE `usergroupid` = '" $_REQUEST['id'] . "' LIMIT 1");

        if(
$db->num_rows($query))

        {

            
$usergroup $db->fetch_array($query);

            
$usergroup_perms['cp'] = unserialize($usergroup['cp_permissions']);

            
$usergroup_perms['news'] = unserialize($usergroup['news_permissions']);

        }

        

        if(
$usergroup['usergroupid'])

        {

            
$show_form true;

            if(
$_POST['action'] == "update")

            {

                foreach(
$cp_perms as $cp_perm)

                {

                    
$tmp_cp_permissions[$cp_perm['var']] = $_POST['cp_' $cp_perm['var']];

                }

                

                
$cp_permissions serialize($tmp_cp_permissions);

        

                
$new_usergroup = array(

                    
"title" => $_POST['usergroup_title'],

                    
"opentag" => $_POST['usergroup_opentag'],

                    
"closetag" => $_POST['usergroup_closetag'],

                    
"smod" => $_POST['smod'],

                    
"sadmin" => $_POST['sadmin'],

                    
"usecp" => $_POST['usecp'],

                    
"cp_permissions" => $cp_permissions,

                    
"news_permissions" => $news_permissions,

                    
"avatarsize" => $_POST['avatarsize']

                );

        

                
$db->update_query($new_usergroup"usergroups""`usergroupid` = '" $usergroup['usergroupid'] . "'");

        

                
$show_form false;

                
print_message("The usergroup was updated.""index.php?page=users&do=manage_usergroups");

            }

        }

    

        if(
$show_form)

        {

?>

<form action="<?php echo ; ?>" method="post">

  <input type="hidden" name="action" value="update">

  <p class="page_title">Edit Usergroup - <?php echo $usergroup['title']; ?>


  <table width="100%" cellspacing="2" cellpadding="0" border="0">

  

    <!-- begin general usergroup details -->

    <tr>

      <td><b>Title</b></td>

      <td><input type="text" name="usergroup_title" size="40" value="<?php echo $usergroup['title']; ?>"></td>

    </tr>

    <tr>

      <td><b>Open + Close Tag</b></td>

      <td><input type="text" name="usergroup_opentag" size="15" value="<?php echo $usergroup['opentag']; ?>"> <input type="text" name="usergroup_closetag" size="15" value="<?php echo $usergroup['closetag']; ?>"></td>

    </tr>

    <tr>

      <td><b>Super Moderator</b></td>

      <td><input type="checkbox" name="smod" value="1"<?php if($usergroup['smod']) { echo " checked=\"checked\""; } ?>></td>

    </tr>

    <tr>

      <td><b>Super Administrator</b></td>

      <td><input type="checkbox" name="sadmin" value="1"<?php if($usergroup['admin']) { echo " checked=\"checked\""; } ?>></td>

    </tr>

    <tr>

      <td><b>Use Control Panel</b></td>

      <td><input type="checkbox" name="usecp" value="1"<?php if($usergroup['usecp']) { echo " checked=\"checked\""; } ?>></td>

    </tr>

    <tr>

      <td><b>Avatar Size</b></td>

      <td><input type="text" name="avatarsize" value="<?php echo $usergroup['avatarsize']; ?>" size="40" /></td>

    </tr>

    <!-- end general usergroup details -->

    

    <tr>

      <td colspan="2" style="padding-top: 6px;">Control Panel Permissions</td>

    </tr>

    

    <!-- begin cp permissions -->

<?php

            
foreach($cp_perms as $cp_perm)

            {

?>

    <tr>

      <td><b><?php echo $cp_perm['title']; ?></b></td>

      <td><input type="radio" name="cp_<?php echo $cp_perm['var']; ?>" value="1"<?php if($usergroup_perms['cp'][$cp_perm['var']]) { echo " checked=\"checked\""; } ?>> Yes <input type="radio" name="cp_<?php echo $cp_perm['var']; ?>" value="0"<?php if(!$usergroup_perms['cp'][$cp_perm['var']]) { echo " checked=\"checked\""; } ?>> No</td>

    </tr>

<?php

            
}

?>    

    <!-- end cp permissions -->

    

    <tr>

      <td> </td>

      <td><input type="submit" value="Update"></td>

    </tr>

    

  </table>

</form>

<?php    

        
}

    }

}



if(
$_REQUEST['do'] == "add_profilefield" AND $th->permissions['cp']['add_profile_field'])

{

    if(
$_POST['action'] == "add_field")

    {

        
mysql_query("INSERT INTO `profilefield` VALUES ('','".$_POST['title']."','".$_POST['maxlength']."','".$_POST['width']."','".$_POST['displayorder']."','".$_POST['data']."','".$_POST['type']."','".$_POST['height']."')") or die(mysql_error()."1");

        
mysql_query("ALTER TABLE `userfields` ADD `field".mysql_insert_id()."` LONGTEXT NOT NULL") or die(mysql_error()."2");

        
print_message("Profile field successfully added","index.php?page=users&do=manage_profilefield");

    }

    else

    {

        if(
$_POST['action'] == "add" AND $_POST['type'])

        {    

            
$type $_POST['type'];

            switch(
$type)

            {

                case 
"text":

?>

<form action="" method="post">

  <input type="hidden" name="action" value="add_field">

  <table width="592" cellspacing="0" cellpadding="0" border="0">

    <tr>

      <td class="page_title">Add Profile Field - Text Box</td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td>

        <table width="100%" cellspacing="2" cellpadding="0" border="0">

          <tr>

            <td><b>Title</b></td>

            <td><input type="text" name="title" width="60"></td>

          </tr>

          <tr>

            <td><b>Max Length</b></td>

            <td><input type="text" name="maxlength" size="6"></td>

          </tr>

          <tr>

            <td><b>Width</b></td>

            <td><input type="text" name="width" size="6" value="24"></td>

          </tr>

          <tr>

            <td><b>Display Order</b></td>

            <td><input type="text" name="displayorder" size="6" value="1"></td>

          </tr>

          <tr>

            <td><b>Default Value</b></td>

            <td><input type="text" name="data" size="60"></td>

          </tr>

        </table>

      </td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td align="right"><input type="submit" value="Create"></td>

    </tr>

  </table>

  <input type="hidden" name="type" value="text">

</form>

<?

              break;

              

              case "textarea":

?>

<form action="" method="post">

  <input type="hidden" name="action" value="add_field">

  <table width="592" cellspacing="0" cellpadding="0" border="0">

    <tr>

      <td class="page_title">Add Profile Field - Text Area</td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td>

        <table width="100%" cellspacing="2" cellpadding="0" border="0">

          <tr>

            <td><b>Title</b></td>

            <td><input type="text" name="title" width="60"></td>

          </tr>

          <tr>

            <td><b>Max Length</b></td>

            <td><input type="text" name="maxlength" size="6"></td>

          </tr>

          <tr>

            <td><b>Colums</b></td>

            <td><input type="text" name="width" size="6" value="40"></td>

          </tr>

          <tr>

            <td><b>Rows</b></td>

            <td><input type="text" name="height" size="6" value="4"</td>

          </tr>

          <tr>

            <td><b>Display Order</b></td>

            <td><input type="text" name="displayorder" size="6" value="1"></td>

          </tr>

          <tr>

            <td><b>Default Value</b></td>

            <td><input type="text" name="data" size="60"></td>

          </tr>

        </table>

      </td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td align="right"><input type="submit" value="Create"></td>

    </tr>

  </table>

  <input type="hidden" name="type" value="textarea">

</form>

<?              

              break; 

              case "select":

?>

<form action="" method="post">

  <input type="hidden" name="action" value="add_field">

  <table width="592" cellspacing="0" cellpadding="0" border="0">

    <tr>

      <td class="page_title">Add Profile Field - Text Area</td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td>

        <table width="100%" cellspacing="2" cellpadding="0" border="0">

          <tr>

            <td><b>Title</b></td>

            <td><input type="text" name="title" width="60"></td>

          </tr>

          <tr>

            <td><b>Options - seperate by comma's (,)</b></td>

            <td><textarea name="data" cols="60" rows="6"></textarea></td>

          </tr>        

          <tr>

            <td><b>Display Order</b></td>

            <td><input type="text" name="displayorder" size="6" value="1"></td>

          </tr>

        </table>

      </td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td><input type="submit" value="Create"></td>

    </tr>

  </table>

  <input type="hidden" name="type" value="select">

</form>

<?                          

              break;  

            }

        }

        else

        {

?>

<form action="" method="post">

  <input type="hidden" name="action" value="add">

  <table width="592" cellspacing="0" cellpadding="0" border="0">

    <tr>

      <td class="page_title">Add Profile Field</td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td>

        <table width="100%" cellspacing="2" cellpadding="0" border="0">

          <tr>

            <td><b>Type</b></td>

            <td>

              <select name="type">

                <option value="text">Text Box</option>

                <option value="textarea">Text Area</option>

                <option value="select">Selection Menu</option>

              </select>

            </td>

          </tr>

        </table>

      </td>

    </tr>

    <tr>

      <td> </td>

    </tr>

    <tr>

      <td><input type="submit" value="Create"></td>

    </tr>

  </table>

</form>

<?

        }

    }    

}



// ## page - edit profile fields

if($_REQUEST['do'] == "manage_profilefield" AND $th->permissions['cp']['edit_profile_field'] OR $_REQUEST['do'] == "manage_profilefield" AND $th->permissions['cp']['delete_profile_field'])

{

    if($_REQUEST['action'] == "delete" AND $th->permissions['cp']['delete_profile_field'])

    {

        mysql_query("DELETE FROM `profilefield` WHERE `profilefieldid` = '".$_GET['id']."' LIMIT 1");

        mysql_query("ALTER TABLE `userfields` DROP `field".$_GET['id']."`") or die(mysql_error());

        print_message("Profile field successfully deleted","index.php?page=users&do=manage_profilefield");

    }

    else

    {

?>

<table width="100%" cellspacing="0" cellpadding="0" border="0">

  <tr>

    <td class="page_title">Manage Profile Fields</td>

  </tr>

  <tr>

    <td> </td>

  </tr>

  <tr>

    <td>

      <table width="100%" cellspacing="2" cellpadding="2" border="0">

        <tr>

          <td class="admin_footer">Title / Profile Field Type</td>

          <td class="admin_footer">Options</td>

        </tr>

<?

$bgc = 1;

$get_profilefields = mysql_query("SELECT * FROM `profilefield` ORDER BY `displayorder` ASC");

while($profilefields = mysql_fetch_array($get_profilefields))

{

    if($bgc == 1) { $color = "#F7F6F4"; $bgc = 0; }

    else if ($bgc == 0) { $color = "#FFFFFF"; $bgc = 1; }

    switch($profilefields['type'])

    {

        case "text":

            $type = "Single Line Text Box";

        break;

        case "textbox":

            $type = "Multi Line Text Box";

        break;

        case "select":

            $type = "Select Menu";

        break;            

    }

?>      

        <tr bgcolor="<? echo $color; ?>">

          <td><? echo $profilefields['title']; ?>
<? echo $type; ?></td>

          <td>[[url=index.php?page=users&do=manage_profilefield&action=delete&id=<? echo $profilefields['profilefieldid']; ?>]Delete[/url]]
[[url=index.php?page=users&do=edit_profilefield&id=<? echo $profilefields['profilefieldid']; ?>]Edit[/url]]</td>

        </tr>

<?

}

?>        

      </table>

    </td>

  </tr>

</table>

<?

    }

}



if($_REQUEST['do'] == "edit_profilefield" AND $th->permissions['cp']['edit_profile_fields'])

{

    if($_REQUEST['id'])

    {

        $query = $db->query("SELECT * FROM `profilefield` WHERE `profilefieldid` = '" . $_REQUEST['id'] . "' LIMIT 1");

        if($db->num_rows($query))

        {

            $field = $db->fetch_array($query);

            $show_form = true;

            

            if($_POST['action'] == "update")

            {

                $new_field = array(

                    "title" => $_POST['title'],

                    "maxlength" => $_POST['maxlength'],

                    "width" => $_POST['width'],

                    "displayorder" => $_POST['displayorder'],

                    "data" => $_POST['data'],

                    "type" => $_POST['type'],

                    "height" => $_POST['height'],

                );

                

                $db->update_query($new_field, "profilefield", "`profilefieldid` = '" . $field['profilefieldid'] . "'");

                

                print_message("The profile field has been successfully updated", "index.php?page=users&do=manage_profilefield");

                $show_form = false;

            }

            

            if($show_form)

            {

?>

<p class="page_title">Edit Profile Field - <?php echo $field['title']; ?>


<form action="" method="post">

  <input type="hidden" name="action" value="update" />

  <table width="100%" cellspacing="2" cellpadding="1" border="0">

    <tr>

      <td><b>Title</b></td>

      <td><input type="text" name="title" size="40" value="<?php echo $field['title']; ?>" /></td>

    </tr>

    <tr>

      <td><b>Type</b></td>

      <td>

        <select name="type">

          <option value="text"<?php if($field['type'] == "text") { echo " selected=\"selected\""; } ?>>Text Box</option>

          <option value="textarea"<?php if($field['type'] == "textarea") { echo " selected=\"selected\""; } ?>>Text Area</option>

          <option value="select"<?php if($field['type'] == "select") { echo " selected=\"selected\""; } ?>>Selection Menu</option>

          <option value="radio"<?php if($field['type'] == "radio") { echo " selected=\"selected\""; } ?>>Radio Buttons</option>

          <option value="option"<?php if($field['type'] == "option") { echo " selected=\"selected\""; } ?>>Option Buttons</option>

        </select>      

      </td>

    </tr>

    <tr>

      <td><b>Maxlength</b></td>

      <td><input type="text" name="maxlength" size="4" value="<?php echo $field['maxlength']; ?>" /></td>

    </tr>

    <tr>

      <td><b>Width</b></td>

      <td><input type="text" name="width" size="4" value="<?php echo $field['width']; ?>" /></td>

    </tr>

    <tr>

      <td><b>Displayorder</b></td>

      <td><input type="text" name="displayorder" size="4" value="<?php echo $field['displayorder']; ?>" /></td>

    </tr>

    <tr>

      <td><b>Height</b></td>

      <td><input type="text" name="height" size="5" value="<?php echo $field['height']; ?>"  /></td>

    </tr>

<?php

                
switch($field['type'])

                {

                    case 
"text":

                        
$data false;

                        break;

                    case 
"textarea":

                        
$data false;

                        break;

                    case 
"select":

                        
$data true;

                        
$title "Options - seperate by comma's (,)";

                        
$field "<textarea name=\"data\" cols=\"60\" rows=\"6\"></textarea>";

                        break;

                }

                if(
$data)

                {

?>

    <tr>

      <td><b><?php echo $title?></b></td>

      <td><?php echo $field?></td>

    </tr>

<?php

                
}

?>

    <tr>

      <td> </td>

      <td><input type="submit" value="Update" /></td>

    </tr>

  </table>

</form>

<?php

            
}

        }

    }

}

?>



DALE! ¬_¬ - Dale - 02-07-2006

You CBA because you didn't make this :p

PHP Code:
<form action="<? echo ; ?>" method="post"
You are echoing nothing and PHP don't like that. Just leave it blank. Something like this:
PHP Code:
<form action="" method="post"



DALE! ¬_¬ - Mathew - 02-07-2006

i know i didint make it lmao.