Current location: Hot Scripts Forums » Programming Languages » PHP » Php Scripts and Mysql functions


Php Scripts and Mysql functions

Reply
  #1 (permalink)  
Old 06-03-10, 06:41 PM
BJ4450 BJ4450 is offline
New Member
 
Join Date: Jun 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Php Scripts and Mysql functions

I have downloaded a program script called dotproject 2.1.2. I am using a linux server Fedora Core 8. My php version is php Version: 5.1, MySQL Version: 5.0, and Operating System Version: Linux, Browsers: Firefox and Internet Explorer 8.

I have created a drop down menu that echoes the information that is stored in a Project table. The field name is project_name and in that field table there are many projects that are associated with different companies but all the projects are listed in the table. I would like to assign one user to one or more projects that are listed from this echo drop down menu from the mysql project database. The database is called projects. The user table contains several fields named user_id, user_contact, user_username, user_password, user_parent, user_type, user_company, user_department, user_owner, and user_signature.
I am searching for a way to store the information that is assigned to one user from the list of projects displayed in the drop down menu. The list will vary with other entries of new projects that are being added. In this scenario projects never deleted or changed, but projects keep getting added as new projects come in to the database. I have listed below are the 3 php scripts: I have highlighted the parts that I have added to the orignal script

addedituser.php
PHP Code:

<?php /* ADMIN $Id: admin.class.php 5633 2008-03-12 11:14:40Z cyberhorse $ */ 
if (!defined('DP_BASE_DIR')){ 
  die(
'You should not access this file directly.'); 

require_once (
$AppUI->getModuleClass('projects')); 
/** 
* User Class 
*/ 
class CUser extends CDpObject 
    var 
$user_id NULL
    var 
$user_username NULL
    var 
$user_password NULL
    var 
$user_parent NULL
    var 
$user_type NULL
        var 
$user_contact NULL
    var 
$user_signature NULL;
    [
B]var $project_users NULL
//    var $user_projects = NULL;
        
var $project_id NULL;
//    var $project_company = NULL;
    
var $project_short_name NULL;[/B
/*    var $user_first_name = NULL; 
    var $user_last_name = NULL; 
    var $user_company = NULL;
        var $project_name = NULL; 
    var $user_department = NULL; 
    var $user_email = NULL; 
    var $user_phone = NULL; 
    var $user_home_phone = NULL; 
    var $user_mobile = NULL; 
    var $user_address1 = NULL; 
    var $user_address2 = NULL; 
    var $user_city = NULL; 
    var $user_state = NULL; 
    var $user_zip = NULL; 
    var $user_country = NULL; 
    var $user_icq = NULL; 
    var $user_aol = NULL; 
    var $user_birthday = NULL; 
    var $user_pic = NULL; 
    var $user_owner = NULL; */ 
     
    
function CUser() { 
        
$this->CDpObject'users''user_id' ); 
    } 
 
    function 
check() { 
        if (
$this->user_id === NULL) { 
            return 
'user id is NULL'
        } 
        if (
$this->user_password !== NULL) { 
            
$this->user_password db_escapetrim$this->user_password ) ); 
        } 
        
// TODO MORE 
        
return NULL// object is ok 
    
}
        
// This "breaks" check-in/upload if project is not present.
    // class variable needs to be added "dymanically"
    //var $project_name = NULL;
    
        
}
    
    function 
store() { 
        
$msg $this->check(); 
        if( 
$msg ) { 
            return 
get_class$this )."::store-check failed"
        }
               [
B] {
        global 
$AppUI$project_name;
        if (
$project_name) {
            
$this->project_name NULL;
        }
        
$this->CDpObject('projects''project_id');
    }
    
    {
        global 
$project_available;
        if (
$project_available && $this->project_name != 0) {
            
$this->addprojectTaskLog();
        }
        
parent::store();
    } [/
B]
        
$q  = new DBQuery
        if( 
$this->user_id ) { 
        
// save the old password 
            
$perm_func "updateLogin"
            
$q->addTable('users'); 
            
$q->addQuery('user_password'); 
            
$q->addWhere("user_id = $this->user_id"); 
            
$pwd $q->loadResult(); 
            if (
$pwd != $this->user_password) { 
                
$this->user_password md5($this->user_password); 
                
addHistory($this->_tbl$this->user_id'password changed''Password changed from IP ' $_SERVER['REMOTE_ADDR']); 
            } else { 
                
$this->user_password null
            } 
 
            
$ret db_updateObject'users'$this'user_id'false ); 
        } else { 
            
$perm_func "addLogin"
            
$this->user_password md5($this->user_password); 
            
$ret db_insertObject'users'$this'user_id' ); 
        } 
        if( !
$ret ) { 
            return 
get_class$this )."::store failed <br />" db_error(); 
        } else { 
            
$acl =& $GLOBALS['AppUI']->acl(); 
            
$acl->$perm_func($this->user_id$this->user_username); 
            return 
NULL
        } 
 
 
    } 
 
    function 
delete$oid NULL ) { 
        
$id $this->user_id
        
$result parent::delete($oid); 
        if (! 
$result) { 
            
$acl =& $GLOBALS['AppUI']->acl(); 
            
$acl->deleteLogin($id); 
            
$q  = new DBQuery
            
$q->setDelete('user_preferences'); 
            
$q->addWhere('pref_user = '.$this->user_id); 
            
$q->exec(); 
            
$q->clear(); 
        } 
        return 
$result
     } 
 
 
?> 
 
[B]viewuser.php[/B]
 
 
<?php /* ADMIN $Id$ */ 
if (!defined('DP_BASE_DIR')) { 
    die(
'You should not access this file directly.'); 

 
GLOBAL 
$addPwT,$company_id$dept_ids$department$min_view$m$a
$user_id intval(dPgetParam($_GET'user_id'0)); 
 
if (
$user_id != $AppUI->user_id  
&& (! getPermission('admin''view'$user_id)  
|| ! 
getPermission('users''view'$user_id))) 
    
$AppUI->redirect('m=public&a=access_denied'); 
 
$AppUI->savePlace(); 
 
if (isset(
$_POST['show_form'])) { 
    
$add_pwt dPgetParam($_POST'add_pwt'0); 
    
$AppUI->setState('addProjWithTasks'$add_pwt); 
} else { 
    
$AppUI->setState('addProjWithTasks'false); 

 
$addPwT $AppUI->getState('addProjWithTasks') ? $AppUI->getState('addProjWithTasks') : 0
 
$company_id $AppUI->getState('UsrProjIdxCompany') !== NULL $AppUI->getState('UsrProjIdxCompany') : $AppUI->user_company
 
$company_prefix 'company_'
 
if (isset(
$_POST['department'])) { 
    
$AppUI->setState('UsrProjIdxDepartment'$_POST['department']); 
     
    
//if department is set, ignore the company_id field 
    
unset($company_id); 

$department $AppUI->getState('UsrProjIdxDepartment') !== NULL $AppUI->getState('UsrProjIdxDepartment') : $company_prefix.$AppUI->user_company
 
//if $department contains the $company_prefix string that it's requesting a company and not a department.  So, clear the  
// $department variable, and populate the $company_id variable. 
if (!(mb_strpos($department$company_prefix)===false)) { 
    
$company_id mb_substr($department,mb_strlen($company_prefix)); 
    
$AppUI->setState('UsrProjIdxCompany'$company_id); 
    unset(
$department); 

 
if (isset(
$_GET['tab'])) { 
    
$AppUI->setState('UserVwTab'$_GET['tab']); 

$tab $AppUI->getState('UserVwTab') !== NULL $AppUI->getState('UserVwTab') : 0
 
// pull data 
$q  = new DBQuery
$q->addTable('users''u'); 
$q->addQuery('u.*'); 
$q->addQuery('con.*, company_id, company_name, dept_name, dept_id'); 
$q->addJoin('contacts''con''user_contact = contact_id'); 
$q->addJoin('companies''com''contact_company = company_id');
$q->addJoin('projects''pro''project_name = project_id'); 
$q->addJoin('departments''dep''dept_id = contact_department'); 
$q->addWhere('u.user_id = '.$user_id); 
$sql $q->prepare(); 
$q->clear(); 
[
B]// pull projects 
    
$q = new DBQuery
    
$q->addTable('projects'); 
    
$q->addQuery('project_id, project_name'); 
    
$q->addOrder('project_name'); 
    
$projects arrayMerge( array( => '' ), $q->loadHashList() ); [/B]
 
if (!
db_loadHash($sql$user)) { 
    
$titleBlock = new CTitleBlock('Invalid User ID''helix-setup-user.png'$m"$m.$a"); 
    
$titleBlock->addCrumb('?m=admin''users list'); 
    
$titleBlock->show(); 
} else { 
 
// setup the title block 
    
$titleBlock = new CTitleBlock('View User''helix-setup-user.png'$m"$m.$a"); 
    if (
$canRead) { 
      
$titleBlock->addCrumb('?m=admin''users list'); 
    } 
    if (
$canEdit) { 
        
$titleBlock->addCrumb('?m=admin&amp;a=addedituser&amp;user_id=' $user_id,  
                              
'edit this user'); 
    } 
    if (
$canEdit || $user_id == $AppUI->user_id) { 
        
$titleBlock->addCrumb('?m=system&amp;a=addeditpref&amp;user_id=' $user_id,  
                              
'edit preferences'); 
        
$titleBlock->addCrumbRight('<a href="#" onclick="popChgPwd();return false">'  
                                   
$AppUI->_('change password') . '</a>'); 
        
$titleBlock->addCell('<input type="button" class=button value="' $AppUI->_('add user')  
                             . 
'" onClick="javascript:window.location=\'./index.php'  
                             
'?m=admin&amp;a=addedituser\';" />'); 
    } 
    
$titleBlock->show(); 
?> 
<script type="text/javascript" language="javascript"> 
<?php 
// security improvement: 
// some javascript functions may not appear on client side in case of user not having write permissions 
// else users would be able to arbitrarily run 'bad' functions 
if ($canEdit || $user_id == $AppUI->user_id) { 
?> 
function popChgPwd() { 
    window.open('./index.php?m=public&a=chpwd&dialog=1&user_id=<?php echo $user['user_id']; ?>', 'chpwd', 'top=250,left=250,width=350, height=220, scrollbars=no'); 

<?php ?> 
</script> 
 
<table border="0" cellpadding="4" cellspacing="0" width="100%" class="std"> 
<tr valign="top"> 
    <td width="50%"> 
        <table cellspacing="1" cellpadding="2" border="0" width="100%"> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Login Name');?>:</td> 
            <td class="hilite" width="100%"><?php echo $user['user_username'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('User Type');?>:</td> 
            <td class="hilite" width="100%"><?php echo $AppUI->_($utypes[$user['user_type']]);?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Real Name');?>:</td> 
            <td class="hilite" width="100%"><?php echo $user['contact_first_name'].' '.$user['contact_last_name'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Project Company');?>:</td> 
            <td class="hilite" width="100%"> 
                <?php 
                
if (getPermission('companies''access'$user['contact_company'])) { 
                    echo 
'<a href="?m=companies&amp;a=view&amp;company_id=' $user['contact_company'] . '" title="' htmlspecialchars($user['company_name'], ENT_QUOTES) . '">' htmlspecialchars($user['company_name'], ENT_QUOTES) . '</a>'
                } else { 
                    echo 
htmlspecialchars($user['company_name'], ENT_QUOTES); 
                } 
                
?> 
            </td> 
        </tr> 
      [B]  <tr> 
    <td align="right" valign="top"> <?php echo $AppUI->_('Projects');?>:</td> 
    <td> 
<?php 
    
($user["projects"] ); 
?> 
</td> 
</tr>[/B] 
 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Department');?>:</td> 
            <td class="hilite" width="100%"> 
                <a href="?m=departments&amp;a=view&amp;dept_id=<?php echo @$user['contact_department'];?>"><?php echo $user['dept_name'];?></a> 
            </td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Phone');?>:</td> 
            <td class="hilite" width="100%"><?php echo @$user['contact_phone'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Home Phone');?>:</td> 
            <td class="hilite" width="100%"><?php echo @$user['contact_phone2'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Mobile');?>:</td> 
            <td class="hilite" width="100%"><?php echo @$user['contact_mobile'];?></td> 
        </tr> 
        <tr valign=top> 
            <td align="right" nowrap><?php echo $AppUI->_('Address');?>:</td> 
            <td class="hilite" width="100%"><?php 
                
echo @$user['contact_address1'
                    .((
$user['contact_address2']) ? '<br />'.$user['contact_address2'] : ''
                    .
'<br />'.$user['contact_city'
                    .
'&nbsp;&nbsp;'.$user['contact_state'
                    .
'&nbsp;&nbsp;'.$user['contact_zip'
                    .
'<br />'.$user['contact_country'
                    ; 
            
?></td> 
        </tr> 
        </table> 
 
    </td> 
    <td width="50%"> 
        <table width="100%"> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Birthday');?>:</td> 
            <td class="hilite" width="100%"><?php echo @$user['contact_birthday'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap>ICQ#:</td> 
            <td class="hilite" width="100%"><?php echo @$user['contact_icq'];?></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap>AOL Nick:</td> 
            <td class="hilite" width="100%"><a href="aim:<?php echo @$user['contact_aol'];?>"><?php echo @$user['contact_aol'];?></a></td> 
        </tr> 
        <tr> 
            <td align="right" nowrap><?php echo $AppUI->_('Email');?>:</td> 
            <td class="hilite" width="100%"><?php echo '<a href="mailto:'.@$user['contact_email'].'">'.@$user['contact_email'].'</a>';?></td> 
        </tr> 
        <tr> 
            <td colspan="2"><strong><?php echo $AppUI->_('Signature');?>:</strong></td> 
        </tr> 
        <tr> 
            <td class="hilite" width="100%" colspan="2"> 
                <?php echo str_replace(chr(10), '<br />'$user['user_signature']);?>&nbsp; 
            </td> 
        </tr> 
        </table> 
    </td> 
</tr> 
</table> 
 
<?php 
    
// force tabbed information boxes 
    
$min_view true
    
$oldViewPref $AppUI->getPref('TABVIEW'); 
    
$AppUI->setPref('TABVIEW'1); 
     
    
$tabBox = new CTabBox(('?m=admin&amp;a=viewuser&amp;user_id=' $user_id), ''$tab); 
    
$tabBox->loadExtras('admin''viewuser');  
    
$tabBox->add(DP_BASE_DIR.'/modules/admin/vw_usr_log''User Log'); 
    
$tabBox->add(DP_BASE_DIR.'/modules/admin/vw_usr_perms''Permissions'); 
    
$tabBox->add(DP_BASE_DIR.'/modules/admin/vw_usr_roles''Roles'); 
    
$tabBox->show(); 
     
    
$AppUI->setPref('TABVIEW'$oldViewPref); 

?> 
 
[B]addedituser.php[/B]
 
<?php /* ADMIN $Id: addedituser.php 5773 2008-07-21 15:04:07Z merlinyoda $ */ 
//add or edit a system user 
 
if (!defined('DP_BASE_DIR')) { 
    die(
'You should not access this file directly.'); 

 
$user_id = isset($_GET['user_id']) ? $_GET['user_id'] : 0
 
if (
$user_id == 0
    
$canEdit $canAuthor
 
if (
$canEdit
    
$canEdit $perms->checkModuleItem('users', ($user_id 'edit' 'add'), $user_id); 
 
// check permissions 
if (!$canEdit && $user_id != $AppUI->user_id) { 
    
$AppUI->redirect"m=public&a=access_denied" ); 

 
//$roles 
// Create the roles class container 
require_once DP_BASE_DIR."/modules/system/roles/roles.class.php"
$perms =& $AppUI->acl(); 
$crole =& new CRole
$roles $crole->getRoles(); 
// Format the roles for use in arraySelect 
$roles_arr = array(); 
foreach (
$roles as $role) { 
  
$roles_arr[$role['id']] = $role['name']; 

$roles_arr arrayMerge( array( => '' ), $roles_arr ); 
 
 
$q  = new DBQuery
$q->addTable('users''u'); 
$q->addQuery('u.*'); 
$q->addQuery('con.*, company_id, company_name, dept_name'); 
$q->addJoin('contacts''con''user_contact = contact_id'); 
$q->addJoin('companies''com''contact_company = company_id');
[
B]$q->addJoin('projects''pro''project_name = project_id');[/B
$q->addJoin('departments''dep''dept_id = contact_department'); 
$q->addWhere('u.user_id = '.$user_id); 
$sql $q->prepare(); 
$q->clear(); 
 
if (!
db_loadHash$sql$user ) && $user_id 0) { 
    
$titleBlock = new CTitleBlock'Invalid User ID''helix-setup-user.png'$m"$m.$a); 
    
$titleBlock->addCrumb"?m=admin""users list" ); 
    
$titleBlock->show(); 
} else { 
     if ( 
$user_id == 0
        
$user['contact_id'] = 0
// pull companies 
    
$q = new DBQuery
    
$q->addTable('companies'); 
    
$q->addQuery('company_id, company_name'); 
    
$q->addOrder('company_name'); 
    
$companies arrayMerge( array( => '' ), $q->loadHashList() ); 
[
B]// pull projects 
    
$q = new DBQuery
    
$q->addTable('projects'); 
    
$q->addQuery('project_id, project_name'); 
    
$q->addOrder('project_name'); 
    
$projects arrayMerge( array( => '' ), $q->loadHashList() ); [/B]
 
 
// setup the title block 
    
$ttl $user_id "Edit User" "Add User"
    
$titleBlock = new CTitleBlock$ttl'helix-setup-user.png'$m"$m.$a); 
    if (
$perms->checkModule('admin''view') && $perms->checkModule('users''view')) 
        
$titleBlock->addCrumb"?m=admin""users list" ); 
    if (
$user_id 0) { 
        
$titleBlock->addCrumb"?m=admin&a=viewuser&user_id=$user_id""view this user" ); 
        if (
$canEdit || $user_id == $AppUI->user_id) { 
        
$titleBlock->addCrumb"?m=system&a=addeditpref&user_id=$user_id""edit preferences" ); 
        } 
    } 
    
$titleBlock->show(); 
?> 
<script type="text/javascript" language="javascript"> 
function submitIt(){ 
    var form = document.editFrm; 
   if (form.user_username.value.length < <?php echo dPgetConfig('username_min_len'); ?> && form.user_username.value != '<?php echo dPgetConfig('admin_username'); ?>') { 
        alert("<?php echo $AppUI->_('adminValidUserName'UI_OUTPUT_JS)  ;?>"  + <?php echo dPgetConfig('username_min_len'); ?>); 
        form.user_username.focus(); 
      <?php if ($canEdit && !$user_id) { ?> 
    } else if (form.user_role.value <=0 ) { 
        alert("<?php echo $AppUI->_('adminValidRole'UI_OUTPUT_JS);?>"); 
        form.user_role.focus();     <?php ?> 
    } else if (form.user_password.value.length < <?php echo dPgetConfig('password_min_len'); ?>) { 
        alert("<?php echo $AppUI->_('adminValidPassword'UI_OUTPUT_JS);?>" + <?php echo dPgetConfig('password_min_len'); ?>); 
        form.user_password.focus(); 
    } else if (form.user_password.value !=  form.password_check.value) { 
        alert("<?php echo $AppUI->_('adminPasswordsDiffer'UI_OUTPUT_JS);?>"); 
        form.user_password.focus(); 
    } else if (form.contact_first_name.value.length < 1) { 
        alert("<?php echo $AppUI->_('adminValidFirstName'UI_OUTPUT_JS);?>"); 
        form.contact_first_name.focus(); 
    } else if (form.contact_last_name.value.length < 1) { 
        alert("<?php echo $AppUI->_('adminValidLastName'UI_OUTPUT_JS);?>"); 
        form.contact_last_name.focus(); 
    } else if (form.contact_email.value.length < 4) { 
        alert("<?php echo $AppUI->_('adminInvalidEmail'UI_OUTPUT_JS);?>"); 
        form.contact_email.focus(); 
    } else if (form.contact_birthday && form.contact_birthday.value.length > 0) { 
        dar = form.contact_birthday.value.split("-"); 
        if (dar.length < 3) { 
            alert("<?php echo $AppUI->_('adminInvalidBirthday'UI_OUTPUT_JS);?>"); 
            form.contact_birthday.focus(); 
        } else if (isNaN(parseInt(dar[0],10)) || isNaN(parseInt(dar[1],10)) || isNaN(parseInt(dar[2],10))) { 
            alert("<?php echo $AppUI->_('adminInvalidBirthday'UI_OUTPUT_JS);?>"); 
            form.contact_birthday.focus(); 
        } else if (parseInt(dar[1],10) < 1 || parseInt(dar[1],10) > 12) { 
            alert("<?php echo $AppUI->_('adminInvalidMonth'UI_OUTPUT_JS).' '.$AppUI->_('adminInvalidBirthday'UI_OUTPUT_JS);?>"); 
            form.contact_birthday.focus(); 
        } else if (parseInt(dar[2],10) < 1 || parseInt(dar[2],10) > 31) { 
            alert("<?php echo $AppUI->_('adminInvalidDay'UI_OUTPUT_JS).' '.$AppUI->_('adminInvalidBirthday'UI_OUTPUT_JS);?>"); 
            form.contact_birthday.focus(); 
        } else if(parseInt(dar[0],10) < 1900 || parseInt(dar[0],10) > 2020) { 
            alert("<?php echo $AppUI->_('adminInvalidYear'UI_OUTPUT_JS).' '.$AppUI->_('adminInvalidBirthday'UI_OUTPUT_JS);?>"); 
            form.contact_birthday.focus(); 
        } else { 
            form.submit(); 
        } 
    } else { 
        form.submit(); 
    } 

 
function popDept() { 
    var f = document.editFrm; 
    if (f.selectedIndex == 0) { 
        alert('<?php echo $AppUI->_'Please select a company first!'UI_OUTPUT_JS ); ?>'); 
    } else { 
        window.open('./index.php?m=public&a=selector&dialog=1&callback=setDept&table=departments&company_id=' 
            + f.contact_company.options[f.contact_company.selectedIndex].value 
            + '&dept_id='+f.contact_department.value,'dept','left=50,top=50,height=250,width=400,resizable') 
    } 

 
// Callback function for the generic selector 
function setDept( key, val ) { 
    var f = document.editFrm; 
    if (val != '') { 
        f.contact_department.value = key; 
        f.dept_name.value = val; 
    } else { 
        f.contact_department.value = '0'; 
        f.dept_name.value = ''; 
    } 

</script> 
 
<table width="100%" border="0" cellpadding="0" cellspacing="1" height="400" class="std"> 
<form name="editFrm" action="./index.php?m=admin" method="post"> 
    <input type="hidden" name="user_id" value="<?php echo intval($user["user_id"]);?>" /> 
    <input type="hidden" name="contact_id" value="<?php echo intval($user["contact_id"]);?>" /> 
    <input type="hidden" name="dosql" value="do_user_aed" /> 
    <input type="hidden" name="username_min_len" value="<?php echo dPgetConfig('username_min_len'); ?>)" /> 
    <input type="hidden" name="password_min_len" value="<?php echo dPgetConfig('password_min_len'); ?>)" /> 
     
 
<tr> 
    <td align="right" width="230">* <?php echo $AppUI->_('Login Name');?>:</td> 
    <td> 
<?php 
    
if (@$user["user_username"]){ 
        echo 
'<input type="hidden" class="text" name="user_username" value="' $user["user_username"] . '" />'
        echo 
'<strong>' $user["user_username"] . '</strong>'
    } else { 
        echo 
'<input type="text" class="text" name="user_username" value="' $user["user_username"] . '" maxlength="255" size="40" />'
    } 
?> 
    </td></tr> 
<?php if ($canEdit) { // prevent users without read-write permissions from seeing and editing user type 
?> 
<tr> 
    <td align="right"> <?php echo $AppUI->_('User Type');?>:</td> 
    <td> 
<?php 
    
echo arraySelect$utypes'user_type''class=text size=1'$user["user_type"], true ); 
?> 
    </td> 
</tr> 
<?php // End of security 
?> 
<?php if ($canEdit && !$user_id) { ?> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('User Role');?>:</td> 
    <td><?php echo arraySelect($roles_arr'user_role''size="1" class="text"',''true);?></td> 
</tr> 
<?php 
?> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('Password');?>:</td> 
    <td><input type="password" class="text" name="user_password" value="<?php echo $user["user_password"];?>" maxlength="32" size="32" /> </td> 
</tr> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('Confirm Password');?>:</td> 
    <td><input type="password" class="text" name="password_check" value="<?php echo $user["user_password"];?>" maxlength="32" size="32" /> </td> 
</tr> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('Name');?>:</td> 
    <td><input type="text" class="text" name="contact_first_name" value="<?php echo $user["contact_first_name"];?>" maxlength="50" /> <input type="text" class="text" name="contact_last_name" value="<?php echo $user["contact_last_name"];?>" maxlength="50" /></td> 
</tr> 
<?php if ($canEdit) { ?> 
<tr> 
    <td align="right"> <?php echo $AppUI->_('Company');?>:</td> 
    <td> 
<?php 
    
echo arraySelect$companies'contact_company''class=text size=1'$user["contact_company"] ); 
?> 
    </td> 
</tr> 
<tr> 
    <td align="right" valign="top"> <?php echo $AppUI->_('Projects');?>:</td> 
    <td> 
<?php 
    
echo projectSelectWithOptGroup$projects 'projects''class="text" MULTIPLE size="10"'$user["projects"] ); 
?> 
</td> 
</tr> 
<?php ?> 
<tr> 
    <td align="right"><?php echo $AppUI->_('Department');?>:</td> 
    <td> 
        <input type="hidden" name="contact_department" value="<?php echo @$user["contact_department"];?>" /> 
        <input type="text" class="text" name="dept_name" value="<?php echo @$user["dept_name"];?>" size="40" disabled /> 
        <input type="button" class="button" value="<?php echo $AppUI->_('select dept');?>..." onclick="popDept()" /> 
    </td> 
</tr> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('Email');?>:</td> 
    <td><input type="text" class="text" name="contact_email" value="<?php echo $user["contact_email"];?>" maxlength="255" size="40" /> </td> 
</tr> 
<tr> 
    <td align="right" valign=top><?php echo $AppUI->_('Email').' '.$AppUI->_('Signature');?>:</td> 
    <td><textarea class="text" cols=50 name="user_signature" style="height: 50px"><?php echo @$user["user_signature"];?></textarea></td> 
</tr> 
<tr> 
    <td align="right"><a href="?m=contacts&a=addedit&contact_id=<?php echo $user['user_contact']; ?>"><?php echo $AppUI->_(array('edit''contact info')); ?></a></td> 
    <td>&nbsp;</td> 
</tr> 
<tr> 
    <td align="right">* <?php echo $AppUI->_('Required Fields'); ?></td> 
    <td></td> 
<tr> 
    <td align="left"> 
        <input type="button" value="<?php echo $AppUI->_('back');?>" onClick="javascript:history.back(-1);" class="button" /> 
    </td> 
    <td align="right"> 
    <?php if ($canEdit && !$user_id) { ?> 
    <label for="send_user_mail"><?php echo $AppUI->_('Inform new user of their account details?'); ?></label> <input type="checkbox" value="1" name="send_user_mail" id="send_user_mail" />&nbsp;&nbsp;&nbsp;<?php ?> 
    <input type="button" value="<?php echo $AppUI->_('submit');?>" onclick="submitIt()" class="button" /> 
    </td> 
</tr> 
</table> 
<?php ?>
What I would like to happen, is that the addedituser.php insert and store the information from one or more projects into the projects mysql database. That is what I am trying to accomplished. After that is done, It echoes in the viewiser.php the inserted and stored parameters of the project names.

If you require an example, please contact me. I do need help with the correct syntax to make this work. Any ideas will be appreciated.

Thanks

Last edited by Nico; 06-04-10 at 04:18 AM. Reason: Wrappers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
multiple choices


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Source PHP MySQL Directory Scripts tarlachmoorhouse Script Requests 1 01-14-08 04:28 AM
2 separate php scripts using same mysql auth SOcRatEs Script Requests 0 07-20-06 02:29 AM
Php Mysql Bug??? tranquilraven PHP 4 03-01-06 04:06 AM
php and mysql scripts question pjacks PHP 4 03-25-05 02:09 PM
PHP scripts unable to connect to DB after MySQL 4.1.10 upgrade Jason L PHP 3 03-08-05 01:32 AM


All times are GMT -5. The time now is 11:24 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.