Jump to content

dombrorj

Members
  • Posts

    67
  • Joined

  • Last visited

    Never

Everything posted by dombrorj

  1. Got it... window.setTimeout('window.onbeforeunload="null"; window.location="nextpage.php"; ',6000);}
  2. I have an exit popup script on a landing page that redirects the user to another URL with an "Are you sure you want to leave" alert box when the user tries to X out of the window. This works fine. On the same page I also have the following to redirect the page after a certain time... window.setTimeout('window.location="nextpage.php"; ',6000);} The problem I'm running into is that when the page redirects, it triggers the exit pop. I disable this function with clickable links on the page by using... <a href="link.html" onClick="window.onbeforeunload=null;" /> I can't quite figure out how to integrate that line of code with my redirect script to disable the exit pop. Any suggestions on how this could be accomplished? Thanks!
  3. I'm using the following javascript code to load contents of an iframe. When the user clicks the "next" button, the contents of the iframe loads the next item in the array. Works great. What I'd like to do is have the script cycle through the items of the array. When it has gone through every item, it then redirects the parent window to a new URL. Do you know how I can implement that? Here's the code... <script> var urls =new Array('http://cvs.com','http://target.com','http://walgreens.com'); I=0; function next() { I-=1; if(I==-1)I=urls.length-1; window.frames['links'].location.href=urls[i]; } </script> </head> <iframe src="http://reddit.com" name="links" frameborder="0" height="500px" width="80%" scrolling="no">Iframe Not Supported. Please Use a Different Browser</iframe> <p align="center"><a href="javascript:next()"><img src="images/next.jpg" width="201" height="65" border="0" /></a></p> Thanks!
  4. Thought that would have done the trick too, but not so much in this case. What I finally did to get it to work was change the form design from a background image to a html img src and positioned it by floating right with some margin/padding. I could then wrap that in a div, set it to relative positioning, and get my fields to line up correctly (with the fields inside the div for the form image). Not sure why it worked this way and not the other, but it works.
  5. I have a couple form fields wrapped in divs that I'm trying to position over an image by using absolute positioning. Everything lines up perfectly well in all browsers I've tested except for FF. I've tested IE, Chrome, Safari and Opera. I've probably spend 2 full days now trying different things, and I'm in the exact same place as where I started. I'm sure whatever I'm missing is brain-dead simple and I'll smack myself in the head, but I can't seem to figure it out. Hoping a fresh pair of eyes might help. The issue is very minor in fact... the divs that I'm trying to position are just about 3 pixels above where they need to be and just needs to be shifted down in FF only. Here's the CSS and HTML code. The issue is with the forms that are wrapped in the #form1 div (#zip, #buttonid, #extraform1, #extraform2 divs). Note that the values in extraform1 and extraform2 are not actually submitted. They're just there for place holders. Thanks in advance to anyone that can help me out. html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, sub, sup, tt, var, b, u, i, center, dl, dt, dd, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; } p, ul { font-family:Verdana, Geneva, sans-serif; font-size:14px; padding-top: 0; padding-bottom: 0; padding-left: 30px; padding-right: 25px; } /* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { } ul { margin-left:50px; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; } #topcontainer { background-image: url(images/bg.png); background-repeat: repeat-x; background-color: #ececec; } #header { background-image: url(images/header.png); height: 162px; width: 821px; margin-right: auto; margin-left: auto; } #form1 { float: right; height: 344px; width: 311px; background-image: url(images/form1.png); background-repeat: no-repeat; margin-bottom: 10px; margin-right: -34px; margin-top: 30px; margin-left: 20px; } #zip { height: 24px; width: 85px; position: absolute; right: 6px; top: 196px; border: thin solid #09C; } #zip input { width: 85px; height: 24px; font-family: Arial, Helvetica, sans-serif; font-size: 18px; color: #000; text-align: center; font-weight: bold; top: 0px; } #buttonid { background-color: transparent; position: absolute; cursor: pointer; border: none; height: 95px; top: 360px; right: 13px; width: 220px; } #extraform1 { position: absolute; top: 250px; line-height: 30px; left: 697px; } #extraform2 { position: absolute; top: 305px; line-height: 30px; left: 697px; } select{ font-family: Arial, Helvetica, sans-serif; font-size: 12px; } #bodycopy { background-image: url(images/center_repeater.png); width: 821px; margin-right: auto; margin-left: auto; position: relative; } #footerimg { background-image: url(images/footer.png); background-repeat: no-repeat; height: 19px; width: 821px; margin-right: auto; margin-left: auto; } #footercontainer { background-color: #192941; } #footercontainer p, #footercontainer a{ color: #CCC; width: 800px; margin-right: auto; margin-left: auto; text-align: center; font-size: 12px; text-decoration: none; } <!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>TITLE</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="topcontainer"> <div id="header"></div> <div id="bodycopy"> <div id="bodytop"></div> <p class="headline" align="center">Headline</p> <p class="subhead" align="center">Subhead</p> <div id="form1"> <div id="zip"><form name="formname" action="submit.html" method="get"><input name="inputname" id="formid" type="text" style="background:none; border:none" tabindex="1" /></div> <input type="submit" name="search" id="buttonid" value="" tabindex="4" /></form> <div id="extraform1"> <p> <select name="Extra1" tabindex="2"> <option>0 - 25</option> <option>25 - 50</option> <option>50 - 100</option> <option>100+</option> </select> </p> </div> <div id="extraform2"> <p> <select name="Extra1" tabindex="3"> <option>Never</option> <option>1-3 years</option> <option>4-9 years</option> <option>Over 10</option> </select> </p> </div> </div> <p>BODY CONTENT</p> </div> <div id="footerimg"></div> </div> <div id="footercontainer"> <p>©2011 | <a href="#">About</a> | <a href="#">Contact / FAQs</a> | <a href="#">Privacy Policy</a> | <a href="#">Disclaimer</a></p> </div> </body> </html>
  6. That did it, thank you very much!
  7. Actually... It's working perfectly fine when updating the last row of the table results. But if I try to update any other row it changes that last row to a blank value and does nothing to the row I want to update. Getting closer!
  8. Good catch! That helped a bit. Now it's doing 2 things, neither of which are what I'd like to do: 1. It's not updating the correct row id. If I change "hidden" to "text" for the rowid, it is displaying the correct row. But when I hit the submit button, it only updates the last item in the table, no matter which row I'm submitting 2.No matter what I put in the "rename" field, it updates as a blank field. I tried changing to <input type="text" size="5px" name="rename" value="<?php echo $row['name']; ?>" /></td> but nothing happens. If I fille value="test" again it only updates the last row in the table to "test." Entering information into the form field does nothing.
  9. I'm pretty inexperienced with coding and trying to get a row of a MySQL database to update when a form is submitted, but can't seem to get it to work. :'( Here's what I have... if($_POST['action'] == 'update'){ //update $rename = $_POST['rename']; $uid = $_POST['rowid']; mysql_query("UPDATE `master` SET `name` = '$rename' WHERE `id` = '$uid'"); } Then the form... <?php $result = mysql_query("SELECT * FROM `master`"); if(mysql_num_rows($result)){ while ($row = mysql_fetch_array($result)){ ?> <td><?php echo $row['name']; ?></a></td> <td><input type="text" size="5px" name="rename" value="" /></td> <td><input type="hidden" name="rename" value="<?php echo $row['name']; ?>" /><input type="hidden" name="rowid" value="<?php echo $row['id']; ?>" /><input type="hidden" name="action" value="update" /><input type="submit" value="Update" /></td> </tr> <?php } } ?> Can anyone give me some hints as to why this won't work? Thaks!
  10. Changed the encoding from UTF-8 to ANSI in Notepad++ and everything works fine now. Thanks for all the help with this. So weird, this has never happened to me.
  11. Hmmm... this is strange. I tried deleting everything and entering just a basic php redirect as the only thing in the file and still received the error... making sure there was nothing else, no white spaces, etc. I'm using dreamweaver and also Notepad++. <?php header('Location: http://www.example.com/'); ?> So I tried copy/pasting that code above into a new file, overwriting the existing file, and it worked. So then I tried the same with the geo script, and it worked. Then I added the HTML and ran into problems. If the HTML code with the geo script is saved in Dreamweaver, I get the "headers already sent error." If I copy/paste everything into Notepad++ and save it there, it works but the page loads goofy. Where there are special characters on the page and apostrophe's, I get the question mark symbol �
  12. Yes I did, but thanks for pointing me there... that info is very helpful. There is no html output though that I can see. I even tried removing everything else on the page and just using that small code. Still receiving the error.
  13. Initially, yea. I placed it just above the <body> tags. I moved it to the very top, but still having trouble. I'm getting a "Cannot modify header information - headers already sent" warning. I checked for whitespace, but there isn't any. I forgot to add a couple brackets in the code above, so this is what I'm working with - without success. <?php require_once("geoip.inc"); $gi = geoip_open("/home/username/GeoIP.dat",GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); geoip_close($gi); if($country_code !== 'US') { header("HTTP/1.0 404 Not Found"); exit(); } ?>
  14. I'm trying to block access to a particular page if the visitor is not from a specific country (using Maxmind Geoip Country database), but not quite sure how to code this properly: I tried this and many variations of this inside the head tags, bud doesn't work. Any suggestions on the best way to go about this? <?php require_once("geoip.inc"); $gi = geoip_open("/home/username/GeoIP.dat",GEOIP_STANDARD); $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); geoip_close($gi); if($country_code !== 'US') header("HTTP/1.0 404 Not Found"); exit; ?>
  15. Hey thorpe, Yeah, that's kinda what I though. It's strange that cpanel, email and everything else works fine, but I can't ftp in. I'm using Smart FTP and just get a "connect failed" error when trying to connect. I believe it's a DNS issue though, because if I type in ftp.subdomain. domain.com into my browser, I get a "Unable to determine IP address from host name ftp.subdomain.doman.com" error.
  16. Thanks for the help... I pinged both domains and they are tracing to the correct ip. I tried pinging ftp.subdomain.domain.com and the response was "unknown error." Maybe it will take some time for that cname to propagate though as you mentioned.
  17. I have what I thought was a simple setup but is proving to be complicated. Here's my setup: domain.com with DNS setup at Namecheap. The A record is pointing to Server1 subdomain.domain.com A record is pointing to Server2. The weird thing is everything seems to work fine. The subdomain loads in the broswer properly, email works, etc. But I can't ftp into it via ftp.subdomain.domain.com. My hosting provider suggested I need to get Namecheap to add a cname to for ftp pointing to subdomain.domain.com. So I went over to Namecheap and added: ftp | subdomain.domain.com | cname to fields... Host Name | ip/URL | Record Type This didn't solve the issue and Namecheap support doesn't know how to help. Anyone know how to make this work? Thanks!
  18. Thanks! I got it to work with your suggestions (code below) Yeah, I know its not perfect but it'll have to do. Thanks for pointing me to that. Thanks for the help! Here's what I ended up with and seems to be working... <?php //detect referrer $ref = $_SERVER['HTTP_REFERER']; //setting the user agent variables $linux = stripos($_SERVER['HTTP_USER_AGENT'],"Linux"); $sample = stripos($_SERVER['HTTP_USER_AGENT'],"SAMPLE"); //detecting user agent device, os, browser, etc. if ($linux == true || $sample == true) $redirect = 1; //detect referrer if (stristr($ref , "order.php")) $redirect = 1; if (stristr($ref , "login.mysite")) $redirect = 1; //set redirects if ($redirect) { $url = "http://www.google.com"; } else { $url = "http://www.yahoo.com"; } header("Location: $url"); ?>
  19. I'm trying to redirect visitors that contain broadly matched URLs. For example, redirect the visitor if their url contains: "/welcome" or "order.php" or "login.mysite/" At the same time I also want to redirect the user if they a particular User Agent. Here's what I have, but doesn't seem to be entirely working... <?php //detect referrer $ref = $_SERVER['HTTP_REFERER']; $find = "order.php"; $find = "login.mysite/"; //setting the variables $linux = stripos($_SERVER['HTTP_USER_AGENT'],"Linux"); $aol = stripos($_SERVER['HTTP_USER_AGENT'],"AOL"); //detecting user agent device, os, browser, etc. if ($linux == true || $aol == true) $redirect = 1; //detect referrer elseif (preg_match($ref, $find)) $redirect = 1; //set redirects if ($redirect) { $url = "http://www.google.com"; } else { $url = "http://www.yahoo.com"; } header("Location: $url"); ?> Any help you can offer is appreciated. Thanks!
  20. That makes sense. Thanks for the reply and again for all the help!
  21. Hey, thanks again ThisOldCar. Works great. One question... what's the difference between using your code above and doing like I did? $url = $_SERVER['HTTP_REFERER']; echo parse_url($url, PHP_URL_HOST) . parse_url($url, PHP_URL_PATH); Will your code cause less overhead? I'm learning slowly here, but getting there.
  22. Ahhh, okay that makes sense. I feel like I should hit myself. Thanks for updating the code for me. Works perfectly now.
×
×
  • 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.