Edit Profile Error
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/login_basics.html
http://www.wysiwygwebbuilder.com/login_tools.html
TIP:
A lot of information about the login tools can be found in the help/manual.
Also checkout the demo template that is include with the software.
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/login_basics.html
http://www.wysiwygwebbuilder.com/login_tools.html
TIP:
A lot of information about the login tools can be found in the help/manual.
Also checkout the demo template that is include with the software.
Edit Profile Error
Hi, I am getting this error message when I try to get to the edit profile page. I am logged in at the time. Not sure what is causing it?
Parse error: syntax error, unexpected '" "' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /home/content/62/3698662/html/members2018test/login_ppocc/editprofileppocc.php on line 278
when I check the html code line 278 refers to email but I cannot see anything wrong.
Thanks
Parse error: syntax error, unexpected '" "' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /home/content/62/3698662/html/members2018test/login_ppocc/editprofileppocc.php on line 278
when I check the html code line 278 refers to email but I cannot see anything wrong.
Thanks
Re: Edit Profile Error
What code is on line 278?
Re: Edit Profile Error
The error showed # 278
276 <tr>
277 <td class="label"><label for="email">E-mail</label></td>
278 </tr>
279 <tr>
280 <td class="row"><input class="input" name="email" type="text" id="email" value="<?php echo $db_email; ?>"></td>
281 </tr>
I also did a different edit profile page with the basic edit profile object and the error was # 297
294 <tr>
295 <td class="label"><label for="confirmpassword">Confirm Password</label></td>
296 </tr>
297 <tr>
298 <td class="row"><input class="input" name="confirmpassword" type="password" id="confirmpassword"></td>
299 </tr>
300 <tr>
276 <tr>
277 <td class="label"><label for="email">E-mail</label></td>
278 </tr>
279 <tr>
280 <td class="row"><input class="input" name="email" type="text" id="email" value="<?php echo $db_email; ?>"></td>
281 </tr>
I also did a different edit profile page with the basic edit profile object and the error was # 297
294 <tr>
295 <td class="label"><label for="confirmpassword">Confirm Password</label></td>
296 </tr>
297 <tr>
298 <td class="row"><input class="input" name="confirmpassword" type="password" id="confirmpassword"></td>
299 </tr>
300 <tr>
Re: Edit Profile Error
Are you sure this is the correct code?
Because an error on this line does not make any sense.
Because an error on this line does not make any sense.
Re: Edit Profile Error
The signup page and the admin page both work fine for adding new users. For some reason though the admin edit users doesn't save a new avatar.
Re: Edit Profile Error
I think the problem is related to the HTML formatting option sin Tools -> options -> HTML
Can you please set all options to their defaults?
Can you please set all options to their defaults?
Re: Edit Profile Error
WOW, you are good at what you do! That cured a few ills I was having.
A while back there was an issue with the Avatar not displaying when editing a record after converting the form to html. You mentioned there was a fix in an update. I have the update but the Avatar does not display. Did that get fixed or am I missing something?
Thanks again!
A while back there was an issue with the Avatar not displaying when editing a record after converting the form to html. You mentioned there was a fix in an update. I have the update but the Avatar does not display. Did that get fixed or am I missing something?
Thanks again!
Re: Edit Profile Error
Yes, that issue was fixed.Did that get fixed or am I missing something?
- BaconFries
-
- Posts: 5364
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Edit Profile Error
Yes that has already been fixed. The latest build is - WYSIWYG Web Builder 14.0.4 (build date: June 12, 2018)
You can download at the following: Download
You can download at the following: Download
Re: Edit Profile Error
Hmmm, I was on 14.0.3 and it didn't display the avatar. I downloaded and installed 14.0.4 and still no Avatar.
The Admin update module do not seem to be update anything now.
The edit profile using html form does save text updates with the exception of the avatar. The avatar doesn't display. If I browse for a new avatar I can select one but it doesn't save it.
If I edit profile using the non html version it displays and saves everything fine. My problem is that I need two of the fields to be text areas which is not available as is.
I am at a loss?
The Admin update module do not seem to be update anything now.
The edit profile using html form does save text updates with the exception of the avatar. The avatar doesn't display. If I browse for a new avatar I can select one but it doesn't save it.
If I edit profile using the non html version it displays and saves everything fine. My problem is that I need two of the fields to be text areas which is not available as is.
I am at a loss?
Re: Edit Profile Error
Here is a test username and password if that helps.
www.ppocc.org/members2018test/
go to Members only drop down.
username: suewhite
password: mark39
www.ppocc.org/members2018test/
go to Members only drop down.
username: suewhite
password: mark39
Re: Edit Profile Error
Did you create the avatar folder on the server?
Does it have write permissions?
Note that once you have converted a login form to a standard form, the code will be unchanged.
So, the fix only applies to new forms.
Does it have write permissions?
Note that once you have converted a login form to a standard form, the code will be unchanged.
So, the fix only applies to new forms.
Re: Edit Profile Error
The avatar folder is on the server. When I add a new user I can add the avatar.
I'll try redoing the form again from the unconverted form. I didn't convert the admin form and that doesn't let me update user information?
Thanks for working this through for me. It's looking good so far with a few glitches.
I'll try redoing the form again from the unconverted form. I didn't convert the admin form and that doesn't let me update user information?
Thanks for working this through for me. It's looking good so far with a few glitches.
Re: Edit Profile Error
I did what you said and still no avatar displays. I can browse for a new avatar but it doesn't save. Other data is saved though.
http://www.ppocc.org/members2018test/lo ... ccform.php
Here is the source code for the page if that helps:
<?php
if (session_id() == "")
{
session_start();
}
if (!isset($_SESSION['username']))
{
$accessdenied_page = './loginppocc2.php';
header('Location: '.$accessdenied_page);
exit;
}
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$error_message = '';
$db_username = '';
$db_fullname = '';
$db_email = '';
$db_avatar = '';
$db_extra1 = '';
$db_extra2 = '';
$db_extra3 = '';
$db_extra4 = '';
$db_extra5 = '';
$db_extra6 = '';
$db_extra7 = '';
$db_extra8 = '';
$db_extra9 = '';
$db_extra10 = '';
$db_extra11 = '';
$db_extra12 = '';
$db_extra13 = '';
$avatar_folder = 'avatars';
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'editprofileform')
{
$success_page = './../index.php';
$oldusername = $_SESSION['username'];
$newusername = $_POST['username'];
$newemail = $_POST['email'];
$newpassword = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$newfullname = $_POST['fullname'];
$extra1 = $_POST['extra1'];
$extra2 = $_POST['extra2'];
$extra3 = $_POST['extra3'];
$extra4 = $_POST['extra4'];
$extra5 = $_POST['extra5'];
$extra6 = $_POST['extra6'];
$extra7 = $_POST['extra7'];
$extra8 = $_POST['extra8'];
$extra9 = $_POST['extra9'];
$extra10 = $_POST['extra10'];
$extra11 = $_POST['extra11'];
$extra12 = $_POST['extra12'];
$extra13 = $_POST['extra13'];
if ($newpassword != $confirmpassword)
{
$error_message = 'Password and Confirm Password are not the same!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newusername))
{
$error_message = 'Username is not valid, please check and try again!';
}
else
if (!empty($newpassword) && !preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newpassword))
{
$error_message = 'Password is not valid, please check and try again!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$.' &]{1,50}$/", $newfullname))
{
$error_message = 'Fullname is not valid, please check and try again!';
}
else
if (!preg_match("/^.+@.+\..+$/", $newemail))
{
$error_message = 'Email is not a valid email address. Please check and try again.';
}
else
{
$avatar_max_width = 256;
$avatar_max_height = 256;
$newavatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
list($width, $height) = getimagesize($_FILES['avatar']['tmp_name']);
if ($width <= $avatar_max_width && $height <= $avatar_max_height)
{
$prefix = rand(111111, 999999);
$newavatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $newavatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "The image is too big.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
if ($oldusername != $newusername)
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".mysqli_real_escape_string($db, $newusername)."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$error_message = 'Username already used. Please select another username.';
}
}
if (empty($error_message))
{
$crypt_pass = md5($newpassword);
$newusername = mysqli_real_escape_string($db, $newusername);
$newemail = mysqli_real_escape_string($db, $newemail);
$newfullname = mysqli_real_escape_string($db, $newfullname);
$extra1 = mysqli_real_escape_string($db, $extra1);
$extra2 = mysqli_real_escape_string($db, $extra2);
$extra3 = mysqli_real_escape_string($db, $extra3);
$extra4 = mysqli_real_escape_string($db, $extra4);
$extra5 = mysqli_real_escape_string($db, $extra5);
$extra6 = mysqli_real_escape_string($db, $extra6);
$extra7 = mysqli_real_escape_string($db, $extra7);
$extra8 = mysqli_real_escape_string($db, $extra8);
$extra9 = mysqli_real_escape_string($db, $extra9);
$extra10 = mysqli_real_escape_string($db, $extra10);
$extra11 = mysqli_real_escape_string($db, $extra11);
$extra12 = mysqli_real_escape_string($db, $extra12);
$extra13 = mysqli_real_escape_string($db, $extra13);
$sql = "UPDATE `".$mysql_table."` SET `username` = '$newusername', `fullname` = '$newfullname', `email` = '$newemail', `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11', `extra12` = '$extra12', `extra13` = '$extra13' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
if (!empty($newpassword))
{
$sql = "UPDATE `".$mysql_table."` SET `password` = '$crypt_pass' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
}
if (!empty($newavatar))
{
$sql = "UPDATE `".$mysql_table."` SET `avatar` = '$newavatar' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
$_SESSION['avatar'] = "http://".$_SERVER['HTTP_HOST'] . "login_ppocc/avatars/" . $newavatar;
}
}
mysqli_close($db);
if (empty($error_message))
{
$_SESSION['username'] = $newusername;
$_SESSION['fullname'] = $newfullname;
header('Location: '.$success_page);
exit;
}
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$_SESSION['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$db_username = $data['username'];
$db_fullname = $data['fullname'];
$db_email = $data['email'];
$db_avatar = $data['avatar'];
$db_extra1 = $data['extra1'];
$db_extra2 = $data['extra2'];
$db_extra3 = $data['extra3'];
$db_extra4 = $data['extra4'];
$db_extra5 = $data['extra5'];
$db_extra6 = $data['extra6'];
$db_extra7 = $data['extra7'];
$db_extra8 = $data['extra8'];
$db_extra9 = $data['extra9'];
$db_extra10 = $data['extra10'];
$db_extra11 = $data['extra11'];
$db_extra12 = $data['extra12'];
$db_extra13 = $data['extra13'];
}
mysqli_close($db);
?>
http://www.ppocc.org/members2018test/lo ... ccform.php
Here is the source code for the page if that helps:
<?php
if (session_id() == "")
{
session_start();
}
if (!isset($_SESSION['username']))
{
$accessdenied_page = './loginppocc2.php';
header('Location: '.$accessdenied_page);
exit;
}
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$error_message = '';
$db_username = '';
$db_fullname = '';
$db_email = '';
$db_avatar = '';
$db_extra1 = '';
$db_extra2 = '';
$db_extra3 = '';
$db_extra4 = '';
$db_extra5 = '';
$db_extra6 = '';
$db_extra7 = '';
$db_extra8 = '';
$db_extra9 = '';
$db_extra10 = '';
$db_extra11 = '';
$db_extra12 = '';
$db_extra13 = '';
$avatar_folder = 'avatars';
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['form_name']) && $_POST['form_name'] == 'editprofileform')
{
$success_page = './../index.php';
$oldusername = $_SESSION['username'];
$newusername = $_POST['username'];
$newemail = $_POST['email'];
$newpassword = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
$newfullname = $_POST['fullname'];
$extra1 = $_POST['extra1'];
$extra2 = $_POST['extra2'];
$extra3 = $_POST['extra3'];
$extra4 = $_POST['extra4'];
$extra5 = $_POST['extra5'];
$extra6 = $_POST['extra6'];
$extra7 = $_POST['extra7'];
$extra8 = $_POST['extra8'];
$extra9 = $_POST['extra9'];
$extra10 = $_POST['extra10'];
$extra11 = $_POST['extra11'];
$extra12 = $_POST['extra12'];
$extra13 = $_POST['extra13'];
if ($newpassword != $confirmpassword)
{
$error_message = 'Password and Confirm Password are not the same!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newusername))
{
$error_message = 'Username is not valid, please check and try again!';
}
else
if (!empty($newpassword) && !preg_match("/^[A-Za-z0-9_!@$]{1,50}$/", $newpassword))
{
$error_message = 'Password is not valid, please check and try again!';
}
else
if (!preg_match("/^[A-Za-z0-9_!@$.' &]{1,50}$/", $newfullname))
{
$error_message = 'Fullname is not valid, please check and try again!';
}
else
if (!preg_match("/^.+@.+\..+$/", $newemail))
{
$error_message = 'Email is not a valid email address. Please check and try again.';
}
else
{
$avatar_max_width = 256;
$avatar_max_height = 256;
$newavatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
list($width, $height) = getimagesize($_FILES['avatar']['tmp_name']);
if ($width <= $avatar_max_width && $height <= $avatar_max_height)
{
$prefix = rand(111111, 999999);
$newavatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $newavatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "The image is too big.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
if ($oldusername != $newusername)
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".mysqli_real_escape_string($db, $newusername)."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$error_message = 'Username already used. Please select another username.';
}
}
if (empty($error_message))
{
$crypt_pass = md5($newpassword);
$newusername = mysqli_real_escape_string($db, $newusername);
$newemail = mysqli_real_escape_string($db, $newemail);
$newfullname = mysqli_real_escape_string($db, $newfullname);
$extra1 = mysqli_real_escape_string($db, $extra1);
$extra2 = mysqli_real_escape_string($db, $extra2);
$extra3 = mysqli_real_escape_string($db, $extra3);
$extra4 = mysqli_real_escape_string($db, $extra4);
$extra5 = mysqli_real_escape_string($db, $extra5);
$extra6 = mysqli_real_escape_string($db, $extra6);
$extra7 = mysqli_real_escape_string($db, $extra7);
$extra8 = mysqli_real_escape_string($db, $extra8);
$extra9 = mysqli_real_escape_string($db, $extra9);
$extra10 = mysqli_real_escape_string($db, $extra10);
$extra11 = mysqli_real_escape_string($db, $extra11);
$extra12 = mysqli_real_escape_string($db, $extra12);
$extra13 = mysqli_real_escape_string($db, $extra13);
$sql = "UPDATE `".$mysql_table."` SET `username` = '$newusername', `fullname` = '$newfullname', `email` = '$newemail', `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11', `extra12` = '$extra12', `extra13` = '$extra13' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
if (!empty($newpassword))
{
$sql = "UPDATE `".$mysql_table."` SET `password` = '$crypt_pass' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
}
if (!empty($newavatar))
{
$sql = "UPDATE `".$mysql_table."` SET `avatar` = '$newavatar' WHERE `username` = '$oldusername'";
mysqli_query($db, $sql);
$_SESSION['avatar'] = "http://".$_SERVER['HTTP_HOST'] . "login_ppocc/avatars/" . $newavatar;
}
}
mysqli_close($db);
if (empty($error_message))
{
$_SESSION['username'] = $newusername;
$_SESSION['fullname'] = $newfullname;
header('Location: '.$success_page);
exit;
}
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$_SESSION['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$db_username = $data['username'];
$db_fullname = $data['fullname'];
$db_email = $data['email'];
$db_avatar = $data['avatar'];
$db_extra1 = $data['extra1'];
$db_extra2 = $data['extra2'];
$db_extra3 = $data['extra3'];
$db_extra4 = $data['extra4'];
$db_extra5 = $data['extra5'];
$db_extra6 = $data['extra6'];
$db_extra7 = $data['extra7'];
$db_extra8 = $data['extra8'];
$db_extra9 = $data['extra9'];
$db_extra10 = $data['extra10'];
$db_extra11 = $data['extra11'];
$db_extra12 = $data['extra12'];
$db_extra13 = $data['extra13'];
}
mysqli_close($db);
?>
Re: Edit Profile Error
I'm sorry, but where is currently the problem? In the admin or in edit profile?
Note that I cannot see anything by login into your the page.
I need all to know all settings and all generated code to be able to help you.
Did you edit the code?
Did it work before you converted it to a standard form?
Are there any errors in the PHP log on the server?
Note that I cannot see anything by login into your the page.
I need all to know all settings and all generated code to be able to help you.
Did you edit the code?
Did it work before you converted it to a standard form?
Are there any errors in the PHP log on the server?
Re: Edit Profile Error
Hi Pablo,
Spent the morning testing and re-testing both the admin and the edit profile tools and I think I have come up with a few things.
Question - Is there a limit on the number of custom fields you can add to Collection in the Admin panel? I can add up to 11 fields and the changes can be saved. Any more than that and none of the fields will update. Is this correct? If so, can more fields be added to it? I needed a total of 15 fields.
Convert to Form does not display the Avatar Photo no matter what I try. I did the basic edit profile with no changes. Before I goe crazy are you positive that the Avatar will display when converting to html? It works it I do not convert to html but I need two of the fields to be text areas. The standard text field is too small.
Thanks for your guidance!
Spent the morning testing and re-testing both the admin and the edit profile tools and I think I have come up with a few things.
Question - Is there a limit on the number of custom fields you can add to Collection in the Admin panel? I can add up to 11 fields and the changes can be saved. Any more than that and none of the fields will update. Is this correct? If so, can more fields be added to it? I needed a total of 15 fields.
Convert to Form does not display the Avatar Photo no matter what I try. I did the basic edit profile with no changes. Before I goe crazy are you positive that the Avatar will display when converting to html? It works it I do not convert to html but I need two of the fields to be text areas. The standard text field is too small.
Thanks for your guidance!
Re: Edit Profile Error
No, as long as you also updater the database when adding new fields.Is there a limit on the number of custom fields you can add to Collection in the Admin panel?
There currently no 'image place holder' when you convert it to a standard form. However the form will work and save the avatar. I will try to add this in the next update.Before I goe crazy are you positive that the Avatar will display when converting to html?
Re: Edit Profile Error
' No, as long as you also updater the database when adding new fields.'
I have matching fields in the database for all extra fields for a total of extra15. Is that what you mean? If so, it will not save over 11 extra fields.
' There currently no 'image place holder' when you convert it to a standard form. However the form will work and save the avatar. I will try to add this in the next update. '
That's what I thought it would display so the user knew what it was. I'll recheck if it will save a replacement avatar.
Thanks1
I have matching fields in the database for all extra fields for a total of extra15. Is that what you mean? If so, it will not save over 11 extra fields.
' There currently no 'image place holder' when you convert it to a standard form. However the form will work and save the avatar. I will try to add this in the next update. '
That's what I thought it would display so the user knew what it was. I'll recheck if it will save a replacement avatar.
Thanks1
Re: Edit Profile Error
Maybe there is a mistake somewhere in the code? or maybe the database has a limitation?I have matching fields in the database for all extra fields for a total of extra15. Is that what you mean? If so, it will not save over 11 extra fields.
I don't think WWB puts any limitations on the number of extra fields.
But as you are editing the code yourself you can also see this, right?
Re: Edit Profile Error
I can add information to all the 15 extra fields when I create a new user fine, so the database has the fields and does store them.Maybe there is a mistake somewhere in the code? or maybe the database has a limitation?
I don't think WWB puts any limitations on the number of extra fields.
But as you are editing the code yourself you can also see this, right? ''
In the admin panel I kept adding extra fields and testing them until I go to 12 extra fields, then it would not save any of the fields. When I reduced the fields back to 11 xtra fields it would save fine.
Since I cannot convert the Admin panel to html I cannot check the code.
I still feel that WWB could limit the number of extra fields. I thin at one time I read that the limit was 5 fields, but that could be what is added if you use the create a database and add the extra fields to the list.
Still confused here!
Re: Edit Profile Error
What is the PHP code of the admin script when it has 12 extra fields?
and what is the code when it has 15 fields?
and what is the code when it has 15 fields?
Re: Edit Profile Error
This is the source code with 15 fields:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #89BDD3;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #89BDD3;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 16px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 16px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #9AD3DE;
border: 1px solid #9AD3DE;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 16px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 16px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #9AD3DE;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #9AD3DE;
border-color: #9AD3DE;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<div class="container">
<form action="loginadmin.php" enctype="multipart/form-data" accept-charset="UTF-8" method="post">
<input name="action" type="hidden" value="update">
<input type="hidden" name="id" value="beth">
<label for="username">Username</label>
<input class="form-control" id="username" name="username" size="50" type="text" value="beth">
<label for="password">Password</label>
<input class="form-control" id="password" name="password" size="50" type="password" value="">
<label for="fullname">Fullname</label>
<input class="form-control" id="fullname" name="fullname" size="50" type="text" value="Mark OConnell3">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" size="50" type="text" value="info@whiteoconnellphoto.com">
<label for="role">Role</label>
<select class="form-control" id="role" name="role" size="1">
<option value="Administrator" >Administrator</option>
<option value="Member" selected>Member</option>
<option value="Guest" >Guest</option>
</select>
<label for="avatar">Avatar</label>
<div class="input-group" id="avatar"><input class="form-control" type="text" readonly="" value="441991_DMargaretosPhoto2018.jpg"><label class="input-group-btn"><input type="file" name="avatar" style="display:none;"><span class="btn">Browse...</span></label></div>
<div class="thumbnail"><div class="frame"><img alt="441991_DMargaretosPhoto2018.jpg" src="avatars/441991_DMargaretosPhoto2018.jpg"></div></div>
<label for="extra1">Studio Name</label>
<input class="form-control" id="extra1" name="extra1" size="50" type="text" value="Beths Photos2">
<label for="extra2">Contact Name</label>
<input class="form-control" id="extra2" name="extra2" size="50" type="text" value="Beth">
<label for="extra3">Address</label>
<input class="form-control" id="extra3" name="extra3" size="50" type="text" value="123 Bay St">
<label for="extra4">City</label>
<input class="form-control" id="extra4" name="extra4" size="50" type="text" value="Pembroke">
<label for="extra5">State</label>
<input class="form-control" id="extra5" name="extra5" size="50" type="text" value="Massachusetts">
<label for="extra6">Zip</label>
<input class="form-control" id="extra6" name="extra6" size="50" type="text" value="02359">
<label for="extra7">Business Phone 1</label>
<input class="form-control" id="extra7" name="extra7" size="50" type="text" value="781-826-81189">
<label for="extra8">Business Phone 2</label>
<input class="form-control" id="extra8" name="extra8" size="50" type="text" value="123-456-7899">
<label for="extra9">Home Phone - will not be on Referral Page</label>
<input class="form-control" id="extra9" name="extra9" size="50" type="text" value="617-852-2365">
<label for="extra10">Cell Phone - will not be on Referral Page</label>
<input class="form-control" id="extra10" name="extra10" size="50" type="text" value="508-822-1557">
<label for="extra11">Specialities - What services do you offer?</label>
<input class="form-control" id="extra11" name="extra11" size="50" type="text" value="test8 Families, Children, High School Seniors, Headshots, School Proms, Events, Glamour, PR and Corporate, Pets, Black and White, Painterly Portraits">
<label for="extra12">Description - Add something informative to prospective clients</label>
<input class="form-control" id="extra12" name="extra12" size="50" type="text" value="We are a low volume-high quality photography studio and gallery, located in a historic antique colonial with a beautifully landscaped outdoor park. Here we create relaxed, natural portraits both indoors and outdoors.Our work is available on fine art canvas,watercolor paper, or classic lustre finish, all in color, black and white or antique sepia. We pride ourselves on the reputation we've earned in the last thirty years with both our photography AND our customer service Just ask anyone we've ever worked with.Photography by Susan White & Mark O'Connell . . . . . . anything else is just a compromise ">
<label for="extra13">Web Address</label>
<input class="form-control" id="extra13" name="extra13" size="50" type="text" value="http://www.headshotsma.com">
<label for="extra14">Current Member (yes/no)</label>
<input class="form-control" id="extra14" name="extra14" size="50" type="text" value="">
<label for="extra15">Website Ad (yes/no)</label>
<input class="form-control" id="extra15" name="extra15" size="50" type="text" value="">
<label for="active">Status</label>
<select class="form-control" name="active" size="1"><option value="0">inactive</option><option selected value="1">active</option></select>
<input class="btn" type="submit" name="cmdSubmit" value="Save"> <input class="btn" name="cmdBack" type="button" value="Cancel" onclick="location.href='loginadmin.php'">
</form>
</div>
</body>
</html>
----------------------------------------------------------
This is the source code with 11 fields:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #337AB7;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #337AB7;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 13px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 13px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #337AB7;
border: 1px solid #2E6DA4;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 13px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 13px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #337AB7;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #337AB7;
border-color: #337AB7;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<div class="container">
<form action="loginadmin.php" enctype="multipart/form-data" accept-charset="UTF-8" method="post">
<input name="action" type="hidden" value="update">
<input type="hidden" name="id" value="beth">
<label for="username">Username</label>
<input class="form-control" id="username" name="username" size="50" type="text" value="beth">
<label for="password">Password</label>
<input class="form-control" id="password" name="password" size="50" type="password" value="">
<label for="fullname">Fullname</label>
<input class="form-control" id="fullname" name="fullname" size="50" type="text" value="Mark OConnell3">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" size="50" type="text" value="info@whiteoconnellphoto.com">
<label for="role">Role</label>
<select class="form-control" id="role" name="role" size="1">
<option value="Administrator" >Administrator</option>
<option value="Member" selected>Member</option>
<option value="Guest" >Guest</option>
</select>
<label for="avatar">Avatar</label>
<div class="input-group" id="avatar"><input class="form-control" type="text" readonly="" value="441991_DMargaretosPhoto2018.jpg"><label class="input-group-btn"><input type="file" name="avatar" style="display:none;"><span class="btn">Browse...</span></label></div>
<div class="thumbnail"><div class="frame"><img alt="441991_DMargaretosPhoto2018.jpg" src="avatars/441991_DMargaretosPhoto2018.jpg"></div></div>
<label for="extra1">Studio Name</label>
<input class="form-control" id="extra1" name="extra1" size="50" type="text" value="Beths Photos2">
<label for="extra2">Contact Name</label>
<input class="form-control" id="extra2" name="extra2" size="50" type="text" value="Beth">
<label for="extra3">Address</label>
<input class="form-control" id="extra3" name="extra3" size="50" type="text" value="123 Bay St">
<label for="extra4">City</label>
<input class="form-control" id="extra4" name="extra4" size="50" type="text" value="Pembroke">
<label for="extra5">State</label>
<input class="form-control" id="extra5" name="extra5" size="50" type="text" value="Massachusetts">
<label for="extra6">Zip Code</label>
<input class="form-control" id="extra6" name="extra6" size="50" type="text" value="02359">
<label for="extra7">Business Phone 1</label>
<input class="form-control" id="extra7" name="extra7" size="50" type="text" value="781-826-81189">
<label for="extra8">Business Phone 2</label>
<input class="form-control" id="extra8" name="extra8" size="50" type="text" value="123-456-7899">
<label for="extra9">Home Phone - Will NOT Display on Referral Page</label>
<input class="form-control" id="extra9" name="extra9" size="50" type="text" value="617-852-2365">
<label for="extra10">Cell Phone - Will NOT Display on Referral Page</label>
<input class="form-control" id="extra10" name="extra10" size="50" type="text" value="508-822-1557">
<label for="extra11">Specialities</label>
<input class="form-control" id="extra11" name="extra11" size="50" type="text" value="test8 Families, Children, High School Seniors, Headshots, School Proms, Events, Glamour, PR and Corporate, Pets, Black and White, Painterly Portraits">
<label for="active">Status</label>
<select class="form-control" name="active" size="1"><option value="0">inactive</option><option selected value="1">active</option></select>
<input class="btn" type="submit" name="cmdSubmit" value="Save"> <input class="btn" name="cmdBack" type="button" value="Cancel" onclick="location.href='loginadmin.php'">
</form>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #89BDD3;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #89BDD3;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 16px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 16px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #9AD3DE;
border: 1px solid #9AD3DE;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 16px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 16px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #9AD3DE;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #9AD3DE;
border-color: #9AD3DE;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<div class="container">
<form action="loginadmin.php" enctype="multipart/form-data" accept-charset="UTF-8" method="post">
<input name="action" type="hidden" value="update">
<input type="hidden" name="id" value="beth">
<label for="username">Username</label>
<input class="form-control" id="username" name="username" size="50" type="text" value="beth">
<label for="password">Password</label>
<input class="form-control" id="password" name="password" size="50" type="password" value="">
<label for="fullname">Fullname</label>
<input class="form-control" id="fullname" name="fullname" size="50" type="text" value="Mark OConnell3">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" size="50" type="text" value="info@whiteoconnellphoto.com">
<label for="role">Role</label>
<select class="form-control" id="role" name="role" size="1">
<option value="Administrator" >Administrator</option>
<option value="Member" selected>Member</option>
<option value="Guest" >Guest</option>
</select>
<label for="avatar">Avatar</label>
<div class="input-group" id="avatar"><input class="form-control" type="text" readonly="" value="441991_DMargaretosPhoto2018.jpg"><label class="input-group-btn"><input type="file" name="avatar" style="display:none;"><span class="btn">Browse...</span></label></div>
<div class="thumbnail"><div class="frame"><img alt="441991_DMargaretosPhoto2018.jpg" src="avatars/441991_DMargaretosPhoto2018.jpg"></div></div>
<label for="extra1">Studio Name</label>
<input class="form-control" id="extra1" name="extra1" size="50" type="text" value="Beths Photos2">
<label for="extra2">Contact Name</label>
<input class="form-control" id="extra2" name="extra2" size="50" type="text" value="Beth">
<label for="extra3">Address</label>
<input class="form-control" id="extra3" name="extra3" size="50" type="text" value="123 Bay St">
<label for="extra4">City</label>
<input class="form-control" id="extra4" name="extra4" size="50" type="text" value="Pembroke">
<label for="extra5">State</label>
<input class="form-control" id="extra5" name="extra5" size="50" type="text" value="Massachusetts">
<label for="extra6">Zip</label>
<input class="form-control" id="extra6" name="extra6" size="50" type="text" value="02359">
<label for="extra7">Business Phone 1</label>
<input class="form-control" id="extra7" name="extra7" size="50" type="text" value="781-826-81189">
<label for="extra8">Business Phone 2</label>
<input class="form-control" id="extra8" name="extra8" size="50" type="text" value="123-456-7899">
<label for="extra9">Home Phone - will not be on Referral Page</label>
<input class="form-control" id="extra9" name="extra9" size="50" type="text" value="617-852-2365">
<label for="extra10">Cell Phone - will not be on Referral Page</label>
<input class="form-control" id="extra10" name="extra10" size="50" type="text" value="508-822-1557">
<label for="extra11">Specialities - What services do you offer?</label>
<input class="form-control" id="extra11" name="extra11" size="50" type="text" value="test8 Families, Children, High School Seniors, Headshots, School Proms, Events, Glamour, PR and Corporate, Pets, Black and White, Painterly Portraits">
<label for="extra12">Description - Add something informative to prospective clients</label>
<input class="form-control" id="extra12" name="extra12" size="50" type="text" value="We are a low volume-high quality photography studio and gallery, located in a historic antique colonial with a beautifully landscaped outdoor park. Here we create relaxed, natural portraits both indoors and outdoors.Our work is available on fine art canvas,watercolor paper, or classic lustre finish, all in color, black and white or antique sepia. We pride ourselves on the reputation we've earned in the last thirty years with both our photography AND our customer service Just ask anyone we've ever worked with.Photography by Susan White & Mark O'Connell . . . . . . anything else is just a compromise ">
<label for="extra13">Web Address</label>
<input class="form-control" id="extra13" name="extra13" size="50" type="text" value="http://www.headshotsma.com">
<label for="extra14">Current Member (yes/no)</label>
<input class="form-control" id="extra14" name="extra14" size="50" type="text" value="">
<label for="extra15">Website Ad (yes/no)</label>
<input class="form-control" id="extra15" name="extra15" size="50" type="text" value="">
<label for="active">Status</label>
<select class="form-control" name="active" size="1"><option value="0">inactive</option><option selected value="1">active</option></select>
<input class="btn" type="submit" name="cmdSubmit" value="Save"> <input class="btn" name="cmdBack" type="button" value="Cancel" onclick="location.href='loginadmin.php'">
</form>
</div>
</body>
</html>
----------------------------------------------------------
This is the source code with 11 fields:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #337AB7;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #337AB7;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 13px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 13px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #337AB7;
border: 1px solid #2E6DA4;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 13px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 13px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #337AB7;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #337AB7;
border-color: #337AB7;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<div class="container">
<form action="loginadmin.php" enctype="multipart/form-data" accept-charset="UTF-8" method="post">
<input name="action" type="hidden" value="update">
<input type="hidden" name="id" value="beth">
<label for="username">Username</label>
<input class="form-control" id="username" name="username" size="50" type="text" value="beth">
<label for="password">Password</label>
<input class="form-control" id="password" name="password" size="50" type="password" value="">
<label for="fullname">Fullname</label>
<input class="form-control" id="fullname" name="fullname" size="50" type="text" value="Mark OConnell3">
<label for="email">Email</label>
<input class="form-control" id="email" name="email" size="50" type="text" value="info@whiteoconnellphoto.com">
<label for="role">Role</label>
<select class="form-control" id="role" name="role" size="1">
<option value="Administrator" >Administrator</option>
<option value="Member" selected>Member</option>
<option value="Guest" >Guest</option>
</select>
<label for="avatar">Avatar</label>
<div class="input-group" id="avatar"><input class="form-control" type="text" readonly="" value="441991_DMargaretosPhoto2018.jpg"><label class="input-group-btn"><input type="file" name="avatar" style="display:none;"><span class="btn">Browse...</span></label></div>
<div class="thumbnail"><div class="frame"><img alt="441991_DMargaretosPhoto2018.jpg" src="avatars/441991_DMargaretosPhoto2018.jpg"></div></div>
<label for="extra1">Studio Name</label>
<input class="form-control" id="extra1" name="extra1" size="50" type="text" value="Beths Photos2">
<label for="extra2">Contact Name</label>
<input class="form-control" id="extra2" name="extra2" size="50" type="text" value="Beth">
<label for="extra3">Address</label>
<input class="form-control" id="extra3" name="extra3" size="50" type="text" value="123 Bay St">
<label for="extra4">City</label>
<input class="form-control" id="extra4" name="extra4" size="50" type="text" value="Pembroke">
<label for="extra5">State</label>
<input class="form-control" id="extra5" name="extra5" size="50" type="text" value="Massachusetts">
<label for="extra6">Zip Code</label>
<input class="form-control" id="extra6" name="extra6" size="50" type="text" value="02359">
<label for="extra7">Business Phone 1</label>
<input class="form-control" id="extra7" name="extra7" size="50" type="text" value="781-826-81189">
<label for="extra8">Business Phone 2</label>
<input class="form-control" id="extra8" name="extra8" size="50" type="text" value="123-456-7899">
<label for="extra9">Home Phone - Will NOT Display on Referral Page</label>
<input class="form-control" id="extra9" name="extra9" size="50" type="text" value="617-852-2365">
<label for="extra10">Cell Phone - Will NOT Display on Referral Page</label>
<input class="form-control" id="extra10" name="extra10" size="50" type="text" value="508-822-1557">
<label for="extra11">Specialities</label>
<input class="form-control" id="extra11" name="extra11" size="50" type="text" value="test8 Families, Children, High School Seniors, Headshots, School Proms, Events, Glamour, PR and Corporate, Pets, Black and White, Painterly Portraits">
<label for="active">Status</label>
<select class="form-control" name="active" size="1"><option value="0">inactive</option><option selected value="1">active</option></select>
<input class="btn" type="submit" name="cmdSubmit" value="Save"> <input class="btn" name="cmdBack" type="button" value="Cancel" onclick="location.href='loginadmin.php'">
</form>
</div>
</body>
</html>
Re: Edit Profile Error
I'm sorry, but this is not the PHP code of the page. This is the HTML only.
Re: Edit Profile Error
How do I get the php code?
Re: Edit Profile Error
The PHP code is the code in the 'loginadmin.php' file.
Re: Edit Profile Error
HERE IS THE PHP from loginadmin.php with 11 extra fields:
<?php
session_start();
error_reporting(0);
define('ADMIN_PASS', 'eebc2fc1499d5f49c6348cd31608567b');
$session_timeout = 600;
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$admin_password = isset($_COOKIE['admin_password']) ? $_COOKIE['admin_password'] : '';
if (empty($admin_password))
{
if (isset($_POST['admin_password']))
{
$admin_password = md5($_POST['admin_password']);
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
}
}
else
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$active = isset($_POST['active']) ? $_POST['active'] : 0;
$role = isset($_POST['role']) ? $_POST['role'] : '';
$extra1 = isset($_POST['extra1']) ? $_POST['extra1'] : '';
$extra2 = isset($_POST['extra2']) ? $_POST['extra2'] : '';
$extra3 = isset($_POST['extra3']) ? $_POST['extra3'] : '';
$extra4 = isset($_POST['extra4']) ? $_POST['extra4'] : '';
$extra5 = isset($_POST['extra5']) ? $_POST['extra5'] : '';
$extra6 = isset($_POST['extra6']) ? $_POST['extra6'] : '';
$extra7 = isset($_POST['extra7']) ? $_POST['extra7'] : '';
$extra8 = isset($_POST['extra8']) ? $_POST['extra8'] : '';
$extra9 = isset($_POST['extra9']) ? $_POST['extra9'] : '';
$extra10 = isset($_POST['extra10']) ? $_POST['extra10'] : '';
$extra11 = isset($_POST['extra11']) ? $_POST['extra11'] : '';
$avatar_folder = 'avatars';
$avatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
$error_message = '';
if (!file_exists($avatar_folder))
{
if (!mkdir($avatar_folder, 0777))
{
die("Failed to create images directory.");
}
}
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
$prefix = rand(111111, 999999);
$avatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $avatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
if ($error_message != '')
{
die($error_message);
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
mysqli_query($db, 'SET NAMES "UTF8"');
mysqli_query($db, "SET collation_connection='utf8_general_ci'");
mysqli_query($db, "SET collation_server='utf8_general_ci'");
mysqli_query($db, "SET character_set_client='utf8'");
mysqli_query($db, "SET character_set_connection='utf8'");
mysqli_query($db, "SET character_set_results='utf8'");
mysqli_query($db, "SET character_set_server='utf8'");
if (!empty($action))
{
if ($action == 'delete')
{
$sql = "DELETE FROM ".$mysql_table." WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'update')
{
$sql = "UPDATE `".$mysql_table."` SET `username` = '$username', ";
if (!empty($_POST['password']))
{
$crypt_pass = md5($_POST['password']);
$sql = $sql . "`password` = '$crypt_pass',";
}
if (!empty($avatar))
{
$sql = $sql . "`avatar` = '$avatar',";
}
$sql = $sql . " `fullname` = '$fullname', `email` = '$email', `role` = '$role', `active` = $active, `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11' WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'create')
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
echo 'User already exists!';
exit;
}
$crypt_pass = md5($_POST['password']);
$avatar_column = '';
$avatar_value = '';
if (!empty($avatar))
{
$avatar_column = ", `avatar`";
$avatar_value = ", '$avatar'";
}
$sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `role`, `active`, `extra1`, `extra2`, `extra3`, `extra4`, `extra5`, `extra6`, `extra7`, `extra8`, `extra9`, `extra10`, `extra11`$avatar_column) VALUES ('$username', '$crypt_pass', '$fullname', '$email', '$role', $active, '$extra1', '$extra2', '$extra3', '$extra4', '$extra5', '$extra6', '$extra7', '$extra8', '$extra9', '$extra10', '$extra11'$avatar_value)";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'logout')
{
session_unset();
session_destroy();
setcookie('admin_password', '', time() - 3600);
header('Location: '.basename(__FILE__));
exit;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #337AB7;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #337AB7;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 13px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 13px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #337AB7;
border: 1px solid #2E6DA4;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 13px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 13px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #337AB7;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #337AB7;
border-color: #337AB7;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<?php
if ($admin_password != ADMIN_PASS)
{
echo "<div class=\"container\" style=\"text-align:center\">\n";
echo "<h2>User Administrator</h2>\n";
echo "<form method=\"post\" accept-charset=\"UTF-8\" action=\"" .basename(__FILE__) . "\">\n";
echo "<input class=\"form-control\" type=\"password\" name=\"admin_password\" size=\"20\" />\n";
echo "<input class=\"btn\" type=\"submit\" value=\"Login\" name=\"submit\" />\n";
echo "</form>\n";
echo "</div>\n";
}
else
{
if (!empty($action))
{
if (($action == 'edit') || ($action == 'new'))
{
$username_value = '';
$fullname_value = '';
$email_value = '';
$active_value = '';
$avatar_value = '';
$role_value = '';
$extra1_value = '';
$extra2_value = '';
$extra3_value = '';
$extra4_value = '';
$extra5_value = '';
$extra6_value = '';
$extra7_value = '';
$extra8_value = '';
$extra9_value = '';
$extra10_value = '';
$extra11_value = '';
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$id."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$username_value = $data['username'];
$fullname_value = $data['fullname'];
$email_value = $data['email'];
$active_value = $data['active'];
$avatar_value = $data['avatar'];
$role_value = $data['role'];
$extra1_value = $data['extra1'];
$extra2_value = $data['extra2'];
$extra3_value = $data['extra3'];
$extra4_value = $data['extra4'];
$extra5_value = $data['extra5'];
$extra6_value = $data['extra6'];
$extra7_value = $data['extra7'];
$extra8_value = $data['extra8'];
$extra9_value = $data['extra9'];
$extra10_value = $data['extra10'];
$extra11_value = $data['extra11'];
}
echo "<div class=\"container\">\n";
echo "<form action=\"" . basename(__FILE__) . "\" enctype=\"multipart/form-data\" accept-charset=\"UTF-8\" method=\"post\">\n";
if ($action == 'new')
{
echo "<input name=\"action\" type=\"hidden\" value=\"create\">\n";
}
else
{
echo "<input name=\"action\" type=\"hidden\" value=\"update\">\n";
}
echo "<input type=\"hidden\" name=\"id\" value=\"". $id . "\">\n";
echo "<label for=\"username\">Username</label>\n";
echo "<input class=\"form-control\" id=\"username\" name=\"username\" size=\"50\" type=\"text\" value=\"" . $username_value . "\">\n";
echo "<label for=\"password\">Password</label>\n";
echo "<input class=\"form-control\" id=\"password\" name=\"password\" size=\"50\" type=\"password\" value=\"\">\n";
echo "<label for=\"fullname\">Fullname</label>\n";
echo "<input class=\"form-control\" id=\"fullname\" name=\"fullname\" size=\"50\" type=\"text\" value=\"" . $fullname_value . "\">\n";
echo "<label for=\"email\">Email</label>\n";
echo "<input class=\"form-control\" id=\"email\" name=\"email\" size=\"50\" type=\"text\" value=\"" . $email_value . "\">\n";
echo "<label for=\"role\">Role</label>\n";
echo "<select class=\"form-control\" id=\"role\" name=\"role\" size=\"1\">\n";
$roles = array("Administrator","Member","Guest");
for ($i=0; $i<count($roles); $i++)
{
$selected = ($roles[$i] == $role_value) ? "selected" : "";
echo "<option value=\"$roles[$i]\" $selected>$roles[$i]</option>\n";
}
echo "</select>\n";
echo "<label for=\"avatar\">Avatar</label>\n";
echo "<div class=\"input-group\" id=\"avatar\"><input class=\"form-control\" type=\"text\" readonly=\"\" value=\"$avatar_value\"><label class=\"input-group-btn\"><input type=\"file\" name=\"avatar\" style=\"display:none;\"><span class=\"btn\">Browse...</span></label></div>\n";
if (!empty($avatar_value))
{
echo "<div class=\"thumbnail\"><div class=\"frame\"><img alt=\"$avatar_value\" src=\"$avatar_folder/$avatar_value\"></div></div>\n";
}
echo "<label for=\"extra1\">Studio Name</label>\n";
echo "<input class=\"form-control\" id=\"extra1\" name=\"extra1\" size=\"50\" type=\"text\" value=\"" . $extra1_value . "\">\n";
echo "<label for=\"extra2\">Contact Name</label>\n";
echo "<input class=\"form-control\" id=\"extra2\" name=\"extra2\" size=\"50\" type=\"text\" value=\"" . $extra2_value . "\">\n";
echo "<label for=\"extra3\">Address</label>\n";
echo "<input class=\"form-control\" id=\"extra3\" name=\"extra3\" size=\"50\" type=\"text\" value=\"" . $extra3_value . "\">\n";
echo "<label for=\"extra4\">City</label>\n";
echo "<input class=\"form-control\" id=\"extra4\" name=\"extra4\" size=\"50\" type=\"text\" value=\"" . $extra4_value . "\">\n";
echo "<label for=\"extra5\">State</label>\n";
echo "<input class=\"form-control\" id=\"extra5\" name=\"extra5\" size=\"50\" type=\"text\" value=\"" . $extra5_value . "\">\n";
echo "<label for=\"extra6\">Zip Code</label>\n";
echo "<input class=\"form-control\" id=\"extra6\" name=\"extra6\" size=\"50\" type=\"text\" value=\"" . $extra6_value . "\">\n";
echo "<label for=\"extra7\">Business Phone 1</label>\n";
echo "<input class=\"form-control\" id=\"extra7\" name=\"extra7\" size=\"50\" type=\"text\" value=\"" . $extra7_value . "\">\n";
echo "<label for=\"extra8\">Business Phone 2</label>\n";
echo "<input class=\"form-control\" id=\"extra8\" name=\"extra8\" size=\"50\" type=\"text\" value=\"" . $extra8_value . "\">\n";
echo "<label for=\"extra9\">Home Phone - Will NOT Display on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra9\" name=\"extra9\" size=\"50\" type=\"text\" value=\"" . $extra9_value . "\">\n";
echo "<label for=\"extra10\">Cell Phone - Will NOT Display on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra10\" name=\"extra10\" size=\"50\" type=\"text\" value=\"" . $extra10_value . "\">\n";
echo "<label for=\"extra11\">Specialities</label>\n";
echo "<input class=\"form-control\" id=\"extra11\" name=\"extra11\" size=\"50\" type=\"text\" value=\"" . $extra11_value . "\">\n";
echo "<label for=\"active\">Status</label>\n";
echo "<select class=\"form-control\" name=\"active\" size=\"1\"><option " . ($active_value == "0" ? "selected " : "") . "value=\"0\">inactive</option><option " . ($active_value != "0" ? "selected " : "") . "value=\"1\">active</option></select>\n";
echo "<input class=\"btn\" type=\"submit\" name=\"cmdSubmit\" value=\"Save\">";
echo " ";
echo "<input class=\"btn\" name=\"cmdBack\" type=\"button\" value=\"Cancel\" onclick=\"location.href='" . basename(__FILE__) . "'\">\n";
echo "</form>\n";
echo "</div>\n";
}
}
else
{
echo "<div id=\"header\"><a class=\"btn\" href=\"" . basename(__FILE__) . "?action=new\">New User</a> <a class=\"btn\" href=\"" . basename(__FILE__) . "?action=logout\">Logout</a>\n";
echo "<div id=\"filter\">\n";
echo "<label>Search: </label> <input class=\"form-control\" placeholder=\"\" type=\"search\">\n";
echo "</div>\n</div>\n";
echo "<table class=\"table table-striped table-hover\">\n";
echo "<thead><tr><th>Username</th><th>Fullname</th><th>Email</th><th>Status</th><th>Action</th></tr></thead>\n";
echo "<tbody>\n";
$sql = "SELECT * FROM ".$mysql_table;
$result = mysqli_query($db, $sql);
while ($data = mysqli_fetch_array($result))
{
echo "<tr>\n";
echo "<td>" . $data['username'] . "</td>\n";
echo "<td>" . $data['fullname'] . "</td>\n";
echo "<td>" . $data['email'] . "</td>\n";
echo "<td>" . ($data['active'] == "0" ? "inactive" : "active") . "</td>\n";
echo "<td>\n";
echo " <a href=\"" . basename(__FILE__) . "?action=edit&id=" . $data['username'] . "\" title=\"Edit\"><i class=\"icon-edit\"></i></a> \n";
echo " <a href=\"" . basename(__FILE__) . "?action=delete&id=" . $data['username'] . "\" title=\"Delete\"><i class=\"icon-delete\"></i></a>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
echo "<div id=\"footer\">\n";
echo "<ul id=\"pagination\">\n";
echo "<li class=\"disabled\"><a href=\"#\">« Prev</a></li>\n";
echo "<li class=\"disabled\"><a href=\"#\">Next »</a></li>\n";
echo "</ul>\n";
echo "</div>\n";
}
}
?>
</body>
</html>
<?php
session_start();
error_reporting(0);
define('ADMIN_PASS', 'eebc2fc1499d5f49c6348cd31608567b');
$session_timeout = 600;
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$admin_password = isset($_COOKIE['admin_password']) ? $_COOKIE['admin_password'] : '';
if (empty($admin_password))
{
if (isset($_POST['admin_password']))
{
$admin_password = md5($_POST['admin_password']);
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
}
}
else
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$active = isset($_POST['active']) ? $_POST['active'] : 0;
$role = isset($_POST['role']) ? $_POST['role'] : '';
$extra1 = isset($_POST['extra1']) ? $_POST['extra1'] : '';
$extra2 = isset($_POST['extra2']) ? $_POST['extra2'] : '';
$extra3 = isset($_POST['extra3']) ? $_POST['extra3'] : '';
$extra4 = isset($_POST['extra4']) ? $_POST['extra4'] : '';
$extra5 = isset($_POST['extra5']) ? $_POST['extra5'] : '';
$extra6 = isset($_POST['extra6']) ? $_POST['extra6'] : '';
$extra7 = isset($_POST['extra7']) ? $_POST['extra7'] : '';
$extra8 = isset($_POST['extra8']) ? $_POST['extra8'] : '';
$extra9 = isset($_POST['extra9']) ? $_POST['extra9'] : '';
$extra10 = isset($_POST['extra10']) ? $_POST['extra10'] : '';
$extra11 = isset($_POST['extra11']) ? $_POST['extra11'] : '';
$avatar_folder = 'avatars';
$avatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
$error_message = '';
if (!file_exists($avatar_folder))
{
if (!mkdir($avatar_folder, 0777))
{
die("Failed to create images directory.");
}
}
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
$prefix = rand(111111, 999999);
$avatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $avatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
if ($error_message != '')
{
die($error_message);
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
mysqli_query($db, 'SET NAMES "UTF8"');
mysqli_query($db, "SET collation_connection='utf8_general_ci'");
mysqli_query($db, "SET collation_server='utf8_general_ci'");
mysqli_query($db, "SET character_set_client='utf8'");
mysqli_query($db, "SET character_set_connection='utf8'");
mysqli_query($db, "SET character_set_results='utf8'");
mysqli_query($db, "SET character_set_server='utf8'");
if (!empty($action))
{
if ($action == 'delete')
{
$sql = "DELETE FROM ".$mysql_table." WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'update')
{
$sql = "UPDATE `".$mysql_table."` SET `username` = '$username', ";
if (!empty($_POST['password']))
{
$crypt_pass = md5($_POST['password']);
$sql = $sql . "`password` = '$crypt_pass',";
}
if (!empty($avatar))
{
$sql = $sql . "`avatar` = '$avatar',";
}
$sql = $sql . " `fullname` = '$fullname', `email` = '$email', `role` = '$role', `active` = $active, `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11' WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'create')
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
echo 'User already exists!';
exit;
}
$crypt_pass = md5($_POST['password']);
$avatar_column = '';
$avatar_value = '';
if (!empty($avatar))
{
$avatar_column = ", `avatar`";
$avatar_value = ", '$avatar'";
}
$sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `role`, `active`, `extra1`, `extra2`, `extra3`, `extra4`, `extra5`, `extra6`, `extra7`, `extra8`, `extra9`, `extra10`, `extra11`$avatar_column) VALUES ('$username', '$crypt_pass', '$fullname', '$email', '$role', $active, '$extra1', '$extra2', '$extra3', '$extra4', '$extra5', '$extra6', '$extra7', '$extra8', '$extra9', '$extra10', '$extra11'$avatar_value)";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'logout')
{
session_unset();
session_destroy();
setcookie('admin_password', '', time() - 3600);
header('Location: '.basename(__FILE__));
exit;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #337AB7;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 13px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #337AB7;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 13px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 13px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #337AB7;
border: 1px solid #2E6DA4;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 13px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 13px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #337AB7;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #337AB7;
border-color: #337AB7;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 13px;
height: 13px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2213%22%20width%3D%2213%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0073%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<?php
if ($admin_password != ADMIN_PASS)
{
echo "<div class=\"container\" style=\"text-align:center\">\n";
echo "<h2>User Administrator</h2>\n";
echo "<form method=\"post\" accept-charset=\"UTF-8\" action=\"" .basename(__FILE__) . "\">\n";
echo "<input class=\"form-control\" type=\"password\" name=\"admin_password\" size=\"20\" />\n";
echo "<input class=\"btn\" type=\"submit\" value=\"Login\" name=\"submit\" />\n";
echo "</form>\n";
echo "</div>\n";
}
else
{
if (!empty($action))
{
if (($action == 'edit') || ($action == 'new'))
{
$username_value = '';
$fullname_value = '';
$email_value = '';
$active_value = '';
$avatar_value = '';
$role_value = '';
$extra1_value = '';
$extra2_value = '';
$extra3_value = '';
$extra4_value = '';
$extra5_value = '';
$extra6_value = '';
$extra7_value = '';
$extra8_value = '';
$extra9_value = '';
$extra10_value = '';
$extra11_value = '';
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$id."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$username_value = $data['username'];
$fullname_value = $data['fullname'];
$email_value = $data['email'];
$active_value = $data['active'];
$avatar_value = $data['avatar'];
$role_value = $data['role'];
$extra1_value = $data['extra1'];
$extra2_value = $data['extra2'];
$extra3_value = $data['extra3'];
$extra4_value = $data['extra4'];
$extra5_value = $data['extra5'];
$extra6_value = $data['extra6'];
$extra7_value = $data['extra7'];
$extra8_value = $data['extra8'];
$extra9_value = $data['extra9'];
$extra10_value = $data['extra10'];
$extra11_value = $data['extra11'];
}
echo "<div class=\"container\">\n";
echo "<form action=\"" . basename(__FILE__) . "\" enctype=\"multipart/form-data\" accept-charset=\"UTF-8\" method=\"post\">\n";
if ($action == 'new')
{
echo "<input name=\"action\" type=\"hidden\" value=\"create\">\n";
}
else
{
echo "<input name=\"action\" type=\"hidden\" value=\"update\">\n";
}
echo "<input type=\"hidden\" name=\"id\" value=\"". $id . "\">\n";
echo "<label for=\"username\">Username</label>\n";
echo "<input class=\"form-control\" id=\"username\" name=\"username\" size=\"50\" type=\"text\" value=\"" . $username_value . "\">\n";
echo "<label for=\"password\">Password</label>\n";
echo "<input class=\"form-control\" id=\"password\" name=\"password\" size=\"50\" type=\"password\" value=\"\">\n";
echo "<label for=\"fullname\">Fullname</label>\n";
echo "<input class=\"form-control\" id=\"fullname\" name=\"fullname\" size=\"50\" type=\"text\" value=\"" . $fullname_value . "\">\n";
echo "<label for=\"email\">Email</label>\n";
echo "<input class=\"form-control\" id=\"email\" name=\"email\" size=\"50\" type=\"text\" value=\"" . $email_value . "\">\n";
echo "<label for=\"role\">Role</label>\n";
echo "<select class=\"form-control\" id=\"role\" name=\"role\" size=\"1\">\n";
$roles = array("Administrator","Member","Guest");
for ($i=0; $i<count($roles); $i++)
{
$selected = ($roles[$i] == $role_value) ? "selected" : "";
echo "<option value=\"$roles[$i]\" $selected>$roles[$i]</option>\n";
}
echo "</select>\n";
echo "<label for=\"avatar\">Avatar</label>\n";
echo "<div class=\"input-group\" id=\"avatar\"><input class=\"form-control\" type=\"text\" readonly=\"\" value=\"$avatar_value\"><label class=\"input-group-btn\"><input type=\"file\" name=\"avatar\" style=\"display:none;\"><span class=\"btn\">Browse...</span></label></div>\n";
if (!empty($avatar_value))
{
echo "<div class=\"thumbnail\"><div class=\"frame\"><img alt=\"$avatar_value\" src=\"$avatar_folder/$avatar_value\"></div></div>\n";
}
echo "<label for=\"extra1\">Studio Name</label>\n";
echo "<input class=\"form-control\" id=\"extra1\" name=\"extra1\" size=\"50\" type=\"text\" value=\"" . $extra1_value . "\">\n";
echo "<label for=\"extra2\">Contact Name</label>\n";
echo "<input class=\"form-control\" id=\"extra2\" name=\"extra2\" size=\"50\" type=\"text\" value=\"" . $extra2_value . "\">\n";
echo "<label for=\"extra3\">Address</label>\n";
echo "<input class=\"form-control\" id=\"extra3\" name=\"extra3\" size=\"50\" type=\"text\" value=\"" . $extra3_value . "\">\n";
echo "<label for=\"extra4\">City</label>\n";
echo "<input class=\"form-control\" id=\"extra4\" name=\"extra4\" size=\"50\" type=\"text\" value=\"" . $extra4_value . "\">\n";
echo "<label for=\"extra5\">State</label>\n";
echo "<input class=\"form-control\" id=\"extra5\" name=\"extra5\" size=\"50\" type=\"text\" value=\"" . $extra5_value . "\">\n";
echo "<label for=\"extra6\">Zip Code</label>\n";
echo "<input class=\"form-control\" id=\"extra6\" name=\"extra6\" size=\"50\" type=\"text\" value=\"" . $extra6_value . "\">\n";
echo "<label for=\"extra7\">Business Phone 1</label>\n";
echo "<input class=\"form-control\" id=\"extra7\" name=\"extra7\" size=\"50\" type=\"text\" value=\"" . $extra7_value . "\">\n";
echo "<label for=\"extra8\">Business Phone 2</label>\n";
echo "<input class=\"form-control\" id=\"extra8\" name=\"extra8\" size=\"50\" type=\"text\" value=\"" . $extra8_value . "\">\n";
echo "<label for=\"extra9\">Home Phone - Will NOT Display on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra9\" name=\"extra9\" size=\"50\" type=\"text\" value=\"" . $extra9_value . "\">\n";
echo "<label for=\"extra10\">Cell Phone - Will NOT Display on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra10\" name=\"extra10\" size=\"50\" type=\"text\" value=\"" . $extra10_value . "\">\n";
echo "<label for=\"extra11\">Specialities</label>\n";
echo "<input class=\"form-control\" id=\"extra11\" name=\"extra11\" size=\"50\" type=\"text\" value=\"" . $extra11_value . "\">\n";
echo "<label for=\"active\">Status</label>\n";
echo "<select class=\"form-control\" name=\"active\" size=\"1\"><option " . ($active_value == "0" ? "selected " : "") . "value=\"0\">inactive</option><option " . ($active_value != "0" ? "selected " : "") . "value=\"1\">active</option></select>\n";
echo "<input class=\"btn\" type=\"submit\" name=\"cmdSubmit\" value=\"Save\">";
echo " ";
echo "<input class=\"btn\" name=\"cmdBack\" type=\"button\" value=\"Cancel\" onclick=\"location.href='" . basename(__FILE__) . "'\">\n";
echo "</form>\n";
echo "</div>\n";
}
}
else
{
echo "<div id=\"header\"><a class=\"btn\" href=\"" . basename(__FILE__) . "?action=new\">New User</a> <a class=\"btn\" href=\"" . basename(__FILE__) . "?action=logout\">Logout</a>\n";
echo "<div id=\"filter\">\n";
echo "<label>Search: </label> <input class=\"form-control\" placeholder=\"\" type=\"search\">\n";
echo "</div>\n</div>\n";
echo "<table class=\"table table-striped table-hover\">\n";
echo "<thead><tr><th>Username</th><th>Fullname</th><th>Email</th><th>Status</th><th>Action</th></tr></thead>\n";
echo "<tbody>\n";
$sql = "SELECT * FROM ".$mysql_table;
$result = mysqli_query($db, $sql);
while ($data = mysqli_fetch_array($result))
{
echo "<tr>\n";
echo "<td>" . $data['username'] . "</td>\n";
echo "<td>" . $data['fullname'] . "</td>\n";
echo "<td>" . $data['email'] . "</td>\n";
echo "<td>" . ($data['active'] == "0" ? "inactive" : "active") . "</td>\n";
echo "<td>\n";
echo " <a href=\"" . basename(__FILE__) . "?action=edit&id=" . $data['username'] . "\" title=\"Edit\"><i class=\"icon-edit\"></i></a> \n";
echo " <a href=\"" . basename(__FILE__) . "?action=delete&id=" . $data['username'] . "\" title=\"Delete\"><i class=\"icon-delete\"></i></a>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
echo "<div id=\"footer\">\n";
echo "<ul id=\"pagination\">\n";
echo "<li class=\"disabled\"><a href=\"#\">« Prev</a></li>\n";
echo "<li class=\"disabled\"><a href=\"#\">Next »</a></li>\n";
echo "</ul>\n";
echo "</div>\n";
}
}
?>
</body>
</html>
Re: Edit Profile Error
HERE IS loginadmin.php with 15 extra fields:
<?php
session_start();
error_reporting(0);
define('ADMIN_PASS', 'eebc2fc1499d5f49c6348cd31608567b');
$session_timeout = 600;
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$admin_password = isset($_COOKIE['admin_password']) ? $_COOKIE['admin_password'] : '';
if (empty($admin_password))
{
if (isset($_POST['admin_password']))
{
$admin_password = md5($_POST['admin_password']);
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
}
}
else
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$active = isset($_POST['active']) ? $_POST['active'] : 0;
$role = isset($_POST['role']) ? $_POST['role'] : '';
$extra1 = isset($_POST['extra1']) ? $_POST['extra1'] : '';
$extra2 = isset($_POST['extra2']) ? $_POST['extra2'] : '';
$extra3 = isset($_POST['extra3']) ? $_POST['extra3'] : '';
$extra4 = isset($_POST['extra4']) ? $_POST['extra4'] : '';
$extra5 = isset($_POST['extra5']) ? $_POST['extra5'] : '';
$extra6 = isset($_POST['extra6']) ? $_POST['extra6'] : '';
$extra7 = isset($_POST['extra7']) ? $_POST['extra7'] : '';
$extra8 = isset($_POST['extra8']) ? $_POST['extra8'] : '';
$extra9 = isset($_POST['extra9']) ? $_POST['extra9'] : '';
$extra10 = isset($_POST['extra10']) ? $_POST['extra10'] : '';
$extra11 = isset($_POST['extra11']) ? $_POST['extra11'] : '';
$extra12 = isset($_POST['extra12']) ? $_POST['extra12'] : '';
$extra13 = isset($_POST['extra13']) ? $_POST['extra13'] : '';
$extra14 = isset($_POST['extra14']) ? $_POST['extra14'] : '';
$extra15 = isset($_POST['extra15']) ? $_POST['extra15'] : '';
$avatar_folder = 'avatars';
$avatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
$error_message = '';
if (!file_exists($avatar_folder))
{
if (!mkdir($avatar_folder, 0777))
{
die("Failed to create images directory.");
}
}
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
$prefix = rand(111111, 999999);
$avatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $avatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
if ($error_message != '')
{
die($error_message);
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
mysqli_query($db, 'SET NAMES "UTF8"');
mysqli_query($db, "SET collation_connection='utf8_general_ci'");
mysqli_query($db, "SET collation_server='utf8_general_ci'");
mysqli_query($db, "SET character_set_client='utf8'");
mysqli_query($db, "SET character_set_connection='utf8'");
mysqli_query($db, "SET character_set_results='utf8'");
mysqli_query($db, "SET character_set_server='utf8'");
if (!empty($action))
{
if ($action == 'delete')
{
$sql = "DELETE FROM ".$mysql_table." WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'update')
{
$sql = "UPDATE `".$mysql_table."` SET `username` = '$username', ";
if (!empty($_POST['password']))
{
$crypt_pass = md5($_POST['password']);
$sql = $sql . "`password` = '$crypt_pass',";
}
if (!empty($avatar))
{
$sql = $sql . "`avatar` = '$avatar',";
}
$sql = $sql . " `fullname` = '$fullname', `email` = '$email', `role` = '$role', `active` = $active, `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11', `extra12` = '$extra12', `extra13` = '$extra13', `extra14` = '$extra14', `extra15` = '$extra15' WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'create')
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
echo 'User already exists!';
exit;
}
$crypt_pass = md5($_POST['password']);
$avatar_column = '';
$avatar_value = '';
if (!empty($avatar))
{
$avatar_column = ", `avatar`";
$avatar_value = ", '$avatar'";
}
$sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `role`, `active`, `extra1`, `extra2`, `extra3`, `extra4`, `extra5`, `extra6`, `extra7`, `extra8`, `extra9`, `extra10`, `extra11`, `extra12`, `extra13`, `extra14`, `extra15`$avatar_column) VALUES ('$username', '$crypt_pass', '$fullname', '$email', '$role', $active, '$extra1', '$extra2', '$extra3', '$extra4', '$extra5', '$extra6', '$extra7', '$extra8', '$extra9', '$extra10', '$extra11', '$extra12', '$extra13', '$extra14', '$extra15'$avatar_value)";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'logout')
{
session_unset();
session_destroy();
setcookie('admin_password', '', time() - 3600);
header('Location: '.basename(__FILE__));
exit;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #89BDD3;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #89BDD3;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 16px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 16px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #9AD3DE;
border: 1px solid #9AD3DE;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 16px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 16px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #9AD3DE;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #9AD3DE;
border-color: #9AD3DE;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<?php
if ($admin_password != ADMIN_PASS)
{
echo "<div class=\"container\" style=\"text-align:center\">\n";
echo "<h2>User Administrator</h2>\n";
echo "<form method=\"post\" accept-charset=\"UTF-8\" action=\"" .basename(__FILE__) . "\">\n";
echo "<input class=\"form-control\" type=\"password\" name=\"admin_password\" size=\"20\" />\n";
echo "<input class=\"btn\" type=\"submit\" value=\"Login\" name=\"submit\" />\n";
echo "</form>\n";
echo "</div>\n";
}
else
{
if (!empty($action))
{
if (($action == 'edit') || ($action == 'new'))
{
$username_value = '';
$fullname_value = '';
$email_value = '';
$active_value = '';
$avatar_value = '';
$role_value = '';
$extra1_value = '';
$extra2_value = '';
$extra3_value = '';
$extra4_value = '';
$extra5_value = '';
$extra6_value = '';
$extra7_value = '';
$extra8_value = '';
$extra9_value = '';
$extra10_value = '';
$extra11_value = '';
$extra12_value = '';
$extra13_value = '';
$extra14_value = '';
$extra15_value = '';
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$id."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$username_value = $data['username'];
$fullname_value = $data['fullname'];
$email_value = $data['email'];
$active_value = $data['active'];
$avatar_value = $data['avatar'];
$role_value = $data['role'];
$extra1_value = $data['extra1'];
$extra2_value = $data['extra2'];
$extra3_value = $data['extra3'];
$extra4_value = $data['extra4'];
$extra5_value = $data['extra5'];
$extra6_value = $data['extra6'];
$extra7_value = $data['extra7'];
$extra8_value = $data['extra8'];
$extra9_value = $data['extra9'];
$extra10_value = $data['extra10'];
$extra11_value = $data['extra11'];
$extra12_value = $data['extra12'];
$extra13_value = $data['extra13'];
$extra14_value = $data['extra14'];
$extra15_value = $data['extra15'];
}
echo "<div class=\"container\">\n";
echo "<form action=\"" . basename(__FILE__) . "\" enctype=\"multipart/form-data\" accept-charset=\"UTF-8\" method=\"post\">\n";
if ($action == 'new')
{
echo "<input name=\"action\" type=\"hidden\" value=\"create\">\n";
}
else
{
echo "<input name=\"action\" type=\"hidden\" value=\"update\">\n";
}
echo "<input type=\"hidden\" name=\"id\" value=\"". $id . "\">\n";
echo "<label for=\"username\">Username</label>\n";
echo "<input class=\"form-control\" id=\"username\" name=\"username\" size=\"50\" type=\"text\" value=\"" . $username_value . "\">\n";
echo "<label for=\"password\">Password</label>\n";
echo "<input class=\"form-control\" id=\"password\" name=\"password\" size=\"50\" type=\"password\" value=\"\">\n";
echo "<label for=\"fullname\">Fullname</label>\n";
echo "<input class=\"form-control\" id=\"fullname\" name=\"fullname\" size=\"50\" type=\"text\" value=\"" . $fullname_value . "\">\n";
echo "<label for=\"email\">Email</label>\n";
echo "<input class=\"form-control\" id=\"email\" name=\"email\" size=\"50\" type=\"text\" value=\"" . $email_value . "\">\n";
echo "<label for=\"role\">Role</label>\n";
echo "<select class=\"form-control\" id=\"role\" name=\"role\" size=\"1\">\n";
$roles = array("Administrator","Member","Guest");
for ($i=0; $i<count($roles); $i++)
{
$selected = ($roles[$i] == $role_value) ? "selected" : "";
echo "<option value=\"$roles[$i]\" $selected>$roles[$i]</option>\n";
}
echo "</select>\n";
echo "<label for=\"avatar\">Avatar</label>\n";
echo "<div class=\"input-group\" id=\"avatar\"><input class=\"form-control\" type=\"text\" readonly=\"\" value=\"$avatar_value\"><label class=\"input-group-btn\"><input type=\"file\" name=\"avatar\" style=\"display:none;\"><span class=\"btn\">Browse...</span></label></div>\n";
if (!empty($avatar_value))
{
echo "<div class=\"thumbnail\"><div class=\"frame\"><img alt=\"$avatar_value\" src=\"$avatar_folder/$avatar_value\"></div></div>\n";
}
echo "<label for=\"extra1\">Studio Name</label>\n";
echo "<input class=\"form-control\" id=\"extra1\" name=\"extra1\" size=\"50\" type=\"text\" value=\"" . $extra1_value . "\">\n";
echo "<label for=\"extra2\">Contact Name</label>\n";
echo "<input class=\"form-control\" id=\"extra2\" name=\"extra2\" size=\"50\" type=\"text\" value=\"" . $extra2_value . "\">\n";
echo "<label for=\"extra3\">Address</label>\n";
echo "<input class=\"form-control\" id=\"extra3\" name=\"extra3\" size=\"50\" type=\"text\" value=\"" . $extra3_value . "\">\n";
echo "<label for=\"extra4\">City</label>\n";
echo "<input class=\"form-control\" id=\"extra4\" name=\"extra4\" size=\"50\" type=\"text\" value=\"" . $extra4_value . "\">\n";
echo "<label for=\"extra5\">State</label>\n";
echo "<input class=\"form-control\" id=\"extra5\" name=\"extra5\" size=\"50\" type=\"text\" value=\"" . $extra5_value . "\">\n";
echo "<label for=\"extra6\">Zip</label>\n";
echo "<input class=\"form-control\" id=\"extra6\" name=\"extra6\" size=\"50\" type=\"text\" value=\"" . $extra6_value . "\">\n";
echo "<label for=\"extra7\">Business Phone 1</label>\n";
echo "<input class=\"form-control\" id=\"extra7\" name=\"extra7\" size=\"50\" type=\"text\" value=\"" . $extra7_value . "\">\n";
echo "<label for=\"extra8\">Business Phone 2</label>\n";
echo "<input class=\"form-control\" id=\"extra8\" name=\"extra8\" size=\"50\" type=\"text\" value=\"" . $extra8_value . "\">\n";
echo "<label for=\"extra9\">Home Phone - will not be on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra9\" name=\"extra9\" size=\"50\" type=\"text\" value=\"" . $extra9_value . "\">\n";
echo "<label for=\"extra10\">Cell Phone - will not be on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra10\" name=\"extra10\" size=\"50\" type=\"text\" value=\"" . $extra10_value . "\">\n";
echo "<label for=\"extra11\">Specialities - What services do you offer?</label>\n";
echo "<input class=\"form-control\" id=\"extra11\" name=\"extra11\" size=\"50\" type=\"text\" value=\"" . $extra11_value . "\">\n";
echo "<label for=\"extra12\">Description - Add something informative to prospective clients</label>\n";
echo "<input class=\"form-control\" id=\"extra12\" name=\"extra12\" size=\"50\" type=\"text\" value=\"" . $extra12_value . "\">\n";
echo "<label for=\"extra13\">Web Address</label>\n";
echo "<input class=\"form-control\" id=\"extra13\" name=\"extra13\" size=\"50\" type=\"text\" value=\"" . $extra13_value . "\">\n";
echo "<label for=\"extra14\">Current Member (yes/no)</label>\n";
echo "<input class=\"form-control\" id=\"extra14\" name=\"extra14\" size=\"50\" type=\"text\" value=\"" . $extra14_value . "\">\n";
echo "<label for=\"extra15\">Website Ad (yes/no)</label>\n";
echo "<input class=\"form-control\" id=\"extra15\" name=\"extra15\" size=\"50\" type=\"text\" value=\"" . $extra15_value . "\">\n";
echo "<label for=\"active\">Status</label>\n";
echo "<select class=\"form-control\" name=\"active\" size=\"1\"><option " . ($active_value == "0" ? "selected " : "") . "value=\"0\">inactive</option><option " . ($active_value != "0" ? "selected " : "") . "value=\"1\">active</option></select>\n";
echo "<input class=\"btn\" type=\"submit\" name=\"cmdSubmit\" value=\"Save\">";
echo " ";
echo "<input class=\"btn\" name=\"cmdBack\" type=\"button\" value=\"Cancel\" onclick=\"location.href='" . basename(__FILE__) . "'\">\n";
echo "</form>\n";
echo "</div>\n";
}
}
else
{
echo "<div id=\"header\"><a class=\"btn\" href=\"" . basename(__FILE__) . "?action=new\">New User</a> <a class=\"btn\" href=\"" . basename(__FILE__) . "?action=logout\">Logout</a>\n";
echo "<div id=\"filter\">\n";
echo "<label>Search: </label> <input class=\"form-control\" placeholder=\"\" type=\"search\">\n";
echo "</div>\n</div>\n";
echo "<table class=\"table table-striped table-hover\">\n";
echo "<thead><tr><th>Username</th><th>Fullname</th><th>Email</th><th>Status</th><th>Action</th></tr></thead>\n";
echo "<tbody>\n";
$sql = "SELECT * FROM ".$mysql_table;
$result = mysqli_query($db, $sql);
while ($data = mysqli_fetch_array($result))
{
echo "<tr>\n";
echo "<td>" . $data['username'] . "</td>\n";
echo "<td>" . $data['fullname'] . "</td>\n";
echo "<td>" . $data['email'] . "</td>\n";
echo "<td>" . ($data['active'] == "0" ? "inactive" : "active") . "</td>\n";
echo "<td>\n";
echo " <a href=\"" . basename(__FILE__) . "?action=edit&id=" . $data['username'] . "\" title=\"Edit\"><i class=\"icon-edit\"></i></a> \n";
echo " <a href=\"" . basename(__FILE__) . "?action=delete&id=" . $data['username'] . "\" title=\"Delete\"><i class=\"icon-delete\"></i></a>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
echo "<div id=\"footer\">\n";
echo "<ul id=\"pagination\">\n";
echo "<li class=\"disabled\"><a href=\"#\">« Prev</a></li>\n";
echo "<li class=\"disabled\"><a href=\"#\">Next »</a></li>\n";
echo "</ul>\n";
echo "</div>\n";
}
}
?>
</body>
</html>
<?php
session_start();
error_reporting(0);
define('ADMIN_PASS', 'eebc2fc1499d5f49c6348cd31608567b');
$session_timeout = 600;
$mysql_server = 'ppocc_members.db.3698662.hostedresource.com';
$mysql_username = 'ppocc_members';
$mysql_password = 'xxxxxxxxxx';
$mysql_database = 'ppocc_members';
$mysql_table = 'ppocc_members2018';
$admin_password = isset($_COOKIE['admin_password']) ? $_COOKIE['admin_password'] : '';
if (empty($admin_password))
{
if (isset($_POST['admin_password']))
{
$admin_password = md5($_POST['admin_password']);
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
}
}
else
if ($admin_password == ADMIN_PASS)
{
setcookie('admin_password', $admin_password, time() + $session_timeout);
}
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
$fullname = isset($_POST['fullname']) ? $_POST['fullname'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$active = isset($_POST['active']) ? $_POST['active'] : 0;
$role = isset($_POST['role']) ? $_POST['role'] : '';
$extra1 = isset($_POST['extra1']) ? $_POST['extra1'] : '';
$extra2 = isset($_POST['extra2']) ? $_POST['extra2'] : '';
$extra3 = isset($_POST['extra3']) ? $_POST['extra3'] : '';
$extra4 = isset($_POST['extra4']) ? $_POST['extra4'] : '';
$extra5 = isset($_POST['extra5']) ? $_POST['extra5'] : '';
$extra6 = isset($_POST['extra6']) ? $_POST['extra6'] : '';
$extra7 = isset($_POST['extra7']) ? $_POST['extra7'] : '';
$extra8 = isset($_POST['extra8']) ? $_POST['extra8'] : '';
$extra9 = isset($_POST['extra9']) ? $_POST['extra9'] : '';
$extra10 = isset($_POST['extra10']) ? $_POST['extra10'] : '';
$extra11 = isset($_POST['extra11']) ? $_POST['extra11'] : '';
$extra12 = isset($_POST['extra12']) ? $_POST['extra12'] : '';
$extra13 = isset($_POST['extra13']) ? $_POST['extra13'] : '';
$extra14 = isset($_POST['extra14']) ? $_POST['extra14'] : '';
$extra15 = isset($_POST['extra15']) ? $_POST['extra15'] : '';
$avatar_folder = 'avatars';
$avatar = '';
if (isset($_FILES['avatar']) && $_FILES['avatar']['name'] != "")
{
$error_message = '';
if (!file_exists($avatar_folder))
{
if (!mkdir($avatar_folder, 0777))
{
die("Failed to create images directory.");
}
}
switch ($_FILES['avatar']['error'])
{
case UPLOAD_ERR_OK:
if ($_FILES['avatar']['type'] == 'image/gif' || $_FILES['avatar']['type'] == 'image/jpeg' || $_FILES['avatar']['type'] == 'image/pjpeg' || $_FILES['avatar']['type'] == 'image/png' || $_FILES['avatar']['type'] == 'image/x-png')
{
$prefix = rand(111111, 999999);
$avatar = $prefix . "_" . str_replace(" ", "_", $_FILES['avatar']['name']);
if (!move_uploaded_file($_FILES['avatar']['tmp_name'], $avatar_folder . "/" . $avatar))
{
$error_message = "Upload failed, please verify the folder's permissions.";
}
}
else
{
$error_message = "Wrong file type, please only use jpg, gif or png images.";
}
break;
case UPLOAD_ERR_INI_SIZE:
$error_message = "The uploaded file exceeds the 'upload_max_filesize' directive.";
break;
case UPLOAD_ERR_FORM_SIZE:
$error_message = "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case UPLOAD_ERR_PARTIAL:
$error_message = "The uploaded file was only partially uploaded.";
break;
case UPLOAD_ERR_NO_FILE:
$error_message = "No file was uploaded.";
break;
case UPLOAD_ERR_NO_TMP_DIR:
$error_message = "Missing a temporary folder.";
break;
case UPLOAD_ERR_CANT_WRITE:
$error_message = "Failed to write file to disk.";
break;
case UPLOAD_ERR_EXTENSION:
$error_message = "File upload stopped by extension.";
break;
}
if ($error_message != '')
{
die($error_message);
}
}
$db = mysqli_connect($mysql_server, $mysql_username, $mysql_password);
if (!$db)
{
die('Failed to connect to database server!<br>'.mysqli_error($db));
}
mysqli_select_db($db, $mysql_database) or die('Failed to select database<br>'.mysqli_error($db));
mysqli_set_charset($db, 'utf8');
mysqli_query($db, 'SET NAMES "UTF8"');
mysqli_query($db, "SET collation_connection='utf8_general_ci'");
mysqli_query($db, "SET collation_server='utf8_general_ci'");
mysqli_query($db, "SET character_set_client='utf8'");
mysqli_query($db, "SET character_set_connection='utf8'");
mysqli_query($db, "SET character_set_results='utf8'");
mysqli_query($db, "SET character_set_server='utf8'");
if (!empty($action))
{
if ($action == 'delete')
{
$sql = "DELETE FROM ".$mysql_table." WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'update')
{
$sql = "UPDATE `".$mysql_table."` SET `username` = '$username', ";
if (!empty($_POST['password']))
{
$crypt_pass = md5($_POST['password']);
$sql = $sql . "`password` = '$crypt_pass',";
}
if (!empty($avatar))
{
$sql = $sql . "`avatar` = '$avatar',";
}
$sql = $sql . " `fullname` = '$fullname', `email` = '$email', `role` = '$role', `active` = $active, `extra1` = '$extra1', `extra2` = '$extra2', `extra3` = '$extra3', `extra4` = '$extra4', `extra5` = '$extra5', `extra6` = '$extra6', `extra7` = '$extra7', `extra8` = '$extra8', `extra9` = '$extra9', `extra10` = '$extra10', `extra11` = '$extra11', `extra12` = '$extra12', `extra13` = '$extra13', `extra14` = '$extra14', `extra15` = '$extra15' WHERE `username` = '$id'";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'create')
{
$sql = "SELECT username FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
echo 'User already exists!';
exit;
}
$crypt_pass = md5($_POST['password']);
$avatar_column = '';
$avatar_value = '';
if (!empty($avatar))
{
$avatar_column = ", `avatar`";
$avatar_value = ", '$avatar'";
}
$sql = "INSERT `".$mysql_table."` (`username`, `password`, `fullname`, `email`, `role`, `active`, `extra1`, `extra2`, `extra3`, `extra4`, `extra5`, `extra6`, `extra7`, `extra8`, `extra9`, `extra10`, `extra11`, `extra12`, `extra13`, `extra14`, `extra15`$avatar_column) VALUES ('$username', '$crypt_pass', '$fullname', '$email', '$role', $active, '$extra1', '$extra2', '$extra3', '$extra4', '$extra5', '$extra6', '$extra7', '$extra8', '$extra9', '$extra10', '$extra11', '$extra12', '$extra13', '$extra14', '$extra15'$avatar_value)";
mysqli_query($db, $sql);
mysqli_close($db);
header('Location: '.basename(__FILE__));
exit;
}
else
if ($action == 'logout')
{
session_unset();
session_destroy();
setcookie('admin_password', '', time() - 3600);
header('Location: '.basename(__FILE__));
exit;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>User Administrator</title>
<style type="text/css">
*
{
box-sizing: border-box;
}
body
{
background-color: #FFFFFF;
margin: 6px;
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
th
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
background-color: #89BDD3;
color: #FFFFFF;
text-align: left;
}
td
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
}
input, select
{
font-size: 16px;
font-family: Arial;
font-weight: normal;
text-decoration: none;
color: #000000;
border:1px #000000 solid;
}
.clickable
{
cursor: pointer;
}
.container
{
max-width: 768px;
margin: 0 auto 0 auto;
padding: 15px;
text-align: left;
width: 100%;
}
td, th
{
padding: 0;
}
.table
{
background-color: transparent;
border: 1px solid #DDDDDD;
border-collapse: collapse;
border-spacing: 0;
max-width: 100%;
width: 100%;
}
.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td
{
padding: 8px;
line-height: 1.4285;
vertical-align: top;
border-top: 1px solid #DDDDDD;
}
.table > thead > tr > th
{
vertical-align: bottom;
border-bottom: 2px solid #DDDDDD;
}
.table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td
{
border-top: 0;
}
.table-hover > tbody > tr:hover > td
{
background-color: #F5F5F5;
}
.table-striped>tbody>tr:nth-child(odd)>td
{
background-color: #F9F9F9;
}
th
{
background-color: #89BDD3;
color: #FFFFFF;
font-weight: bold;
}
.form-control
{
display: block;
width: 100%;
margin-bottom: 15px;
padding: 6px 12px;
font-family: Arial;
font-size: 16px;
line-height: 1.4285;
color: #555555;
background-color: #FFFFFF;
background-image: none;
border: 1px solid #CCCCCC;
border-radius: 4px;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.form-control:focus
{
border-color: #66AFE9;
outline: 0;
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.075), 0px 0px 8px rgba(102,175,233,0.60);
}
label
{
display: block;
padding: 6px 0px;
text-align: left;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0px;
font-family: Arial;
font-weight: normal;
font-size: 16px;
text-align: center;
text-decoration: none;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-color: #9AD3DE;
border: 1px solid #9AD3DE;
border-radius: 4px;
color: #FFFFFF;
}
#header
{
margin-bottom: 6px;
}
#filter
{
float: right;
}
#filter input
{
display: inline-block;
vertical-align: middle;
width: 16em;
padding: 5px 10px;
}
#filter label
{
display: inline-block;
max-width: 100%;
font-size: 16px;
font-family: Arial;
}
.filter-hide
{
display: none !important;
}
#pagination
{
display: inline-block;
list-style: none;
padding: 0;
border-radius: 4px;
font-family: Arial;
font-weight: normal;
font-size: 0;
}
#pagination > li
{
display: inline;
font-size: 16px;
}
#pagination > li > a, #pagination > li > span
{
position: relative;
float: left;
padding: 6px 12px 6px 12px;
text-decoration: none;
background-color: #FFFFFF;
border: 1px #DDDDDD solid;
color: #9AD3DE;
margin-left: -1px;
}
#pagination > li:first-child > a, #pagination > li:first-child > span
{
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
#pagination > li:last-child > a, #pagination > li:last-child > span
{
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
#pagination > li > a:hover, #pagination > li > span:hover, #pagination > li > a:focus, #pagination > li > span:focus
{
background-color: #CCCCCC;
color: #23527C;
}
#pagination > .active > a, #pagination > .active > span, #pagination > .active > a:hover, #pagination > .active > span:hover, #pagination > .active > a:focus, #pagination > .active > span:focus
{
z-index: 2;
background-color: #9AD3DE;
border-color: #9AD3DE;
color: #FFFFFF;
cursor: default;
}
#pagination > .disabled > span, #pagination > .disabled > span:hover, #pagination > .disabled > span:focus, #pagination > .disabled > a, #pagination > .disabled > a:hover, #pagination > .disabled > a:focus
{
background-color: #FFFFFF;
color: #777777;
cursor: not-allowed;
}
.paginate-show
{
display: table-row;
}
.paginate-hide
{
display: none;
}
#footer
{
margin-top: 10px;
text-align:right;
}
.icon-edit, .icon-delete
{
display: inline-block;
}
.icon-edit::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M363%200l91%2091l-235%20235l-91%20-91v-107h128v-128h107zM886%20928q0%2022%20-22%2022q-10%200%20-17%20-7l-542%20-542q-7%20-7%20-7%20-17q0%20-22%2022%20-22q10%200%2017%207l542%20542q7%207%207%2017zM832%201120l416%20-416l-832%20-832h-416v416zM1515%201024q0%20-53%20-37%20-90l-166%20-166l-416%20416l166%20165q36%2038%2090%2038q53%200%2091%20-38l235%20-234q37%20-39%2037%20-91z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
.icon-delete::before
{
display: inline-block;
width: 16px;
height: 16px;
content: " ";
background: url('data:image/svg+xml,%3Csvg%20height%3D%2216%22%20width%3D%2216%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cg%20style%3D%22fill%3A%23000000%22%20transform%3D%22scale%280.0089%29%22%3E%0D%0A%3Cpath%20transform%3D%22rotate%28180%29%20scale%28-1%2C1%29%20translate%280%2C-1536%29%22%20d%3D%22M1298%20214q0%20-40%20-28%20-68l-136%20-136q-28%20-28%20-68%20-28t-68%2028l-294%20294l-294%20-294q-28%20-28%20-68%20-28t-68%2028l-136%20136q-28%2028%20-28%2068t28%2068l294%20294l-294%20294q-28%2028%20-28%2068t28%2068l136%20136q28%2028%2068%2028t68%20-28l294%20-294l294%20294q28%2028%2068%2028t68%20-28l136%20-136q28%20-28%2028%20-68t-28%20-68l-294%20-294l294%20-294q28%20-28%2028%20-68z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E') no-repeat center center;
}
#avatar *
{
box-sizing: border-box;
}
#avatar
{
display: table;
border-collapse: separate;
border-spacing: 0;
margin-bottom: 15px;
}
#avatar .form-control
{
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0px;
}
#avatar .input-group-btn, #avatar .form-control
{
display: table-cell;
}
#avatar .form-control
{
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
margin: 0;
}
#avatar .input-group-btn
{
width: 1%;
white-space: nowrap;
vertical-align: middle;
padding: 0;
position: relative;
font-size: 0px;
white-space: nowrap;
}
#avatar .btn
{
border-bottom-left-radius: 0px;
border-top-left-radius: 0px;
display: inline-block;
margin-left: -1px;
padding: 6px 8px 6px 8px;
position: relative;
}
.thumbnail
{
display: inline-block;
min-height: 1px;
box-sizing: border-box;
margin: 0;
padding: 6px 0 14px 0;
text-align: center;
vertical-align: top;
}
.thumbnail .frame
{
padding: 4px;
background-color: #fff;
border: 1px #DDDDDD solid;
border-radius: 4px;
}
.thumbnail img
{
border-width: 0;
display: block;
width: 100%;
height: auto;
max-width: 100%;
box-sizing: border-box;
}
</style>
<script type="text/javascript" src="jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#filter input').on('propertychange input', function(e)
{
$('.no-results').remove();
var $this = $(this);
var search = $this.val().toLowerCase();
var $target = $('.table');
var $rows = $target.find('tbody tr');
if (search == '')
{
$rows.removeClass('filter-hide');
buildNav();
paginate();
}
else
{
$rows.each(function()
{
var $this = $(this);
$this.text().toLowerCase().indexOf(search) === -1 ? $this.addClass('filter-hide') : $this.removeClass('filter-hide');
})
buildNav();
paginate();
if ($target.find('tbody tr:visible').size() === 0)
{
var col_span = $target.find('tr').first().find('td').size();
var no_results = $('<tr class="no-results"><td colspan="'+col_span+'"></td></tr>');
$target.find('tbody').append(no_results);
}
}
});
$('.table').each(function()
{
var currentPage = 0;
var numPerPage = 10;
var $table = $(this);
var numRows = $table.find('tbody tr').length;
var numPages = Math.ceil(numRows / numPerPage);
var $pagination = $('#pagination');
paginate = function()
{
$pagination.find('li').eq(currentPage+1).addClass('active').siblings().removeClass('active');
var $prev = $pagination.find('li:first-child');
var $next = $pagination.find('li:last-child');
if (currentPage == 0)
{
$prev.addClass('disabled');
}
else
{
$prev.removeClass('disabled');
}
if (currentPage == (numPages-1))
{
$next.addClass('disabled');
}
else
{
$next.removeClass('disabled');
}
$table.find('tbody tr').not('.filter-hide').removeClass('paginate-show').addClass('paginate-hide').slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).removeClass('paginate-hide').addClass('paginate-show');;
};
buildNav = function()
{
numRows = $table.find('tbody tr').not('.filter-hide').length;
numPages = Math.ceil(numRows / numPerPage);
$pagination.find('li').not($pagination.find('li:first-child')).not($pagination.find('li:last-child')).remove();
for (var page = 0; page < numPages; page++)
{
var item = '<a>' + (page + 1) + '</a>';
$('<li></li>').html(item)
.bind('click', {newPage: page}, function(event)
{
currentPage = event.data['newPage'];
paginate();
}).appendTo($pagination).addClass('clickable');
}
$pagination.find('li').eq(1).appendTo($pagination);
}
buildNav();
$pagination.find('li:nth-child(2)').addClass('active');
$pagination.find('li:first-child').click(function()
{
if (currentPage > 0)
{
currentPage--;
}
paginate();
});
$pagination.find('li:last-child').click(function()
{
if (currentPage < (numPages-1))
{
currentPage++;
}
paginate();
});
paginate();
});
$("#avatar :file").on('change', function()
{
var input = $(this).parents('.input-group').find(':text');
input.val($(this).val());
});
});
</script>
</head>
<body>
<?php
if ($admin_password != ADMIN_PASS)
{
echo "<div class=\"container\" style=\"text-align:center\">\n";
echo "<h2>User Administrator</h2>\n";
echo "<form method=\"post\" accept-charset=\"UTF-8\" action=\"" .basename(__FILE__) . "\">\n";
echo "<input class=\"form-control\" type=\"password\" name=\"admin_password\" size=\"20\" />\n";
echo "<input class=\"btn\" type=\"submit\" value=\"Login\" name=\"submit\" />\n";
echo "</form>\n";
echo "</div>\n";
}
else
{
if (!empty($action))
{
if (($action == 'edit') || ($action == 'new'))
{
$username_value = '';
$fullname_value = '';
$email_value = '';
$active_value = '';
$avatar_value = '';
$role_value = '';
$extra1_value = '';
$extra2_value = '';
$extra3_value = '';
$extra4_value = '';
$extra5_value = '';
$extra6_value = '';
$extra7_value = '';
$extra8_value = '';
$extra9_value = '';
$extra10_value = '';
$extra11_value = '';
$extra12_value = '';
$extra13_value = '';
$extra14_value = '';
$extra15_value = '';
$sql = "SELECT * FROM ".$mysql_table." WHERE username = '".$id."'";
$result = mysqli_query($db, $sql);
if ($data = mysqli_fetch_array($result))
{
$username_value = $data['username'];
$fullname_value = $data['fullname'];
$email_value = $data['email'];
$active_value = $data['active'];
$avatar_value = $data['avatar'];
$role_value = $data['role'];
$extra1_value = $data['extra1'];
$extra2_value = $data['extra2'];
$extra3_value = $data['extra3'];
$extra4_value = $data['extra4'];
$extra5_value = $data['extra5'];
$extra6_value = $data['extra6'];
$extra7_value = $data['extra7'];
$extra8_value = $data['extra8'];
$extra9_value = $data['extra9'];
$extra10_value = $data['extra10'];
$extra11_value = $data['extra11'];
$extra12_value = $data['extra12'];
$extra13_value = $data['extra13'];
$extra14_value = $data['extra14'];
$extra15_value = $data['extra15'];
}
echo "<div class=\"container\">\n";
echo "<form action=\"" . basename(__FILE__) . "\" enctype=\"multipart/form-data\" accept-charset=\"UTF-8\" method=\"post\">\n";
if ($action == 'new')
{
echo "<input name=\"action\" type=\"hidden\" value=\"create\">\n";
}
else
{
echo "<input name=\"action\" type=\"hidden\" value=\"update\">\n";
}
echo "<input type=\"hidden\" name=\"id\" value=\"". $id . "\">\n";
echo "<label for=\"username\">Username</label>\n";
echo "<input class=\"form-control\" id=\"username\" name=\"username\" size=\"50\" type=\"text\" value=\"" . $username_value . "\">\n";
echo "<label for=\"password\">Password</label>\n";
echo "<input class=\"form-control\" id=\"password\" name=\"password\" size=\"50\" type=\"password\" value=\"\">\n";
echo "<label for=\"fullname\">Fullname</label>\n";
echo "<input class=\"form-control\" id=\"fullname\" name=\"fullname\" size=\"50\" type=\"text\" value=\"" . $fullname_value . "\">\n";
echo "<label for=\"email\">Email</label>\n";
echo "<input class=\"form-control\" id=\"email\" name=\"email\" size=\"50\" type=\"text\" value=\"" . $email_value . "\">\n";
echo "<label for=\"role\">Role</label>\n";
echo "<select class=\"form-control\" id=\"role\" name=\"role\" size=\"1\">\n";
$roles = array("Administrator","Member","Guest");
for ($i=0; $i<count($roles); $i++)
{
$selected = ($roles[$i] == $role_value) ? "selected" : "";
echo "<option value=\"$roles[$i]\" $selected>$roles[$i]</option>\n";
}
echo "</select>\n";
echo "<label for=\"avatar\">Avatar</label>\n";
echo "<div class=\"input-group\" id=\"avatar\"><input class=\"form-control\" type=\"text\" readonly=\"\" value=\"$avatar_value\"><label class=\"input-group-btn\"><input type=\"file\" name=\"avatar\" style=\"display:none;\"><span class=\"btn\">Browse...</span></label></div>\n";
if (!empty($avatar_value))
{
echo "<div class=\"thumbnail\"><div class=\"frame\"><img alt=\"$avatar_value\" src=\"$avatar_folder/$avatar_value\"></div></div>\n";
}
echo "<label for=\"extra1\">Studio Name</label>\n";
echo "<input class=\"form-control\" id=\"extra1\" name=\"extra1\" size=\"50\" type=\"text\" value=\"" . $extra1_value . "\">\n";
echo "<label for=\"extra2\">Contact Name</label>\n";
echo "<input class=\"form-control\" id=\"extra2\" name=\"extra2\" size=\"50\" type=\"text\" value=\"" . $extra2_value . "\">\n";
echo "<label for=\"extra3\">Address</label>\n";
echo "<input class=\"form-control\" id=\"extra3\" name=\"extra3\" size=\"50\" type=\"text\" value=\"" . $extra3_value . "\">\n";
echo "<label for=\"extra4\">City</label>\n";
echo "<input class=\"form-control\" id=\"extra4\" name=\"extra4\" size=\"50\" type=\"text\" value=\"" . $extra4_value . "\">\n";
echo "<label for=\"extra5\">State</label>\n";
echo "<input class=\"form-control\" id=\"extra5\" name=\"extra5\" size=\"50\" type=\"text\" value=\"" . $extra5_value . "\">\n";
echo "<label for=\"extra6\">Zip</label>\n";
echo "<input class=\"form-control\" id=\"extra6\" name=\"extra6\" size=\"50\" type=\"text\" value=\"" . $extra6_value . "\">\n";
echo "<label for=\"extra7\">Business Phone 1</label>\n";
echo "<input class=\"form-control\" id=\"extra7\" name=\"extra7\" size=\"50\" type=\"text\" value=\"" . $extra7_value . "\">\n";
echo "<label for=\"extra8\">Business Phone 2</label>\n";
echo "<input class=\"form-control\" id=\"extra8\" name=\"extra8\" size=\"50\" type=\"text\" value=\"" . $extra8_value . "\">\n";
echo "<label for=\"extra9\">Home Phone - will not be on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra9\" name=\"extra9\" size=\"50\" type=\"text\" value=\"" . $extra9_value . "\">\n";
echo "<label for=\"extra10\">Cell Phone - will not be on Referral Page</label>\n";
echo "<input class=\"form-control\" id=\"extra10\" name=\"extra10\" size=\"50\" type=\"text\" value=\"" . $extra10_value . "\">\n";
echo "<label for=\"extra11\">Specialities - What services do you offer?</label>\n";
echo "<input class=\"form-control\" id=\"extra11\" name=\"extra11\" size=\"50\" type=\"text\" value=\"" . $extra11_value . "\">\n";
echo "<label for=\"extra12\">Description - Add something informative to prospective clients</label>\n";
echo "<input class=\"form-control\" id=\"extra12\" name=\"extra12\" size=\"50\" type=\"text\" value=\"" . $extra12_value . "\">\n";
echo "<label for=\"extra13\">Web Address</label>\n";
echo "<input class=\"form-control\" id=\"extra13\" name=\"extra13\" size=\"50\" type=\"text\" value=\"" . $extra13_value . "\">\n";
echo "<label for=\"extra14\">Current Member (yes/no)</label>\n";
echo "<input class=\"form-control\" id=\"extra14\" name=\"extra14\" size=\"50\" type=\"text\" value=\"" . $extra14_value . "\">\n";
echo "<label for=\"extra15\">Website Ad (yes/no)</label>\n";
echo "<input class=\"form-control\" id=\"extra15\" name=\"extra15\" size=\"50\" type=\"text\" value=\"" . $extra15_value . "\">\n";
echo "<label for=\"active\">Status</label>\n";
echo "<select class=\"form-control\" name=\"active\" size=\"1\"><option " . ($active_value == "0" ? "selected " : "") . "value=\"0\">inactive</option><option " . ($active_value != "0" ? "selected " : "") . "value=\"1\">active</option></select>\n";
echo "<input class=\"btn\" type=\"submit\" name=\"cmdSubmit\" value=\"Save\">";
echo " ";
echo "<input class=\"btn\" name=\"cmdBack\" type=\"button\" value=\"Cancel\" onclick=\"location.href='" . basename(__FILE__) . "'\">\n";
echo "</form>\n";
echo "</div>\n";
}
}
else
{
echo "<div id=\"header\"><a class=\"btn\" href=\"" . basename(__FILE__) . "?action=new\">New User</a> <a class=\"btn\" href=\"" . basename(__FILE__) . "?action=logout\">Logout</a>\n";
echo "<div id=\"filter\">\n";
echo "<label>Search: </label> <input class=\"form-control\" placeholder=\"\" type=\"search\">\n";
echo "</div>\n</div>\n";
echo "<table class=\"table table-striped table-hover\">\n";
echo "<thead><tr><th>Username</th><th>Fullname</th><th>Email</th><th>Status</th><th>Action</th></tr></thead>\n";
echo "<tbody>\n";
$sql = "SELECT * FROM ".$mysql_table;
$result = mysqli_query($db, $sql);
while ($data = mysqli_fetch_array($result))
{
echo "<tr>\n";
echo "<td>" . $data['username'] . "</td>\n";
echo "<td>" . $data['fullname'] . "</td>\n";
echo "<td>" . $data['email'] . "</td>\n";
echo "<td>" . ($data['active'] == "0" ? "inactive" : "active") . "</td>\n";
echo "<td>\n";
echo " <a href=\"" . basename(__FILE__) . "?action=edit&id=" . $data['username'] . "\" title=\"Edit\"><i class=\"icon-edit\"></i></a> \n";
echo " <a href=\"" . basename(__FILE__) . "?action=delete&id=" . $data['username'] . "\" title=\"Delete\"><i class=\"icon-delete\"></i></a>\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "</tbody>\n";
echo "</table>\n";
echo "<div id=\"footer\">\n";
echo "<ul id=\"pagination\">\n";
echo "<li class=\"disabled\"><a href=\"#\">« Prev</a></li>\n";
echo "<li class=\"disabled\"><a href=\"#\">Next »</a></li>\n";
echo "</ul>\n";
echo "</div>\n";
}
}
?>
</body>
</html>
Re: Edit Profile Error
I'm sorry, but I do not see any issues in the code that can cause this limited.
The only thing I can think of is that there is a restriction to the number of fields in the database.
The only thing I can think of is that there is a restriction to the number of fields in the database.
Re: Edit Profile Error
I didn't see any issues either. All the fields needed are in the database. I can add new users via Admin and they all are saved. I can have the user signup and they are all saved. Once they are added though neither through Admin or Edit Profile can they be updated.
Quite frustrating.
Quite frustrating.
Re: Edit Profile Error
I'm sorry, but I do not think this is directly related to WWB.
You can easily verify this yourself by looking at the code.
You can easily verify this yourself by looking at the code.
Re: Edit Profile Error
I'm trying something new to maybe isolate the problem.
I see that you have a new update that shows the avatar when converted to html. Thanks for doing that.
I noticed though that the button to browse for a new avatar only shows up as a small box and it's not clickable. Could you have a look at that?
I've added a screen shot of what I see. The one on the right is the convert to form.
Thanks again!
![Image](http://www.ppocc.org/members2018test/images/Capture.PNG)
I see that you have a new update that shows the avatar when converted to html. Thanks for doing that.
I noticed though that the button to browse for a new avatar only shows up as a small box and it's not clickable. Could you have a look at that?
I've added a screen shot of what I see. The one on the right is the convert to form.
Thanks again!
Re: Edit Profile Error
It looks like the style sheet is missing.
Did you publish all files?
Did you publish all files?
Re: Edit Profile Error
I did publish the page. Doesn't it upload the style sheet with It?
Re: Edit Profile Error
Yes, if you publish all files.I did publish the page. Doesn't it upload the style sheet with It?
Something is wrong with the styles. So, either the style sheet is missing or there is a naming conflict.