Jump to content

MSUK1

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by MSUK1

  1. Hello I'm trying to build a plugin to get my site up to scratch for the new EU laws on cookies coming in place on the 26th What my main goal is a notification that when the users click accept the cookies set on machine but untill a "approval" cookie is found the site shouldn't set any cookies. Ive written this code, which allows me to set & unset a cookies via a form, using php and html, then depending on the submission either set or unset (which is a good start because im a noob!) but: the page needs an extra refresh in order to show the set cookie? does anyone know why or how i can resolve this? kind regards, and thank you <? $set = $_POST["set"]; if($set == "on") setcookie(EURegulations, $set, time() + (20*365*24*60*60), www.domain.net); else if($set == "off") setcookie("EURegulations", "", time()-3600); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>EU Cookie Plugin</title> </head> <body> <?php if (isset($_COOKIE["EURegulations"])) echo "Cookie Permission " . $_COOKIE["EURegulations"] . "!<br />"; else if(!isset($_COOKIE["EURegulations"])) echo "Cookie Permission off"; else echo "Error no cookie Set"; ?> <form name="setform" method="post" action="<?php echo $_SERVER['$PHP_SELF'];?>"> <button name="set" type="submit" value="on">On</button> <button name="set" type="submit" value="off">Off</button> </form> </body> </html>
  2. hello i am using a theme on wordpress and when trying to edit the page just to exclude the side bar, it seems to remove the navigation bar too. When looking at the page templates code, i cannot see anywhere that includes the sidebar or anywhere that includes the nav. this is all thats listed: page.php <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="page"> <?php edit_post_link(' Edit', '<span class="editpost">', '</span>'); ?> <div class="page-content"> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <?php comments_template(); ?> </div> <?php endwhile; endif; ?> <?php get_footer(); ?> i looked at one page template that excludes the sidebar (and navigation consequently) but i cannot again make out where its doing this? landing-page.php <?php /* Template Name: Landing Page */ $body_css = ''; $body_css .= (get_option('tbf1_background_image_file')) ? 'background-image:url('.get_option('tbf1_background_image_file'). ');' : ''; $body_css .= (get_option('tbf1_background_color')) ? 'background-color:'.get_option('tbf1_background_color'). ';' : ''; $body_css .= (get_option('tbf1_background_repeat')) ? 'background-repeat:'.get_option('tbf1_background_repeat'). ';' : ''; $skin_folders = array('silver'=>'skin-silver', 'red'=>'skin-red', 'green'=>'skin-green'); foreach($skin_folders as $key=>$value) { if(get_option('tbf1_skin_color') == $key) { $skin_dir = $value; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> <head> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> <title> <?php echo ($title = wp_title('&#8211;', false, 'right')) ? $title : ''; ?><?php echo ($description = get_bloginfo('description')) ? $description : bloginfo('name'); ?> </title> <meta name="author" content="<?php bloginfo('name'); ?>" /> <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/images/favicon.ico" type="image/x-icon" /> <?php wp_enqueue_script('jquery'); ?> <?php if (is_singular()) wp_enqueue_script('comment-reply'); ?> <?php wp_head(); ?> <link href="<?php bloginfo('template_url'); ?>/style.css" type="text/css" rel="stylesheet" /> <?php if(isset($skin_dir)):?> <link href="<?php bloginfo('template_url'); ?>/images/<?php echo $skin_dir?>/style.css" type="text/css" rel="stylesheet" /> <?php endif;?> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/functions.js"></script> </head> <body <?php echo (version_compare($wp_version, '2.8', '>=')) ? body_class() : ''?> <?php echo ($body_css) ? 'style="'.$body_css. '"' : ''?>> <div id="bg" <?php echo (get_option('tbf1_header_image_file')) ? 'style="background-image:url('.get_option('tbf1_header_image_file'). ')"' : ''?>> <div id="shadow"> <div id="header"> <img src="http://www.mzccserver.com/wp-content/themes/intrepidity/images/logo223.png" width="900" height="177" /> </div> <div id="container"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php edit_post_link('Edit', '<p><span class="editpost">', '</span></p>'); ?> <?php the_content(''); ?> <?php endwhile; endif; ?> </div> <?php if(get_option('tbf1_landing_footer') != 'hidden'): ?> <div id="footer" <?php echo (get_option('tbf1_footer_image_file')) ? 'style="background:url('.get_option('tbf1_footer_image_file'). ') no-repeat"' : ''?>> <div class="footer-content"> <div class="footer-widget"> <ul class="footerlinks"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer Left") ) : ?> <li><strong>Footer Left Content</strong><br />To replace this texts, go to "Widgets" page and start adding your own widgets to "Footer Left" section.</li> <?php endif; ?> </ul> </div> <div class="footer-widget"> <ul class="footerlinks"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer Middle") ) : ?> <li><strong>Footer Middle Content</strong><br />To replace this texts, go to "Widgets" page and start adding your own widgets "Footer Middle" section.</li> <?php endif; ?> </ul> </div> <div class="footer-widget"> <ul class="footerlinks"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer Right") ) : ?> <li><strong>Footer Right Content</strong><br />To replace this texts, go to "Widgets" page and start adding your own widgets "Footer Right" section.</li> <?php endif; ?> </ul> </div> <div class="recover"></div> </div> <span id="copyright"><span class="alignleft"><?php _e('Copyright © ')?> <script type="text/javascript"> /* <![CDATA[ */ var startCopyrightYear = <?php echo (get_option('tbf1_copy_year')) ? get_option('tbf1_copy_year') : "''" ?>; if(!startCopyrightYear) { var d=new Date(); startCopyrightYear = d.getFullYear(); } printCopyrightYears(startCopyrightYear) /* ]]> */ </script> <?php echo bloginfo('site_name')?></span><span id="footer-tag"> | <a href="http://www.topblogformula.com/wordpress-business-themes/intrepidity" target="_blank">intrepidity</a> Theme <?php _e('by')?> <a href="http://www.topblogformula.com/" target="_blank">Top Blog Formula</a> on <a href="http://www.wordpress.org" target="_blank">WordPress</a></span> | <?php if(is_user_logged_in()):?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php echo _e('Log Out') ?>"><?php echo _e('Log Out'); ?></a> <?php else:?> <a href="<?php echo bloginfo('url')?>/wp-login.php"><?php _e('Log In'); ?></a> <?php endif;?> </span> </div><!--/footer--> <?php else: ?> <div id="footer-bottom"></div> <?php endif; ?> </div><!--/shadow--> </div><!--/bg--> <?php wp_footer(); ?> </body> </html> all help greatly appreciated
  3. thank you, knew i was doing something silly!
  4. just a nooby question why do you use the post data instead of variable data for the insert? Your code: VALUES ('$_POST[firstname]', '$_POST[lastname]', '$_POST[username]', '$_POST[password]')"; What i would use: VALUES ($firstname, $lastname, $username, $passwprd)";
  5. I finally found an efficient way to get this done thank you for all your help and explanations! Fantastic forum this is!
  6. Hello, i want to use a select field to select an area in london and then refresh the page and show a map accordingly this is the code im working with so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Coming Soon</title> </head> <body> <div style="margin-left:auto; margin-right:auto; width:960px; margin-top:150px;"> <form name="map" method="get" action=""> <select onchange="document.map.submit()"> <option value="hendon">Hendon</option> <option value="facebpl">Hendon</option> <option value="toelle">Hendon</option> </select> </form> </div> </body> </html> whats happening at the moment, when you select a field it just loads the page with a "?" at the end but no value like ?map=toelle i have the php code needed to get the information from the addressbar and show the according map all help appreciated thank you
  7. hello, i would like to make a select field in my form pull data from my database. im okay at the php required to return the results (i think) but, how do i make it so that when a user selects an option to update the form. for example, if i wanted to edit a user, i would select the user from the list. and it would pull that users info into the form?
  8. perhaps you might want to include a unique id to each comment, then you can use an sql query to remove the comment based on its ID.
  9. why is the password already set? and then you md5 the pass again? perhaps thats why its not letting you login?
  10. The problem is this makes my code between my body tags a lot more bulky than it needs to be for me? (i hope that makes sense?) i like to set my functions above or outside of the page they may need to be used on and then call upon them when neeeded using only one line of code inside the body of the site?
  11. that makes total sense, i understand further now the idea behind it if i had function name($v1, $v2, $v3) that would correspond to the vaules inputted when i call that function name(a, b, c); ?
  12. really appreicate this guys ok so im trying to use some of your methods but its just causing syntax errors left right center... first tried adding $session->username to pass the username into the function, but that gives me a function not defined error i then tried passing $username from session itself into the function, just by doing function displayMembers($username) { // i noticed in your examples you included ';' after the brackets. when i added this i got syntax errors again ? Forgive my noobyness really trying to get this right thank you
  13. this is making more and more sense, thank you! i did a bit more googling using phrases you have suggested, is it okay, to use the global feature? so global $myUname ? i have made sure myUname is a complete unique variable and is not used anywhere else in my system
  14. i kind of am making sense of what you are saying but when i try and get the username within the function it returns a blank, which i guess as your right explains why im getting this error. but i then tried to define the username inside the function */ function displayMembers(){ $myUname = $session->username; echo "$myUname"; global $database; $q = "SELECT * " ."FROM ".TBL_MEMBERS." WHERE leader = '$myUname'"; echo "$q"; etc etc but i cant get it to work :/ im not that pro a coder :/
  15. SELECT * FROM members WHERE leader = '' so its not reading the variable :/ but why it doesnt make sense, im echoing the variable above and its reading it
  16. thaanks for your reply what ive done is: $myUname = trim($session->username); to trim the variable but it still returns databse empty i'm also trying to echo $q but nothing seems to be returned i think i have something clearing q after its been queried?
  17. i will try this just to shed a bit of light... if i put an actual username into the WHERE lets say 'admin' it works and only displays admin's members if i put the variable into the WHERE my '$myUname' (which as you can see i echo earlier and it correctly echos 'admin' then i get my db empty error
  18. $query = mysql_query("SELECT * FROM membersdetails WHERE name=`$username` "); should be $query = mysql_query("SELECT * FROM membersdetails WHERE name='$username' "); you are still using backticks
  19. Hello i have a system where leaders add members, i want to display a table of members WHERE the 'leader' field equals 'myusername' so that leaders only see members they added. when using the WHERE function i get a database empty as the result :'( but when i remove the WHERE function i get all the data returned include("system/include/session.php"); $myUname = $session->username; echo "$myUname"; function displayMembers(){ global $database; $q = "SELECT * " ."FROM ".TBL_MEMBERS." WHERE leader = '$myUname'"; $result = $database->query($q); $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; } if($num_rows == 0){ echo "Database table empty"; return; } echo "<table>\n"; echo "<thead> <tr> <th>Full Name</th> <th>Gender</th> <th>DOB</th> <th>Post Code</th> <th>Email Address</th> <th>Edit User</th> </tr> </thead>\n"; for($i=0; $i<$num_rows; $i++){ $Mprefix = mysql_result($result,$i,"prefix"); $Mfname = mysql_result($result,$i,"firstname"); $Mlname = mysql_result($result,$i,"lastname"); $Mgender = mysql_result($result,$i,"gender"); $Mdob = mysql_result($result,$i,"dob"); $Mpostcode = mysql_result($result,$i,"postcode"); $Memail = mysql_result($result,$i,"email"); echo " <tbody> <tr> <td>$Mprefix $Mfname $Mlname</td> <td>$Mgender</td> <td>$Mdob</td> <td>$Mpostcode</td> <td>$Memail</td> <td> <center> <form action=\"system/admin/adminprocess.php\" method=\"POST\"> <input type=\"hidden\" name=\"deluser\" value=\"$uname\"> <input type=\"hidden\" name=\"subdeluser\" value=\"1\"> <input type=\"submit\" class=\"button plain\" value=\"Edit Member\"> </form> </center> </td> </tr> </tbody>\n"; } echo "</table><br>\n"; } all help i am thankful for
  20. just a heads up, i this was my database structure # Column Type Collation Attributes Null Default Extra Action 1 memberid int( latin1_general_ci no autoincrement Change Drop More 2 firstname varchar(50) latin1_general_ci No None Change Drop More 3 lastname varchar(50) latin1_general_ci No None Change Drop More 4 email varchar(50) latin1_general_ci No None Change Drop More 5 prefix varchar(20) latin1_general_ci No None Change Drop More 6 address1 varchar(20) latin1_general_ci No None Change Drop More 7 postcode varchar(50) latin1_general_ci No None Change Drop More 8 gender varchar(20) latin1_general_ci No None Change Drop More 9 dob varchar(20) latin1_general_ci No None Change Drop More 10 notes varchar(2000) latin1_general_ci No None Change Drop More 11 leader varchar(50) latin1_general_ci No None Change Drop More
  21. Hello i am trying to submit members information into a database, i have checked the form variables and all the data is being passed. i can get my errors in the data returned, but i cant get a succes or fail error that i setup it just refreshes the page :/ but i still am not getting the data into my DB i will provide below the specific code related to this query starting with php form. Form HTML <? if(isset($_SESSION['regsuccess'])){ /* Registration was successful */ if($_SESSION['regsuccess']){ echo "<h3>Registered!</h3>"; echo "<p>Thank you, your new member has been added to the database.</p>"; } /* Registration failed */ else{ echo "<h3>Registration Failed</h3>"; echo "<p>We're sorry, but an error has occurred and your registration for the new user</b>, " ."could not be completed.<br>Please try again at a later time.</p>"; } unset($_SESSION['regsuccess']); } ?> <form action="system/process.php" method="post"> <div class="column-left"> <p> <input type="text" id="fname" name="fname" placeholder="First Name" class="{validate:{required:true, minlength:3}}" /> <span style="color:red;"><? echo $form->error("fname"); ?></span> </p> <p> <select name="prefix" id="prefix" placeholder="Prefix" class="{validate:{required:true}}"> <option>Mr</option> <option>Mrs</option> <option>Miss</option> <option>Master</option> </select> <span style="color:red;"><? echo $form->error("prefix"); ?></span> </p> <div class="combined"> <p class="large"> <input type="text" id="address1" name="address1" placeholder="Address Line 1" class="{validate: {required:true}}" /> </p> <p class="small"> <input type="text" id="postcode" name="postcode" placeholder="Post Code" class="{validate: {required:true}}" /> </p> </div> <p> <span style="color:red;"><? echo $form->error("address1"); ?></span> </p> <p> <span style="color:red;"><? echo $form->error("postcode"); ?></span> </p> <div class="column-left"> <p> <input type="checkbox" name="gender" id="female" value="female" /> <label for="female">Female</label> </p> </div> <div class="column-right"> <p> <input type="checkbox" name="gender" id="male" value="male" /> <label for="male">Male</label> </p> </div> <p> <span style="color:red;"><? echo $form->error("gender"); ?></span> </p> <div class="clear"></div> <p> <input type="text" name="dob" class="datepicker" id="date" placeholder="Date of Birth" /> <span class="icon calendar"></span> <span style="color:red;"><? echo $form->error("dob"); ?></span> </p> </div> <div class="column-right"> <p> <input type="text" id="lname" name="lname" placeholder="Last Name" class="{validate:{required:true, minlength:3}}" /> <span style="color:red;"><? echo $form->error("lname"); ?></span> </p> <p> <input type="text" id="email" name="email" placeholder="Email Address" class="{validate:{required:true, minlength:3}}" /> <span style="color:red;"><? echo $form->error("email"); ?></span> </p> <h6>Notes</h6> <p> <textarea id="notes" name="notes" class="{validate:{required:true}}"></textarea> <span style="color:red;"><? echo $form->error("notes"); ?></span> </p> <div class="bottom"> <p class="warning"> Warning: All fields are required. </p> </div> </div> <div class="clear"></div> <div class="action_bar"> <input type="submit" class="button blue" value="Submit Post" /> <a href="#modal" class="modal button">Cancel</a> </div> <input type="hidden" name="leadername" value="<? echo"$session->username";?>" /> <input type="hidden" name="newmem" value="1" /> </form> process.php page include("include/session.php"); this is used to define what function to follow /* Add new Leader Member */ else if(isset($_POST['newmem'])){ $this->procNewLMember(); } /** * procNewLMember **/ function procNewLMember(){ global $session, $form; /* Registration attempt */ $retval = $session->newmemb($_POST['fname'], $_POST['lname'], $_POST['email'], $_POST['prefix'], $_POST['address1'], $_POST['postcode'], $_POST['gender'], $_POST['dob'], $_POST['notes'], $_POST['leadername']); /* Registration Successful */ if($retval == 0){ $_SESSION['regsuccess'] = true; header("Location: ".$session->referrer); } /* Error found with form */ else if($retval == 1){ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } /* Registration attempt failed */ else if($retval == 2){ header("Location: ".$session->referrer); } } session.php page include("database.php"); include("mailer.php"); include("form.php"); /** * register new member - register a new leaders member */ function newmemb($subfname, $sublname, $subemail, $subprefix, $subaddress1, $subpostcode, $subgender, $subdob, $subnotes, $subleadername){ global $database, $form, $mailer; //The database, form and mailer object /* First Name error checking */ $field = "fname"; //Use field name for first name if(!$subfname || strlen($subfname = trim($subfname)) == 0){ $form->setError($field, "* First Name not entered"); } else{ /* Spruce up username, check length */ $subfname = stripslashes($subfname); if(strlen($subfname) < 5){ $form->setError($field, "* First Name below 5 characters"); } else if(strlen($subfname) > 30){ $form->setError($field, "* First Name above 30 characters"); } } /* Last Name error checking */ $field = "lname"; //Use field name for first name if(!$sublname || strlen($sublname = trim($sublname)) == 0){ $form->setError($field, "* Last Name not entered"); } else{ /* Spruce up username, check length */ $sublname = stripslashes($sublname); if(strlen($sublname) < 5){ $form->setError($field, "* Last Name below 5 characters"); } else if(strlen($sublname) > 30){ $form->setError($field, "* Last Name above 30 characters"); } } /* Address 1 error checking */ $field = "address1"; //Use field name for first name if(!$subaddress1 || strlen($subaddress1 = trim($subaddress1)) == 0){ $form->setError($field, "* Address not entered"); } else{ /* Spruce up username, check length */ $sublname = stripslashes($sublname); if(strlen($subaddress1) < 5){ $form->setError($field, "* Address below 5 characters"); } else if(strlen($subaddress1) > 30){ $form->setError($field, "* Address above 30 characters"); } } /* Postcode error checking */ $field = "postcode"; //Use field name for first name if(!$subpostcode || strlen($subpostcode = trim($subpostcode)) == 0){ $form->setError($field, "* Post Code not entered"); } else{ /* Spruce up username, check length */ $subpostcode = stripslashes($subpostcode); if(strlen($subpostcode) < 5){ $form->setError($field, "* Postcode below 5 characters"); } else if(strlen($subpostcode) > 30){ $form->setError($field, "* Postcode above 30 characters"); } } /* Prefix error checking */ $field = "prefix"; //Use field name for first name if(!$subprefix || strlen($subprefix = trim($subprefix)) == 0){ $form->setError($field, "* Please select a prefix"); } else{ } /* Gender error checking */ $field = "gender"; //Use field name for first name if(!$subgender || strlen($subgender = trim($subgender)) == 0){ $form->setError($field, "* Please select a gender"); } else{ } /* DOB error checking */ $field = "dob"; //Use field name for first name if(!$subdob || strlen($subdob = trim($subdob)) == 0){ $form->setError($field, "* Please enter a D.O.B"); } else{ } /* Notes error checking */ $field = "notes"; //Use field name for first name if(!$subnotes || strlen($subnotes = trim($subnotes)) == 0){ $form->setError($field, "* Please enter some notes"); } else{ } /* Email error checking */ $field = "email"; //Use field name for email if(!$subemail || strlen($subemail = trim($subemail)) == 0){ $form->setError($field, "* Email not entered"); } else{ /* Check if valid email address */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ $form->setError($field, "* Email invalid"); } $subemail = stripslashes($subemail); } /* Errors exist, have user correct them */ if($form->num_errors > 0){ return 1; //Errors with form } /* No errors, add the new account to the */ else{ if($database->addNewLMember($subfname, $sublname, $subemail, $subprefix, $subaddress1, $subpostcode, $subgender, $subdob, $subnotes, $subleadername)){ return 0; //New user added succesfully }else{ return 2; //Registration attempt failed } } } database.php include("constants.php"); class MySQLDB { var $connection; //The MySQL database connection var $num_active_users; //Number of active users viewing site var $num_active_guests; //Number of active guests viewing site var $num_members; //Number of signed-up users /* Note: call getNumMembers() to access $num_members! */ /* Class constructor */ function MySQLDB(){ /* Make connection to database */ $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME, $this->connection) or die(mysql_error()); /** * addNewLMember - Inserts the given to member database */ function addNewLMember($fname, $lname, $email, $prefix, $address1, $postcode, $gender, $dob, $notes, $leadername){ $q = "INSERT INTO ".TBL_MEMBERS." VALUES ('$fname', '$lname', '$email', '$prefix', '$address1', '$postcode', '$gender', '$dob', '$notes', '$leadername')"; return mysql_query($q, $this->connection); } /** * query - Performs the given query on the database and * returns the result, which may be false, true or a * resource identifier. */ function query($query){ return mysql_query($query, $this->connection); } }; /* Create database connection */ $database = new MySQLDB; constant.php /** * Database Constants - these constants are required * in order for there to be a successful connection * to the MySQL database. Make sure the information is * correct. */ define("DB_SERVER", "XX"); define("DB_USER", "XX"); define("DB_PASS", "XX"); define("DB_NAME", "XX"); /** * Database Table Constants - these constants * hold the names of all the database tables used * in the script. */ define("TBL_USERS", "users"); define("TBL_MEMBERS", "members"); define("TBL_ACTIVE_USERS", "active_users"); define("TBL_ACTIVE_GUESTS", "active_guests"); define("TBL_BANNED_USERS", "banned_users"); i have blanked out my database information but it is their and does connect, another form process of mine does work just not this one :? all help appreciated
  22. I just quickly tried this method, and got a 500 internal server error -- Taking this further, how can i use the second method i posted whilst keeping the server set to "no indexing" when i enabled this in cpanel i again got another 500 internal server error for this: RewriteEngine On RewriteBase / # remove .php; use THE_REQUEST to prevent infinite loops RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP RewriteRule (.*)\.php$ $1 [R=301] # remove index RewriteRule (.*)/index$ $1/ [R=301] # remove slash if not directory RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 [R=301] # add .php to access file, but don't redirect RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L][color=red][b]Options -Indexes[/b][/color]
  23. <form action="/" method="post"> <div class="column"> <p> <select name="user" id="user" placeholder="Select A User To Edit"> <option>Select A User To Edit</option> </select> <span class="SC_red">Required - Please select the user to edit.</span> </p> <p> <select name="updlevel" id="updlevel" placeholder="Select A User Role"> <option>Select A User Role</option> <option value="9">Admin</option> <option value="1">Leader</option> </select> <span class="SC_grey">Optional - Please choose a new user role.</span> </p> <p> <input type="password" id="newpass" placeholder="password" name="newpass" /> <span class="SC_grey">Optional - Please make a copy of this password.</span> </p> </div> <div class="action_bar"> <input type="submit" class="button blue" value="Submit Post" /> <a href="#modal" class="modal button">Cancel</a> </div> </form> this is chrome's view source of the form i think it might be a conflict of code so i altered my scripts variable to ensure no conflicts i'll past full source now from raw code <?php include("system/include/session.php"); /** * displayUsers - Displays the users database table in * a nicely formatted html table. */ function displayUsers(){ global $database; $q = "SELECT username,userlevel,email,timestamp " ."FROM ".TBL_USERS." ORDER BY userlevel DESC,username"; $result = $database->query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if(!$result || ($num_rows < 0)){ echo "Error displaying info"; return; } if($num_rows == 0){ echo "Database table empty"; return; } /* Display table contents */ echo "<table>\n"; echo "<thead> <tr> <th>Username</th> <th><a href=\"#\" class=\"button tooltip\" original-title=\"9 = Admin :: 1 = Leader\">User Level<span class=\"icon16 question\"></span></a></th> <th>Email</th> <th>Edit</th> </tr> </thead>\n"; for($i=0; $i<$num_rows; $i++){ $uname = mysql_result($result,$i,"username"); $ulevel = mysql_result($result,$i,"userlevel"); $email = mysql_result($result,$i,"email"); echo "<tbody><tr><td>$uname</td><td>$ulevel</td><td>$email</td><td><a href=\"#edituser\" class=\"button modal plain\">Edit</a></td></tr></tbody>\n"; } echo "</table><br>\n"; } /** * editUserForm - Displays the users database table in * a nicely formatted field table. */ function editUserForm(){ $sq = "SELECT * " ."FROM ".TBL_USERS." ORDER BY username ASC"; $selectresult = $database->query($sq); while ($srow = mysql_fetch_assoc($selectresult)) { echo '<option value="'.$srow["username"].'">'.$srow["username"].'</option>'; } } if($session->logged_in){ ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="viewport" content="width=1024px, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title></title> <!-- Stylesheets --> <link rel="stylesheet" href="css/reset.css" /> <link rel="stylesheet" href="css/icons.css" /> <link rel="stylesheet" href="css/formalize.css" /> <link rel="stylesheet" href="css/checkboxes.css" /> <link rel="stylesheet" href="css/sourcerer.css" /> <link rel="stylesheet" href="css/jqueryui.css" /> <link rel="stylesheet" href="css/tipsy.css" /> <link rel="stylesheet" href="css/calendar.css" /> <link rel="stylesheet" href="css/tags.css" /> <link rel="stylesheet" href="css/selectboxes.css" /> <link rel="stylesheet" href="css/960.css" /> <link rel="stylesheet" href="css/main.css" /> <link rel="stylesheet" media="all and (orientation:portrait)" href="css/portrait.css" /> <link rel="apple-touch-icon" href="apple-touch-icon-precomposed.png" /> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/excanvas.js"></script> <![endif]--> <!-- JavaScript --> <script src="js/jquery.min.js"></script> <script src="js/jqueryui.min.js"></script> <script src="js/jquery.cookies.js"></script> <script src="js/jquery.pjax.js"></script> <script src="js/formalize.min.js"></script> <script src="js/jquery.metadata.js"></script> <script src="js/jquery.validate.js"></script> <script src="js/jquery.checkboxes.js"></script> <script src="js/jquery.chosen.js"></script> <script src="js/jquery.fileinput.js"></script> <script src="js/jquery.datatables.js"></script> <script src="js/jquery.sourcerer.js"></script> <script src="js/jquery.tipsy.js"></script> <script src="js/jquery.calendar.js"></script> <script src="js/jquery.inputtags.min.js"></script> <script src="js/jquery.wymeditor.js"></script> <script src="js/jquery.livequery.js"></script> <script src="js/jquery.flot.min.js"></script> <script src="js/application.js"></script> </head> <body> <!-- Primary navigation --> <nav id="primary"> <ul> <li> <a href="dashboard"> <span class="icon32 dashboard"></span> Dashboard </a> </li> <li> <a href="members"> <span class="icon32 group"></span> My Users </a> </li> <li> <a href="information"> <span class="icon32 info"></span> Information </a> </li> <li> <a href="settings"> <span class="icon32 cog"></span> My Settings </a> </li> <? if($session->isAdmin()){ ?> <li class="active"> <a href="admin"> <span class="icon32 tools"></span> Admin </a> </li> <? } ?> <li class="bottom"> <a href="system/process.php"> <span class="icon32 quit"></span> Log out </a> </li> </ul> </nav> <section id="maincontainer"> <div id="main" class="container_12"> <? if($session->isAdmin()){ ?> <h1>Admin Area</h1> <p>Welcome to the Admin Area. Only a select few can see this portal. Here you may add and remove leaders, edit permissions and manage the system.</p> <div class="column-left"> <div class="box"> <div class="box-header"> <span class="icon16 tools"></span><h1>MZCC Leaders</h1> </div> <div class="box-content"> <? displayUsers(); ?> </div> </div> <div class="box"> <div class="box-header"> <span class="icon16 tools"></span><h1>MZCC Leaders</h1> </div> <div class="box-content"> <? displayUsers(); ?> </div> </div> </div> <div class="column-right"> <div class="box"> <div class="box-header"> <span class="icon16 tools"></span><h1>Admin Area</h1> </div> <div class="box-content"> <h3>Add A New User</h3> <? if(isset($_SESSION['regsuccess'])){ /* Registration was successful */ if($_SESSION['regsuccess']){ echo "<h3>Registered!</h3>"; echo "<p>Thank you <strong>".$_SESSION['reguname']."</strong>, has been added to the database.</p>"; } /* Registration failed */ else{ echo "<h1>Registration Failed</h1>"; echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, " ."could not be completed.<br>Please try again at a later time.</p>"; } unset($_SESSION['regsuccess']); unset($_SESSION['reguname']); } ?> <form action="system/process.php" method="post"> <div class="column"> <p> <select name="userlevel" id="userlevel" placeholder="Select A User Role"> <option>Leader</option> </select> <span class="SC_grey">Default user role: Leader</span> </p> <p> <input type="text" id="user" placeholder="Username" name="user" /> </p> <p> <input type="password" id="pass" placeholder="password" name="pass" /> </p> <p> <input type="text" id="email" placeholder="Email Address" name="email" /> </p> <input type="hidden" name="subjoin" value="1"> </div> <div class="action_bar"> <input type="submit" class="button blue" value="Add New User" /> </div> </form> </div> </div> <div class="box"> <div class="box-header"> <span class="icon16 tools"></span><h1>Admin Area</h1> </div> <div class="box-content"> <h3>Edit A Leader</h3> <form action="/" method="post"> <div class="column"> <p> <select name="user" id="user" placeholder="Select A User To Edit"> <option>Select A User To Edit</option> <? editUserForm(); ?> </select> <span class="SC_red">Required - Please select the user to edit.</span> </p> <p> <select name="updlevel" id="updlevel" placeholder="Select A User Role"> <option>Select A User Role</option> <option value="9">Admin</option> <option value="1">Leader</option> </select> <span class="SC_grey">Optional - Please choose a new user role.</span> </p> <p> <input type="password" id="newpass" placeholder="password" name="newpass" /> <span class="SC_grey">Optional - Please make a copy of this password.</span> </p> </div> <div class="action_bar"> <input type="submit" class="button blue" value="Submit Post" /> <a href="#modal" class="modal button">Cancel</a> </div> </form> </div> </div> </div> <div class="clear"></div <? } ?> <? if(!$session->isAdmin()){ ?> <div class="box grid_12 alpha"> <div class="box-header"> <span class="icon16 alert"></span><h1>Permission Denied</h1> </div> <div class="box-content"> <h1>Permission Denied</h1> <p>You do not have sufficient privilidges to view this page.</p> </div> </div> <? } ?> </div> </section> </body> </html> <? } else{ header('Location: http://domain/login.php'); } ?>
  24. Hello, i am trying to get my form to list usernames ascending as an option, but the select field just returns blank. Here is my code: /** * editUserForm - Displays the users database table in * a nicely formatted field table. */ function editUserForm(){ $q = "SELECT * " ."FROM ".TBL_USERS." ORDER BY username ASC"; $result = $database->query($q); while ($row = mysql_fetch_assoc($result)) { echo '<option value="'.$row["username"].'">'.$row["username"].'</option>'; } } <form action="/" method="post"> <div class="column"> <p> <select name="user" id="user" placeholder="Select A User To Edit" class="{validate:{required:true}}"> <option>Select A User To Edit</option> <? editUserForm(); ?> </select> </p> <div class="action_bar"> <input type="submit" class="button blue" value="Submit Post" /> <a href="#modal" class="modal button">Cancel</a> </div> </form> All help is appreciated
  25. Thank you for your quick reply i also found this on the web which could be of good use to extend this idea RewriteEngine On RewriteBase / # remove .php; use THE_REQUEST to prevent infinite loops RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP RewriteRule (.*)\.php$ $1 [R=301] # remove index RewriteRule (.*)/index$ $1/ [R=301] # remove slash if not directory RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 [R=301] # add .php to access file, but don't redirect RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L]
×
×
  • 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.