Jump to content

MIPS64

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

MIPS64's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have noticed that in Firefox the font size is 1 pixel larger than what is displayed in IE and Chrome. Normally I would not care but the font size difference is pushing an element down by 1px. I have tried doing a CSS reset. I just think its the way Firefox renders it that makes it that way. I am guessing there is no way to fix this problem?
  2. Does it matter if I validate the post variables before or after I sanitize? So sanitize first (using prepared statements so no mysql_real_escape_string)? if (isset($_POST['submit'])) { $username = trim(htmlspecialchars($_POST['username])); if (strlen($username) < 3) { echo 'Username must be at least 3 characters'; } insert data next or if (isset($_POST['submit'])) { if (strlen($_POST['username']) < 3) { echo 'Username must be at least 3 characters'; } $username = trim(htmlspecialchars($_POST['username])); insert data next
  3. Like many, I store my config.php file containing my database connection variables outside of my web root. Is there any reason to NOT store all the other PHP scripts outside the web root as well? Will there be performance issues or something else I am not thinking of? I would literally have just template files available in the web root pointing to the scripts that are outside of it when called upon.
  4. I am struggling to return a row count for a query I have to run on a database using OBDC connection to a MSSQL server. I can get row counts just fine with MySQL. I know the query works because I can run it on the MSSQL server with no problem. When I echo the result I get -1. I am not sure what that means. $sth = $dbh->prepare(" SELECT PatronID FROM Patrons WHERE Barcode = :barcode "); $sth->bindParam(':barcode', $barcode); $sth->execute(); $count = $sth->rowCount(); echo $count; EDIT: I can echo the PatronID just fine. Just not retrieve the row count.
  5. I changed my jQuery a little based off of tutorials though I can't seem to get it to the database. <script type="text/javascript" src="../includes/jquery-1.8.2.js"></script> <script type="text/javascript"> $(function() { $("#save").click(function() { var site_name = $("#site_name").val(); var display_notice = $("#display_notice").val(); var notice = $("#notice").val(); $.ajax({ type: "POST", url: "submit_configuration.php", data: "site_name=" + site_name + "&display_notice=" + display_notice + "&notice=" + notice, }); return false; )}; )}; </script> This is what I get when I put die( print_r($_POST) ); at the top of the page (correct values). Array ( [site_name] => test [display_notice] => 1 [notice] => test [save] => Save Changes ) 1 Firebug showing the POST being made with correct values.
  6. Alright, back to the drawing board I guess. Firebug did see the POST being sent but it's my first time working with Jquery so I'll do some more reading and start from scratch.
  7. I removed the ready function. I removed all my validation for both jquery and PHP because I was trying to troubleshoot and see if anything was conflicting. What type of application do you recommend to monitor network traffic?
  8. I am trying to make my form update without having to refresh it but the data is not being sent to the database. Can you find anything wrong with the jquery? Jquery <script type="text/javascript" src="../includes/jquery-1.8.2.min"></script> <script type="text/javascript"> $(document).ready(function(){ $('#save').click(function(){ var site_name = $("#site_name").val(); var display_notice = $("#display_notice").val(); var notice = $("#notice").val(); $.ajax({ type: "POST", url: "submit_configuration.php", data: "site_name=" + $('#site_name').val() + "&display_notice=" + $('#display_notice').val() + "&notice=" + $('#notice').val(), cache: false, }); }); }); </script> submit_configuration.php <?php include('../includes/mysql.php'); $site_name = $_POST['site_name']; $display_notice = $_POST['display_notice']; $notice = $_POST['notice']; mysql_query("UPDATE configuration SET site_name = '$site_name', display_notice = '$display_notice', notice = '$notice'"); ?> my form <form id="configuration" name="configuration" method="POST" action="" class="form" /> <table class="data1"> <tr> <td width="50%"> <p style="line-height:20px;"><strong>Site Name</strong></p> <p style="line-height:20px;">The name of the site displayed on the title bar of each page.</p> </td> <td width="50%"><input type="text" id="site_name" name="site_name" maxlength="100" style="width:400px" value="<?php echo $row_configuration['site_name']; ?>" /></td> </tr> <tr> <td width="50%"> <p style="line-height:20px;"><strong>Display Notice</strong></p> <p style="line-height:20px;">Show a notice at the top of each page.</p> </td> <td width="50%"><input type="checkbox" id="display_notice" name="display_notice" value="1" <?php if ($row_configuration['display_notice'] == 1) { echo "checked";} ?> style="border:0"/></td> </tr> <tr> <td width="50%"> <p style="line-height:20px;"><strong>Notice Text</strong></p> <p style="line-height:20px;">The text to show when the Display Notice option is checked.</p> </td> <td width="50%"><input type="text" id="notice" name="notice" maxlength="100" style="width:400px" value="<?php echo $row_configuration['notice']; ?>" /></td> </tr> </table> <br /> <p align="center"><input type="submit" id="save" name="save" value="Save Changes" class="submit" /></p> </form>
×
×
  • 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.