Jump to content

mottwsc

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by mottwsc

  1. RESOLVED: I scrapped what I was doing and used the table technique found here: http://css-tricks.com/snippets/css/absolute-center-vertical-horizontal-an-image/
  2. When adding background-size: cover, the image is centered and fills the space; but (1) the window is never scrollable, even when the window is resized to something really small; (2) when the window is resized horizontally, the image shrinks both horizontally and vertically, but I'm just trying to make the image recenter and then stop recentering when it gets to a minimum width of 1024px; (3) when the browser window is maximized, the image is cut off on the bottom (I'm trying to have it all shown unless the window is resized vertically), but when the browser is restored down, the full image shows. So, is there an alternative way to do this? Thanks.
  3. I am trying to get a large background image to be centered at the top of the page but also scroll vertically. This should be straightforward given that scrolling is the default. I have the image where I want it to be displayed but the page will not scroll. I commented out two lines in my CSS just in case. Where am I going wrong? Thanks... CSS body { padding: 0; margin: 0; background-color: #ffffff; background-image: url('Homepage.png'); background-repeat: no-repeat; background-position: center top; background-attachment: scroll; /*width: 100%;*/ /*display: table;*/ } HTML !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" /> <meta NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"/> <link rel="icon" type="image/png" href="favicon.png" /> <link rel="stylesheet" href="/style.css" type="text/css" /> </head> <body> </body> </html>
  4. After some additional research, it looks like it could be done pretty easily in apache using mod_proxy_balancer (https://blogs.oracle.com/oswald/entry/easy_http_load_balancing_with), although this doesn't account for actual load on the servers; it just gives assignments based on counters. Have others used this method with success? Also, I did see some options looking at SourceForge Distributor, balance and pen. Trying to keep the software and implementation costs down as I prove out the concept...
  5. I'm putting up a beta site on a few VPS servers. Server 1 is for log in. When a user hits Server 1, a need to have a simple program to look at things like the CPU utilization, memory usage, and bandwidth utilization at that point on Server 2 and Server 3 and send the user to either Server 2 or Server 3 depending on which server has lower usage. I will have full root / administrative access to the servers. > Does anyone have simple PHP programs similar to this that I could modify? > Where is the best place for this to sit on Server 1? Thanks for any suggestions!
  6. No I do not. However, I decided to use mySQL directly to dump the table and bulk import it. Thanks for the suggestion, though.
  7. I'm using a PHP script to transfer mySQL records in one table one Server A to another table (same table definition) on Server B. I cannot overwrite the existing data in the table on Server B. There are no keys to worry about. The way I'm doing it (see below) takes too long for higher volumes (10K - 100K records). Can anyone describe a fast, efficient way to do this? If it is faster to do something directly in mySQL, please describe how to do that. Thanks! <?php # connect to server A if (!$cxnA = mysqli_connect($serverA, $user, $pw, $db)) { die("Could not connect to MySQL server A"); } # connect to server B if (!$cxnB = mysqli_connect($serverB, $user, $pw, $db)) { die("Could not connect to MySQL server B"); } $sql= "SELECT * FROM tableA"; if (!$result1 = mysqli_query($cxnA,$sql)) { die("error..."); } $num1 = mysqli_num_rows($result1); if( $num1 == 0 ) { echo "no records<br/>"; } else { echo $num1." records<br/>"; while($row1 = mysqli_fetch_assoc($result1)) { extract($row1); $sql=" INSERT INTO tableB ( field1, field2 ) VALUES ( '$field1', '$field2' )"; if (!$result2 = mysqli_query($cxnB,$sql)) { echo "error inserting record<br/>"; } } } ?>
  8. BACKGROUND: I'm using Javascript within some PHP programs. There is a base PHP page with the logic and then a forms PHP page that is required at the end of the base PHP page to render the HTML. The Javascript is in the forms PHP page to display a counter which counts down to 0 at the end of an event. (There are actually two counters but the one of importance for this discussion is the one used for countbox 1, which relies on the variable $seconds1 to be passed in from the base PHP page). When the JavaScript counter reaches zero, it coincides with the page being refreshed by a meta refresh tag (which is set to refresh based on the timing of $content which is passed to it from the base PHP page; the value of $content is set to trigger the refresh at the end of the event as well). Further, I display certain fields before the event and other fields after the event, which means that the HTML which renders is different. PROBLEM: The problem is that, at the end of the event, when the refresh is done, the browser pops up a page reload/resend dialogue box for the user, which ruins the user experience. The refresh occurs several times prior to the event (based on the shorter values of $seconds2 that are passed) and this doesn't cause any problem rerendering the page without the reload/resend dialogue popping up. I believe that the pop up box at the end of the event is being caused because the HTML that is being rendered is different after the event, but I'm not sure. I've tried a number of things, such as a header location command at the end of the base page (but I get an error from that stating that the location cannot be rendered - I assume because I'm redirecting to the same page). I've also tried using a cache-control meta tag by itself as well as triggered off of the end of the event. I'm thinking that the JavaScript could be made to cause a refresh at the end of the event, but I'm not sure. A solution using either JavaScript or PHP would be fine. Any suggestions are appreciated! CODE: base PHP page (partial at end...) <?php # these are only example values... $content = 35; $seconds1 = 35; $seconds2 = 15; # THIS DOES NOT WORK - redirect can't be completed # force a redirect to avoid refresh popup when event ends /* if( $content < 60 and $eventOver == "yes" ) { header("Location: base.php"); } */ require("form.php"); exit; ?> forms PHP page (partial at beginning...) <?php require("header1.php"); /* if( $eventOver == "yes" ) { echo "<META HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">"; } */ #echo "<META HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">"; echo "<meta http-equiv='refresh' content='$content'>"; echo "<title>".htmlentities($name, ENT_QUOTES, 'UTF-8')."</title>"; # countbox1 - displays time until main event end # countbox2 - displays time until next interim event # # calculate time in base PHP so that server's clock is used # then, pass seconds1, seconds2 (for countbox 1,2) echo " <script type='text/javascript'> "; echo " function GetCount(secondsPassed, iid){ amount = secondsPassed; if(amount < 0){ document.getElementById(iid).innerHTML='Now'; window.location.reload(); } else{ days=0;hours=0;mins=0;secs=0;out=''; days=Math.floor(amount/86400); amount=amount%86400; hours=Math.floor(amount/3600); amount=amount%3600; mins=Math.floor(amount/60); amount=amount%60; secs=Math.floor(amount); if(days != 0){out += days +'d ';} if(days != 0 || hours != 0){out += hours +'h ';} if(days != 0 || hours != 0 || mins != 0){out += mins +'m ';} out += secs +'s'; document.getElementById(iid).innerHTML=out; setTimeout(function(){GetCount(secondsPassed-1,iid)}, 1000); } } "; echo " window.onload=function(){ GetCount(".$seconds1.", 'countbox1'); GetCount(".$seconds2.", 'countbox2'); }; </script> "; ?>
  9. doddsey_65, thanks for the suggestion - I'll look into that. Nodral - the problem is that, depending on which of several links is clicked, the code that has to be executed is going to be slightly different, so I can't run one set of code before the html renders. I need to (a) pass a session variable to another server (if needed, depending on the server I'm coming from and going to), and (b) incorporate the right path information in the link.
  10. I have a PHP application where I am trying to execute a PHP routine when the user clicks on a link to go to another page. The routine needs to execute before I use a header location command to send the user to the next location. I can't do this all with JavaScript, but it could be part of the solution if necessary. I'd prefer to just use PHP if I could, but I'm not sure that this is possible. Can anyone share with me a brief example of how I could do this? Thanks!
  11. I have a PHP application that I'm separating into multiple servers to distribute the workload. For example, there will be servers for logging in and servers for maintaining profiles, etc. In general, I use a base page that has the PHP processing logic and then I include another page in it that displays the html for what the user sees. I use a header function a good bit in the base pages to redirect the user to a new page based on what happens in the processing logic. Since they are in the base page, they always occur before the header of the included page so they work fine. header('Location: http://www.example.com/'); I have another part of the application where I need to refresh one of the included html pages because I'm displaying a timer that is counting down to an event. When the countdown ends, the page refreshes. I'm using a meta refresh tag for this, and the content value shown here as 0 is synched up with the timing of the event. <meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html"> Now, because of the multiple servers, I'm trying to determine the best way to create a function that will allow me to redirect to different servers - using the meta refresh tag (which I will still need to use for the one page uses it now for the timers) or the header functions (which are embedded in the base code). Maybe I need both because of where they are in the code. My hesitation in using the meta refresh tag more is that, by using it in most/all of my pages for server redirection, I could get tagged by the search engines as a potential spammer. Can anyone with experience in multiple server environments provide any guidance? Thanks!
  12. I'm developing a LAMP web application that works with desktop browsers. I use PHP to render html and also use CSS and Javascript. I want mobile users to see a few specific pages, but I don't want to have to buy (especially ongoing) a commercial mobile app platform. Is it reasonable to assume that I could reformat using CSS to display something on a small screen and post it on a .mobi page on my website? Is there something I'm missing? Thanks for any suggestions.
  13. This works - thanks silkfire. I understand the escaping of special characters, but why did you wrap everything in hash signs (#)?
  14. This should be simple, but it doesn't seem to work. This preg_match should not be allowing other characters like # % and others, but it does. In other words, it does not hit the error message section if a pound sign or percent sign is entered in the 'answer' field on the form. I'm trying to only allow the characters that are listed: letters, numbers, single quote, exclamation, period, comma, space, dash and question mark. Can anyone see why this wouldn't be working? Thanks! $answerClean = trim($_POST['answer']); if( !preg_match("/^[A-Za-z0-9'!., -?]{2,150}$/", $answerClean) ) { $message = $message."You have not provided a valid answer for the question."; }
  15. OK - I'm providing the specific screen shots and code in order to describe the problems. The attached Word doc shows the screens and describes what is happening. I've included several pieces of code below. PROBLEM 1: The footer is centered but the rest of the page is not. PROBLEM 2: The main menu overflows when zooming to 125% in Firefox 3.6. Thanks for any specific guidance! Here's the page that is being displayed: <?php require("header1.php"); echo "<title>ABCO</title>"; ?> <script type="text/javascript" src="js/mootools.js"></script> <script type="text/javascript" src="js/swfobject.js"></script> <script type="text/javascript" src="js/videobox.js"></script> <link rel="stylesheet" href="css/videobox.css" type="text/css" media="screen" /> <?php require("header2.php"); ?> <body class="front"> <div id="wrapper"> <div id="header" style="margin-left:21px;"> <?php echo "<a href='home'><img class='logo' src='/images/blank.png' alt='' /></a> <ul class='primary-menu'>"; require("menu2.php"); echo "</ul>"; ?> <div class="clear"></div> </div> <div id="banner"> <div class="bannerhead"> <h1 class="logo-big">ABCO</h1> <h2 class="tagline">AB AB AB</h2> </div> <div class="clear"></div> </div> <div id="frontboxes"> <div class="frontbox frontbox-small"> </div> <div class="frontbox frontbox-big"> </div> <div class="frontbox frontbox-small"> </div> <div class="clear"></div> </div> <div class="clear"></div> <?php require("footer.php"); ?> </body> </html> Here's header1.php: <!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" /> Here's header2.php: <link rel="icon" type="image/png" href="favicon.png" /> <link rel="stylesheet" href="/05_a/style.css" type="text/css" /> <link rel="stylesheet" href="/05_a/typography.css" type="text/css" /> </head> <?php $divBackgroundColor = "FFFFFF"; # white ?> Here's the menu bar - menu2.php: <?php echo " <li><a href='01.html'>Test0001</a></li> <li><a href='02.html'>Test2</a></li> <li><a href='03.html'>Test 00003</a></li> <li><a href='04.html'>Test00 000004</a></li> <li><a href='05.html'>Test0005</a></li> <li><a href='06.html'>Test00000006</a></li> <li><a href='07.html'>Test0007</a></li> <li><a href='08.html'>Test 00008</a></li> "; ?> Here's the footer - footer.php: <?php echo " <div id='footer'> <div class='wrapper'> <span class='left'>© ".date('Y')." ABCO, LLC</span> <span class='right'> "; if( isset($auth) ) { if( $auth == "yesIndeed" ) { echo "<a href='/abc_how_to.html'>How To</a> | "; } } echo " <a href='/abc_terms.html'>Terms of Use</a> | <a href='/abc_privacy.html'>Privacy</a> | <a href='/abc_contact.html'>Contact</a></span> <div class='clear'></div> </div> </div> "; ?> Here's the main style sheet - style.css: /* -------------------------------------------------------------- style.css Sets up main style. -------------------------------------------------------------- */ html, #wrapper { height: 100%; min-width:1000px; /* added */ } body > #wrapper{ height: auto; min-height: 100%; min-width:1000px; /* added */ } body.front{ background:#fff url(../images/body-front-bg.png) repeat-x 0 60px; /* background:#fff url(../images/body-front-bg.png) repeat-x 0 62px; */ margin:0; } body.interior{ margin:0; } .wrapper{ margin:0 auto; width:960px; } /* Header */ body.front #header{ float:left; height:62px; /* height:62px; */ /* width:100%; */ width:960px; /* border-bottom:8px solid #08408C; */ /* new */ /*float:left; this does nothing */ } body.interior #header{ float:left; height:60px; /* height:62px; */ width:100%; border-bottom:8px solid #08408C; } .logo{ background:url(../images/logoTEST.png) no-repeat; width:187px; height:50px; float:left; border:medium none; margin:5px 0 0 10px; /* margin:5px 0 0 10px; */ } .logo-bottom{ background:url(../images/logo-videos.png) no-repeat; width:187px; height:50px; float:left; border:medium none; margin:25px 0 0 44px; /* margin:5px 0 0 10px; */ } .maintenance{ margin:27px 0 0 90px; text-align:center; color:#c71585; font-size:13px; font-style:italic; font-weight:bold; border:2px solid #c71585; max-width:800px; } /* Body */ #main{ background:#30524A; /* this is the color used behind the border */ width:100%; /* height:485px; */ height:458px; float:left; position:relative; } #border{ width:960px; /* height:485px; */ height:458px; margin:0 auto; position:relative; } #scenery{ height:100%; position:absolute; width:100%; } #scrollDefault{ /* this is the box for the default background */ background:#fff; /* width:910px; */ width:800px; height:350px; overflow:auto; /* padding:20px; */ padding:20px; /* margin:40px 0; */ /* margin:47px 57px 0 0; /* position of box against background */ margin:36px 60px 0 0; /* position of box against background */ /* float:left; */ float:right; } #scroll{ /* this is the box if there is scenery */ background:#fff; /* width:910px; */ width:800px; height:350px; overflow:auto; /* padding:20px; */ padding:20px; /* margin:40px 0; */ /* margin:47px 57px 0 0; /* position of box against background */ margin:31px 57px 0 0; /* position of box against background */ /* float:left; */ float:right; border:5px solid #125E9A; } .border-extra1{ background:url(../images/border-extra1.png) no-repeat; width:103px; height:97px; position:absolute; left:69px; top:40px; z-index:999; } .border-extra2{ background:url(../images/border-extra2.png) no-repeat; width:183px; height:153px; position:absolute; left:69px; bottom:55px; z-index:999; } .border-extra3{ background:url(../images/border-extra3.png) no-repeat; width:80px; height:15px; position:absolute; right:141px; top:40px; z-index:999; } .border-extra4{ background:url(../images/border-extra4.png) no-repeat; width:91px; height:18px; position:absolute; right:165px; bottom:55px; z-index:999; } #banner{ float:left; height:200px; /* height of blue banner before white starts again */ width:960px; } .bannerhead{ width:754px; height:130px; margin:30px auto 0 auto; } h1.logo-big{ background:url(../images/logo-bigTEST.png) no-repeat; width:486px; height:130px; float:left; border:medium none; overflow:hidden; text-indent:3000px; white-space:nowrap; margin:0; padding:0; } h2.tagline{ background:url(../images/taglineTEST.png) no-repeat; width:258px; height:67px; float:left; overflow:hidden; text-indent:3000px; white-space:nowrap; margin:50px 0 0 10px; padding:0; } .bannermain{ background:url(../images/bannermain-bg.png) no-repeat; width:897px; height:275px; margin:20px auto 0 auto; } #frontboxes{ float:left; height:240px; width:960px; /*padding:0 15px;*/ padding:0 0 25px 25px; margin:10px 0 0 0; } .frontbox{ height:240px; max-height:240px; border:1px solid #b1b1b1; -moz-border-radius:5px; float:left; margin:0 0 0 20px; width:auto; } .frontbox:first-child{ margin:0; } .frontbox-small{ width:218px } .frontbox-right{ /*width:218px; height:200px; float:left; border:medium none;*/ margin:10px 0 0 -5px; } .frontbox-big{ width:458px; } /* Menus */ ul.primary-menu{ width:748px; float:right; margin:12px 0 0 15px; padding:0; list-style:none; } ul.primary-menu li { float:left; line-height:15px; list-style-type:none; margin:5px 5px 0 0; overflow:hidden; padding:0; width:auto; } ul.primary-menu li:hover{ background:transparent url(../images/nav-active.gif) no-repeat scroll left top; color:#FF4E2C; } ul.primary-menu li a{ display:block; font-family:Arial,Helvetica,sans-serif; font-size:12px; font-weight:bold; margin:0 0 0 10px; padding:5px 12px 6px 2px; text-decoration:none; text-transform:uppercase; color:#2c2c2c; } ul.primary-menu li:hover a{ background:transparent url(../images/nav-active.gif) no-repeat scroll right top; color:#FFFFFF !important; text-decoration:none; } /* Sidebar */ #sidebar{ /* width:200px; */ width:170px; /* padding:0 20px 0 0; */ padding:14px 0 0 18px; /* this controls the c__n placement */ float:left; } .note{ text-align:center; clear:both; } /* Footer */ #footer{ border-top:8px solid #08408c; /* padding:10px 0; */ padding:8px 0; width:100%; } #footer-wrap{ width:960px; margin:0 auto; color:#2C2C2C; } #footer-wrap a{ color:#125E9A; } #footer .right a{ color:#2C2C2C; } #footer .left{ margin:0 0 0 15px; } #footer .right{ margin:0 15px 0 0; } Here's the default topography css - topography.css: /* -------------------------------------------------------------- typography.css Sets up default typography. -------------------------------------------------------------- */ /* Default font settings */ body{ font-family:arial,Verdana,sans-serif; font-size:13px; color:#39395e; } /* Headings */ h1,h2,h3,h4,h5,h6{ font-weight: normal; color: #000; margin-top: 10px; } h1{ font-size: 29px; line-height: 1; margin-bottom: 0.3em; color:#9ecd67; } h2{ font-size: 27px; margin-bottom: 0.75em; } h3{ font-size: 24px; line-height: 1; margin-bottom: 1em; } h4{ font-size: 21px; line-height: 1; margin-bottom: 1.25em; } h5{ font-size: 18px; font-weight: bold; margin-bottom: 1.5em; } h6{ font-size: 15px; font-weight: bold; } h1 img, h2 img, h3 img, h4 img, h5 img, h6 img{ margin: 0; } /* Text elements */ p{ margin: 0 0 15px 0; line-height:16px; } p img.left { float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } p img.left-top { float: left; margin: 0.5em 1.5em 1.5em 0; padding: 0; } p img.right{ float: right; margin: 1.5em 0 1.5em 1.5em; } p img.right-top{ float: right; margin: 0.5em 0 1.5em 1.5em; } a:focus, a:hover{ text-decoration: underline; } a{ color: #dc4848; text-decoration: none; outline: none; } blockquote{ background:#ececec; margin:0 0 1.5em 0.7em; padding:10px; color:#000000; display:block; border-left:2px solid #d3d3d3; font-style:italic; } blockquote p{ margin:0; } strong{ font-weight: bold; } em, dfn{ font-style: italic; } dfn{ font-weight: bold; } sup, sub{ line-height: 0; } abbr, acronym{ border-bottom: 1px dotted #666; } address{ margin: 0 0 1.5em; padding:10px; font-style: italic; font-size:13px; font-weight:bold; } del{ color:#666; } pre{ margin: 1.5em 0; white-space: pre; } pre,code,tt{ font: 1em 'andale mono', 'lucida console', monospace; line-height: 1.5; } hr{ border:none; border-top:1px dashed #555; margin:15px 0 0 0; } textarea{ display:block; width:100%; margin:15px 0; } /* Lists */ li ul, li ol{ margin:0 1.5em; } ul, ol{ margin: 0 1.5em 1.5em 1.5em; } ul{ list-style-type: disc; } ul li ul{ list-style-type: circle; } ul li ul li ul{ list-style-type: square; } ol{ list-style-type: decimal; } dl{ margin: 0 0 1.5em 0; } dl dt{ font-weight: bold; } dd{ margin-left: 1.5em; } /* Tables */ table{ width:100%; } th{ font-weight: bold; } thead th{ background: #c3d9ff; } th,td,caption{ padding: 4px 10px 4px 5px; } tr.even td{ background: #e5ecf9; } tfoot{ font-style: italic; } caption{ background: #eee; } /* Misc classes */ .small{ font-size: .8em; margin-bottom: 1.875em; line-height: 1.875em; } .large{ font-size: 1.2em; line-height: 2.5em; margin-bottom: 1.25em; } .hide{ display: none; } .quiet{ color: #666; } .loud{ font-weight:bold; } .highlight{ background:#ff0; } .added{ background:#060; color: #fff; } .removed{ background:#900; color: #fff; } .italized{ font-style:italic; } .first{ margin-left:0; padding-left:0; } .last{ margin-right:0; padding-right:0; } .top{ margin-top:0; padding-top:0; } .bottom{ margin-bottom:0; padding-bottom:0; } .clear{ clear:both !important; } .left{ float:left !important; } .right{ float:right !important; } .block{ display:block !important; } .noblock{ display:inline !important; } .spaceright{ margin-right:10px !important; } .spaceleft{ margin-left:10px !important; } .spacetop{ margin-top:10px !important; } .spacebottom{ margin-bottom:10px !important; } [attachment deleted by admin]
  16. When I view my or other web pages in MSIE 8, it displays about 40% larger than looking at the same pages in Firefox 3.6. My concern is that, for users viewing my site, I don't want the sizing to change (at least not that much), since it messes up my layout. Is there a way, through CSS, to fix this problem (assuming I can detect the browser type)? Thanks for any help...
  17. SELECT e.* , i1.interestDescription AS i1_interestDescription , i2.interestDescription AS i2_interestDescription , i3.interestDescription AS i3_interestDescription FROM EVENTS e LEFT OUTER JOIN Interests AS i1 ON i1.interestID = e.interestID1 LEFT OUTER JOIN Interests AS i2 ON i2.interestID = e.interestID2 LEFT OUTER JOIN Interests AS i3 ON i3.interestID = e.interestID3
  18. I got it. Thanks for your suggestion.
  19. Would you mind showing an example of how to properly do this?
  20. I have two tables: Events EventType VARCHAR(10) InterestID1 INT InterestID2 INT InterestID3 INT Interests InterestID INT InterestDescription VARCHAR(20) I'm trying to query both tables so that, for each row in Events, I can get all fields from Events and the corresponding interestDescription from Interests for each of the three interests (InterestID1, ID2 and ID3). This would output something like: EventType InterestID1 InterestDescription (for ID1) InterestID2 InterestDescription (for ID2) InterestID3 InterestDescription (for ID3) Car Show 3 Engines 6 Interiors 17 Fuel Efficiency However, I can't do this with a query like: SELECT *, i.interestDescription FROM EVENTS e JOIN Interests i on (e.interestID1 = i.interestID or e.interestID2 = i.interestID or e.interestID3 = i.interestID) Can anyone suggest how to do this? Thanks!
  21. The problem was an initial string replace that changed a quote to the safe characters for the purpose of security. $field1 = str_replace("'", "&#39", $field1); I'm surprised that later functions designed to change it back didn't work. Thanks to all for your suggestions.
  22. I've encrypted and decrypted the text "Bill's car" in other processes before I get to this task using $field1Encrypted = rtrim(mcrypt_encrypt($cipher_alg, $key, $field1, MCRYPT_MODE_CBC, $iv)); and $field1 = rtrim(mcrypt_decrypt($cipher_alg, $key, $field1Encrypted, MCRYPT_MODE_CBC, $iv)); I just tried your suggestion $field1 = html_entity_decode(mysqli_real_escape_string($cxnA, $field1), ENT_QUOTES); but I have the same result on the database insert, unfortunately
  23. I have text with an apostrophe (Bill's car) that has been encrypted and decrypted, then inserted into a database. After it is decrypted but before inserting it, I process it with $field1 = mysqli_real_escape_string($cxnA, $field1) When I insert the field and view it in MySQL Query Browser, it shows the converted apostrophe: Bill&#39s car When I select on the field select * from table1 where field1='Bill\'s car' this returns no records I have to use select * from table1 where field1='Bill&#39s car' to get the record, which is very inconvenient If I display this field in a browser using <input type='text' name=field1 value='".htmlentities($field1Value, ENT_QUOTES, 'UTF-8')."' maxlength='50'> I get - Bill&#39s car - in the browser, which is not what I want. I have to use <input type='text' name=field1 value='".htmlspecialchars_decode(htmlentities($field1Value, ENT_QUOTES, 'UTF-8'), ENT_QUOTES)."' maxlength='50'> to get Bill's car to display. The strange thing is that when I echo field1 before it is inserted, it shows Bill's car. I have even tried the following to get it to insert the proper value: $field1 = htmlspecialchars_decode(mysqli_real_escape_string($cxnA, $field1), ENT_QUOTES); but this doesn't work either. How do you prevent this from happening? Thanks.
×
×
  • 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.