Jump to content

vozzek

Members
  • Posts

    130
  • Joined

  • Last visited

Everything posted by vozzek

  1. Hi all, Is it possible to have a form choose from two different possible actions (i.e. loading two different pages) based upon the value of a variable in php? For example, let's assume my form looks like this: <form ACTION="https://mywebsite.com/checkoutA.php" method="POST" name="pay_form" id="pay_form" onSubmit="return chkPayForm();" style="margin:0;"> Let's assume I have a variable called $total. If $total>0 I would like the form to process onto the page checkoutA.php But if the $total is not greater than zero, I would like the form to process onto the page checkoutB.php How would I go about this? Would I need to know the value of $total before the page gets to the html <form> code, and then optionally echo each possible outcome? Or is there an easier way? Thanks in advance, as always.
  2. Okay, I cheated (commence bashing me). Instead of reading the file line-by-line, I did the following: $headers .= 'Bcc: '; $mailstr = file_get_contents("test_list_TFATP.txt"); $mailstr = eregi_replace("\n",",",$mailstr); // Replaced page breaks with commas $headers .= $mailstr.'customersupport@thefrogandtheprincess.com' . "\r\n"; Does anyone see a problem with this? What's the character/size limitations on <b>file_get_contents</b> anyway?
  3. Hi all, Quick problem: I'm trying to read the email addresses from my mailing list, which is a .txt file separated by line breaks. I need to append this into the "Bcc: " section of the $headers variable so when I send the email everyone is blind to everyone else. I'm using fgets, and it doesn't seem to be picking up the line breaks. When I append new addresses to the file I used "/r" as the line terminator instead of "/n", but from what I've read that shouldn't really matter. Here's my code: $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: customerservice@thefrogandtheprincess.com' . "\r\n"; $myFile = "test_list_TFATP.txt"; $fh = fopen($myFile, 'r'); while(!feof($fh)) { $email_address = fgets($fh, 4096); $headers .= 'Bcc: '.$email_address."\r\n"; } fclose($fh); mail($to, $subject, $message, $headers); Right now I'm using a three email test file. The customerservice email gets through okay, but at the very top of the body of the email I see the following line: Bcc: email1@whatever.com Bcc: email2@whatever.com Bcc: email3@whatever.com Bcc: So the three magical questions are: 1) Why isn't the $headers variable being broken up line by line so each email can be sent? 2) Why is this showing up in the body of the email? 3) What's with the extra "Bcc: " at the end of the read? Wouldn't the eof marker prevent that, or should I check for a null $email_address value before appending to $headers? Thanks in advance for the help.
  4. Thanks much, Liam! The 'file_get_contents' command worked like a charm. Perfect!
  5. Hi all, My website is going to be sending our customers a monthly newsletter to give them advanced notice of upcoming sales. I constructed the newsletter itself as a simple newsletter.html file, consisting of a few hyperlinks and photos. This file will be changed monthly. Now I'm writing a mail script to send the newsletter, but I don't want to send it as an attachment. What I'd like is all of the code within the newsletter.html file to show up in the body of the email. I was going to use 'include' to do this, but so far the body of my emails are coming up empty. I think I'm way off. Can someone recommend the best way to do this? Thanks in advance.
  6. Hi all, I put the W3C Markup Validation checker against my site, and was slapped with 59 errors. After diligently cleaning it up, I'm down to one last error... apparently XHTML 1.0 won't support using the 'background' element within a <td> tag anymore. Correct? I'm assuming the answer is CSS. I've got an external CSS sheet attached to my main template, but I'm not sure how to go about placing the background image into a class. Basically I have a few images I need to appear in certain cells of my table, and I need to write text over them. Sorry if this is confusing, but I'm kinda new to CSS and I'm still not comfortable with it. Thanks in advance.
  7. Very cool, thanks much. I definitely want to stop the hotlinking. Still, could I put an index.html file in the directories I want to protect, with a re-direct back to my main page? Wouldn't that protect the individual directory from being looked at? And would web-browsers frown upon such multiple index pages and/or redirects?
  8. Hi all, Let's say I've got a directory at www.mywebsite.com/images/ and this contains all my site's images. Obviously I don't want people being able to link directly to that directory and see the different files there, I want them to get an 'error not found' message or something along those lines. So I went into my host panel (I use HostGator) and clicked 'password protect directories'. This works, except that every single page of my site then asks for a username/password because the page is accessing the images from that directory. So that's not gonna work. Is there an html way to do what I want? Thanks in advance.
  9. Awesome site, monkey. Just what I needed bro. Thanks!
  10. Hi all, My webpage looks fine in Firefox and I.E., but I've received complaints about image shifts when it's looked at from an Apple. I'm currently making changes, and now I want to see if the alignment is fixed. I don't have an Apple. Is there an easy way for me to 'see' my website through Apple's eyes? Thanks in advance.
  11. Haven't looked into your formatting problem, but I will point out an error in one of your top images. "Claim back what your due" This should be "Claim back what you[red]'re[/red] due". "You're" is a conjunction of "you are" - that's the one you want. 'Your' is the possessive form. Good luck with the site, looks good otherwise.
  12. Hi everyone, It's funny how much you learn while creating a website from scratch. What's not funny is stumbling across the first few bits of code you did and realizing it's absolute CRAP. I need some help fixing something that's kinda complicated (to me at least). At the top of my site is my main logo. I chopped this image up and spanned it across tables so that I could fit a search bar into the site. I AM using CSS, but my CSS knowledge is limited. I had tried to anchor the search bar with some absolute positioning - it looked great in Firefox, but this positioning seemed to differ greatly when the site was viewed in I.E. Anyway, I used tables for everything. Not the smartest idea, but it's what I knew at the time. I'm sure I need to use <div> or CSS absolute positioning, but I'm not sure how. The site looks good in IE and Firefox, but I've had complaints that when viewed with an Apple... the princesses' head is cut off! http://www.thefrogandtheprincess.com/ Here's the code that makes up the top portion of the site. Yes, I know it's ugly... I need suggestions as to the best way to fix it: <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="125" background="../Images/topbar1.jpg"></td> <?php $topbar2="\"../Images/topbar1b.jpg\""; if (isset($_SESSION['cust_name'])) $topbar2="\"../Images/topbar1b2.jpg\""; ?> <td width="270" <?php echo "background=".$topbar2; ?> class="hello"> <?php if (isset($_SESSION['cust_name'])) echo " <i>Hello ".$_SESSION['cust_name']."!</i>"; ?> </td> <td width="58"><a href="http://www.thefrogandtheprincess.com" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','../Images/topbar2_rollover.jpg',1)"><img src="../Images/topbar2.jpg" alt="Home" name="Home" width="58" height="30" border="0" id="Home" /></a></td> <td width="161"><a href="../customer_service.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Customer Service','','../Images/topbar3_rollover.jpg',1)"><img src="../Images/topbar3.jpg" alt="Customer Service" name="Customer Service" width="161" height="30" border="0" id="Customer Service" /></a></td> <td width="83"><a href="../login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Account','','../Images/topbar4_rollover.jpg',1)"><img src="../Images/topbar4.jpg" alt="Account" name="Account" width="83" height="30" border="0" id="Account" /></a></td> <td width="103"><a href="https://thefrogandtheprincess.com/view_cart.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('View Cart','','../Images/topbar5_rollover.jpg',1)"><img src="../Images/topbar5.jpg" alt="View Cart" name="View Cart" width="103" height="30" border="0" id="View Cart" /></a></td> </tr> </table> <form action="../search_results.php" method="post" name="searchform" id="searchform" style="margin:0;"> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="535" height="30" background="../Images/choplogo1.jpg"> </td> <td width="210" height="30" background="../Images/choplogo2.jpg" class="search"> Search: <input name="srch" type="text" id="srch" size="18" maxlength="50" /> </td> <td width="40" height="30" background="../Images/background7.jpg" class="gobutton"><input type="image" src="../Images/choplogo3.jpg" name="send" value="send" /></td> <td width="15" height="30" background="../Images/choplogo4.jpg"> </td> </tr> </table> </form> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="800" height="120" background="../Images/choplogobase.jpg"> </td> </tr> <tr> <td width="800" height="20" bgcolor="#FFFFFF"></td> </tr> </table> This code exists in my main template so it exists on all my pages. Getting it right is important. Getting it to load as fast as possible is a huge bonus too. Oh, I have a class of 'search' associated with the searchbar. The code exists in an external file, and looks like this: td.search { font-family: Verdana, Arial, Helvetica, sans-serif; color: #4B4B4B; font-size: 15px; border: 0px; } Thanks in advance for the help!
  13. Hi all, My website went live recently and I was wondering if it was okay to install Statcounter's code on it to keep track of hits and stuff. I chose the 'invisible' counter option and they gave me a small snippet of code that went in easily enough. I never had any experience with statcounters and figured I'd ask you guys if you thought it was okay. I don't want to do anything to make the pages load slower, trigger browser alerts, etc... So in your opinion, is it cool? Thanks a bunch.
  14. You're right about the pixelation of some images. I'll get that cleaned up. As for the tables, I didn't know anything about <div> at the time. I'm still learning. In fact, I don't think I used div in the entire site. Are tables slower to load?
  15. In the beginning, there was nothingness. I was a snot-nosed web rookie armed with a dozen html tags, a high-speed internet connection, and the daunting task of creating my own retail website. I knew two things: jack and squat. That was about four months ago. Since then, I've self-taught myself CSS, mySQL, some javascript, and with very much help from this board - php. In fact, I went absolutely php berserk. The unlimited flexibility and power it affords you just can't be matched by anything else, and so most of my site ended up being php-driven. Cookie-cutter code didn't cut it, and I ended up doing a lot of things myself. I wrote my own php-based shopping cart, for better or for worse. In the end I know I probably took the long way around certain things, and I know many things can be done a lot better. Still, nothing beats knowing what 100% of your entire site's code means simply because you wrote it all yourself. Please critique my site. I'm open to all criticism, and would love your feedback. So if you can make it look better, load faster, feel cleaner... whatever - I am sooooo totally open to suggestions. The people on this board are sharp-eyed (and sharp-tongued ) but I've always gotten great advice and I respect the opinions here. So without further ado: http://www.thefrogandtheprincess.com/ Keep in mind that I know very little about securing folders or any of that type of stuff. I'd be grateful to learn about that. Any help or advice given is much appreciated. Thanks in advance.
  16. Okay, don't laugh. My website is 99% done, and I took painstaking steps to make it look the same in IE and Firefox. Aside from some spacing issues when using the <p> tag (Firefox skips more vertical space somehow) - it all looks good. However... I just read somewhere that the DOCTYPE for my site should be brought to the standard 4.01. Right now, my entire website - every page - has a doctype of 1.0 Yikes. I changed the main page from 1.0 to 4.01 and in IE it looks the same. In Firefox, I have all kinds of spacial problems around images and paragraph tags. This would be a nightmare to fix throughout my entire site. So two quick questions: 1) What are the ramifications (God I love that word...) of leaving the doctype 1.0? 2) Almost every page in my site is based on a template. Is there something I could put in the template (<head> section?) to fix the spacial issues caused by going from 1.0 to 4.01? Okay, I'm done. You can laugh now.
  17. Hi everyone, quick question: When I first started my website three months ago, I was a total rookie. I used a lot of <img> tags to create borders around things and to dress up different tables on my site. Later on, I set classes in a CSS external file and used the background-image: command to fill those same tables with the same images. So my question is: which is faster? I would think the CSS method. And how much faster is it? Fast enough that I should go back through my entire site and change those <img> tags to style sheet references? Thanks for the help!
  18. I found out the answer, so I'm posting it here for everyone who's interested. Maybe I can help someone else out, after all the help you guys have given me. IE (at least IE6 and below) doesn't treat options in a select as normal element nodes. You can't reference them by id, but need to use the indexes of the select element's options. So in the example having to do with my website, I only cares about the first index... so I just test that the select's selectedIndex is not 0. Works great.
  19. This is frustrating. I've got a pretty straightforward script that forces a user to select an option from the dropdown box OTHER than the defaulted "Please Select" option. It works fine in Firefox, but I.E. allows you to add the item to the shopping cart with 'Please Select' as the option. Grrrr.... <script type="text/javascript"> <!-- function validateAddToCart() { var valid = 1; var errmsg = ""; var jopta = document.getElementById('option_a'); if (jopta) { if (jopta.value == "Please Select") { errmsg = "Please make sure all drop-down selections are made."; valid = 0; } } if (valid == 0) { alert(errmsg); return false; } else { return true; } } //--> </script> Anyone see an obvious problem here, or am I missing something? I'm also open to better ways to do this. Thanks!
  20. Hi everyone, This may be more of an html question, but my site is 90% php and I wasn't sure. If it's in the wrong area I apologize. For the past four months I've been working on a retail website. Built it from scratch, including the shopping cart, which uses a mySQL database indexed by session id. All the pages in the site are php. Everything was running smoothly, until I installed the credit card payment code. I opened a merchant account with Linkpoint and they supplied the gateway. I didn't like the Firefox "your data is unencrypted" warning messages the user got when clicking the 'submit payment' button (didn't get the message on I.E. for some reason), so I bought and installed an SSL certificate from Verisign. Here's where the problems began... I had to make the payment page secure, so all links pointing to it were changed from http: to https: (I just assumed this is how to make the site secure?) This wreaked havoc with the shopping cart, because I soon learned, much to my dismay, that switching from an unsecured to a secured page starts a whole new session... thereby generating a whole new session id. So I then made the entire shopping cart secure, along with all the php pages relevant to it. Half the site is now http, half is https. But because almost all the pages in my site are based upon a template, there are certain link references in the template (to the background image, for example) that are not secure. This triggers a beautiful new I.E. warning message: "This page contains both secure and non-secure items. Do you want to display the non-secure items?" whenever the user goes from the non-secure to the secure part of the site. (Ironically, this message doesn't happen in Firefox). Obviously these warnings can be turned off in the browser settings, but I don't want potential buyers coming to my site to get spooked. I need the warnings not to show up at all. At this point I am considering making the entire site secure. A few questions: 1) Is this a good idea? Are there any other options? 2) Is this as easy as just changing all links/references to the site from http: to https: or is there more to it than that? 2) If the user googles my website and arrives at the index page, they're getting to an http: url instead of an https: one. Does the www.mywebsite.com/index.php page exist in both the http: and https: world? (I know that question sounds stupid...) and how do I direct them to the https: page to start off? 3) The template code relating to the background image for example: body { background-image: url(Images/background7.jpg); } If I hardcode the background-image to an absolute link, would I use the https: extension? I'm kinda confused, as this is the first time I'm dealing with secure sites. Any advice would be appreciated, and again, sorry if this is in the wrong area. Thanks!
  21. Hi all, Okay, my site launches the user to the PayPal payment area, he/she pays for the purchase, and my ipn.php (instant payment notifcation) script is triggered to update my database... all of this is working fine. Then the user is returned to my 'thank you' page via the $paypal['success_url'] variable. However, PayPal will not pass or $_POST any of my own variables back to me. Bastards. PayPal does have a feature called PDT (payment data transfer) which I turned on. As straightfoward as it is, it's still a little bit too complicated for my needs. It requires I make another http POST, pass my fixed 'identity token' along with a bunch of url data, look for the word 'SUCCESS', and then parse out all the PayPal variables. Yuck. Realistically, all I need to get back is my order number. I can do lookups on all my SQL tables and grab all the information I could possibly ever need to create a kickass thank you page... if only I have that one piece of data: the order number. So... is there any way to pass it while running my ipn.php script? You can't pass $_SESSION variables from PayPal (I have no clue why) - so is there any other sneaky way I could somehow get it that you guys know of? Or am I doomed to parsing out PayPal data that I don't really need? Thanks for the help,
  22. Hi everyone, Can someone tell me the command to print out all variables posted to a particular php page? Specifically, PayPal is returning me to my 'success.php' page and I'd like to know exactly which variables are being passed/posted back to me (and more importantly, which ones are not). I thought I knew this a few weeks ago, but can't find it anywhere. Thanks in advance.
×
×
  • 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.