Jump to content

f1sh3r

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

About f1sh3r

  • Birthday 02/17/1983

Profile Information

  • Gender
    Male
  • Location
    Youngstown, Ohio

f1sh3r's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i think i have come up with a solid coding scheme. can someone tell me if this is error prone or bad coding in general? thanks. <html> <body> <?php if (isset($_POST[sup_admin_update])) { foreach ($_POST as $user => $value) { if (is_array($value)) { $admin = implode($value); echo "$user is $admin <br />"; // 84 is 00200, 72 is 01230 // mysql_query ("UPDATE users SET u_access = $admin WHERE u_id = $user") or die(); } else { $$user = $value; echo "$user is $value <br />"; // qupeop is sh, sup_admin_update is Change } } } ?> <form action="index.php" method="post"> <h3>Jill Welsh</h3> <div class="m10"> <!-- hidden variables if they dont check it, it will still pass a 0 --> <input type="hidden" name="84[0]" value="0" /> <input type="hidden" name="84[1]" value="0" /> <input type="hidden" name="84[2]" value="0" /> <input type="hidden" name="84[3]" value="0" /> <input type="hidden" name="84[4]" value="0" /> <input type="checkbox" name="84[1]" id="s84" value="1" /> <label for="s84">Student Worker</label> <input type="checkbox" name="84[2]" id="i84" value="2" checked="checked" /> <label for="i84">Instructor</label> <input type="checkbox" name="84[3]" id="d84" value="3" /> <label for="d84">Program Developer</label> <input type="checkbox" name="84[4]" id="a84" value="4" /> <label for="a84">Super Admin</label> </div> <h3>Julie Sharrow</h3> <div class="m10"> <!-- hidden variables if they dont check it, it will still pass a 0 --> <input type="hidden" name="72[0]" value="0" /> <input type="hidden" name="72[1]" value="0" /> <input type="hidden" name="72[2]" value="0" /> <input type="hidden" name="72[3]" value="0" /> <input type="hidden" name="72[4]" value="0" /> <input type="checkbox" name="72[1]" id="s72" value="1" checked="checked" /> <label for="s72">Student Worker</label> <input type="checkbox" name="72[2]" id="i72" value="2" checked="checked" /> <label for="i72">Instructor</label> <input type="checkbox" name="72[3]" id="d72" value="3" checked="checked" /> <label for="d72">Program Developer</label> <input type="checkbox" name="72[4]" id="a72" value="4" /> <label for="a72">Super Admin</label> </div> <div class="right"> <input type="hidden" name="qupeop" value="sh" /> <input type="submit" name="sup_admin_update" value="Change"> </form> </body> </html>
  2. Ok, i am working on a CMS for a branch of my college that works with continuing education, non traditional students, non-credit classes. In the user table for the DB, i have user access set up in this fashion: user = 00000 student worker = 01000 instructor = 00200 program developer = 00030 super admin = 00004 so its combinable in that a program developer can also have instructor and student worker access = 01230 or that type of deal. super admins have a page where they can delegate access to different users. below is the code that is generated when they search for the "sh". i use the preg_match function to fill in the check boxes that pertain to each persons access level. i know this is probably an easy solution, but im fried. what i need to know is how to successfully mold the changes for each user into a usable format. because i dont know what the u_id is going to be, i dont know how to handle the POST data. What is the best way to set up the form so that the variables/values can be tied to the user? im having a hard time explaining, sorry. i would like to be able to do $id_access = "0".$student.$instructor.$developer.$super; <-not those exact variables, but i need to be able to split up the values from multiple users using a form like the one below. if someone can help me with better names/values for my form or some type of array/foreach/while magic, i would be extremely excited. hopefully someone understands my problem and took the time to read it. thanks. <h2>Found Users</h2> <form name="updateadmin" method="post" action="admin.php?action=sup_delegate"> <h3>Jill Welsh</h3> <div class="m10"> <input type="hidden" name="u84" value="84" /> <input type="checkbox" name="s84" id="s84" value="1" /> <label for="s84">Student Worker</label> <input type="checkbox" name="i84" id="i84" value="2" checked="checked" /> <label for="i84">Instructor</label> <input type="checkbox" name="d84" id="d84" value="3" /> <label for="d84">Program Developer</label> <input type="checkbox" name="a84" id="a84" value="4" /> <label for="a84">Super Admin</label> </div> <h3>Julie Sharrow</h3> <div class="m10"> <input type="hidden" name="u72" value="72" /> <input type="checkbox" name="s72" id="s72" value="1" checked="checked" /> <label for="s72">Student Worker</label> <input type="checkbox" name="i72" id="i72" value="2" checked="checked" /> <label for="i72">Instructor</label> <input type="checkbox" name="d72" id="d72" value="3" checked="checked" /> <label for="d72">Program Developer</label> <input type="checkbox" name="a72" id="a72" value="4" /> <label for="a72">Super Admin</label> </div> <h3>Michael Sheppard</h3> <div class="m10"> <input type="hidden" name="u26" value="26" /> <input type="checkbox" name="s26" id="s26" value="1" /> <label for="s26">Student Worker</label> <input type="checkbox" name="i26" id="i26" value="2" checked="checked" /> <label for="i26">Instructor</label> <input type="checkbox" name="d26" id="d26" value="3" /> <label for="d26">Program Developer</label> <input type="checkbox" name="a26" id="a26" value="4" /> <label for="a26">Super Admin</label> </div> <h3>Ryan Fisher</h3> <div class="m10"> <input type="hidden" name="u35" value="35" /> <input type="checkbox" name="s35" id="s35" value="1" checked="checked" /> <label for="s35">Student Worker</label> <input type="checkbox" name="i35" id="i35" value="2" checked="checked" /> <label for="i35">Instructor</label> <input type="checkbox" name="d35" id="d35" value="3" checked="checked" /> <label for="d35">Program Developer</label> <input type="checkbox" name="a35" id="a35" value="4" checked="checked" /> <label for="a35">Super Admin</label> </div> <h3>Teri Sheely</h3> <div class="m10"> <input type="hidden" name="u87" value="87" /> <input type="checkbox" name="s87" id="s87" value="1" /> <label for="s87">Student Worker</label> <input type="checkbox" name="i87" id="i87" value="2" checked="checked" /> <label for="i87">Instructor</label> <input type="checkbox" name="d87" id="d87" value="3" /> <label for="d87">Program Developer</label> <input type="checkbox" name="a87" id="a87" value="4" /> <label for="a87">Super Admin</label> </div> <div class="right"> <input type="hidden" name="qupeop" value="sh" /> <input type="submit" name="sup_admin_update" value="Change"> </form>
  3. im writing a function for a program im working on... there are a few different things it will do: 1. get original price ($ofee) , and start date ($startdate) of a course 2. if the price is > $99, offer an "early bird" price ($ofee - 20) if registered by 2 weeks prior ($startdate - 14 days) -- im good up to this point -- 3. if the class starts on a saturday or sunday, the "early bird" registration would need to be 15 or 16 days prior (on a friday) because office staff doesnt work weekends my choices? a) find what day (mon, tue, wed...) the class starts on, and act accordingly ($startdate - 15 or 16) b) have something that will only allow weekdays to be displayed c) ? help me out please... im not that good with time manipulation. thanks a bunch.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.