|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/abtechsci/mmc15/Membership/admin/ |
Upload File : |
<?php
/************* Membership V2.0 *******************/
/*
Released by AwesomePHP.com, under the GPL License, a
copy of it should be attached to the zip file, or
you can view it on http://AwesomePHP.com/gpl.txt
*/
/************* Membership V2.0 *******************/
if($is_admin == false){ die();}
if($_GET['do'] == 'Remove'){
$remove = mysql_query("DELETE FROM `memb_customfds` WHERE `field_id`='$_GET[field_id]' LIMIT 1");
if($remove){
$message = 'Field removed.<br/>';
$get_users = mysql_query("SELECT `user_id`,`custom_fields` FROM `memb_userlist`");
while($each = mysql_fetch_assoc($get_users)){
$new_array = array();
$lines = explode("\n",$each['custom_fields']);
foreach($lines as $this_line){
if(strstr($this_line, "[$_GET[field_id]]{+|%|+}")){
array_push($new_array,$this_line);
}
}
$update = mysql_query("UPDATE `memb_userlist` SET `custom_fields`='".implode("\n",$new_array)."'
WHERE `user_id`='$each[user_id]' LIMIT 1");
}
}else{$message = 'Unable to remove field ID#'.$_GET[field_id].'.';}
}
?>
<form name="fields" id="fields" method="post" action="?page=fields" style="display:inline;">
<table width="100%" border="1" cellspacing="0" cellpadding="5">
<tr bgcolor="#BEDEDE">
<td colspan="2"><div align="center"><font color="#999999" size="4"><strong>Custom Profile Fields: </strong></font></div></td>
</tr>
<?php
if($message != NULL){
?>
<tr>
<td colspan="2"><strong><font color="#FF0000" size="2"><?php echo $message;?></font></strong></td>
</tr>
<?php } if($_GET['do'] != 'Add'){?>
<tr>
<td colspan="2" bgcolor="#CAFFCA"><font color="#0000FF" size="2"><strong>Field Names: </strong></font><font size="2"> </font></td>
</tr>
<?php
$get_fields = mysql_query("SELECT * FROM `memb_customfds`");
$recrod_nums = mysql_num_rows($get_fields);
if($recrod_nums <= 0){
echo '<tr><td colspan="2"><strong>No custom fields found.</strong></td></tr>';
} else {
while($each = mysql_fetch_assoc($get_fields)){?>
<tr>
<td width="50%"><font size="2">Custom Field ID#
<?php echo $each['field_id'];?>
: </font></td>
<td width="50%"><font size="2">
<input name="fieldxy_<?php echo $each['field_id'];?>" type="text" id="fieldxy_<?php echo $each['field_id'];?>" value="<?php echo $each['field_name'];?>" class="hiddenText" disabled><br />
<?php if($each['is_required'] == 1){$sel=' checked';}else{$sel=NULL;}?>
<input name="fieldxz_<?php echo $each['field_id'];?>" type="checkbox" id="fieldxz_<?php echo $each['field_id'];?>" value="1"<?php echo $sel;?> disabled>
Required [<a onClick="
document.getElementById('fieldxy_<?php echo $each['field_id'];?>').disabled=false;
document.getElementById('fieldxz_<?php echo $each['field_id'];?>').disabled=false;" style="cursor:pointer;"><font color="#0000FF">Edit</font></a>] [<a style="cursor:pointer;" onclick="if(window.confirm('Are you sure you want to remove this field? Doing so will remove this field from ALL user profiles.')){window.location.href='?page=fields&do=Remove&field_id=<?php echo $each['field_id'];?>';}"><font color="#0000FF">Remove</font></a>] </font></td>
</tr>
<?php } }
}?>
<tr bgcolor="#CAFFCA">
<td colspan="2"><font color="#0000FF" size="2"><strong>Add new field: </strong></font></td>
</tr>
<tr>
<td width="50%"><font size="2">Field Name: </font></td>
<td width="50%"><font size="2">
<input name="newinput" type="text" id="newinput" class="hiddenText">
<input name="is_required" type="checkbox" id="is_required" value="1">
Required</font></td>
</tr>
<tr bgcolor="#BEDEDE">
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Update/Add">
<input name="doid" type="hidden" id="doid" value="4">
</div></td>
</tr>
</table>
</form>