Jump to content

mottwsc

Members
  • Posts

    74
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

mottwsc's Achievements

Member

Member (2/5)

0

Reputation

  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."; }
×
×
  • 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.