Jump to content

fastsol

Moderators
  • Posts

    827
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by fastsol

  1. First you'll obviously need to query the database for the info and use the GROUP BY to group by the manufacturer. Then it's fairly simple to use the array of returned results to build the select box dynamically. // Query your db, my example uses PDO $results = $db->query("SELECT manufacturer FROM products GROUP BY manufacturer"); // Just an example $results->fetchAll(PDO::FETCH_ASSOC); //Now echo out a select tag and make sure to give it a name echo '<select name="brands">'; //Now we use a foreach loop and build the option tags foreach($results as $r) { echo '<option value="'.$r.'">'.$r.'</option>'; } //Echo the closing select tag echo '</select>'; With that said, honestly you should have a separate table that holds the manufacturers and their info. Then you use a column in the products table like brand_id that holds the primary key number of the brands from the other table that corresponds with the product at hand. Now you simply query the brands table instead and will never have to worry about duplicate output cause there won't be any duplicate entries in the brands table (at least there shouldn't be since a brand in itself is unique). This concept is called table normalization, it's a very important thing to know and understand and I highly suggest doing this before moving forward with your project.
  2. if($current_ts > $winter_deadline_ts){ echo "a"; } elseif($current_ts > $fall_deadline_ts) { echo "a, b"; } else { echo "a, b ,c"; }
  3. You're going to have to give a bit more to go on than that, it doesn't make much sense what you/her are asking. But I'm pretty sure you'll need a little javascript at minimum to block the default behavior action of the mailto href and possibly to place the text in the text field depending on how you want to achieve this.
  4. It would be dumb not to convert to prepared statements, if you're already doing the work to convert to PDO and change the code, then you might as well change it all at once. I converted my entire CMS in only a few hours and I had dozens of things that needed to be changed. It actually wasn't that difficult nor that time consuming. Adding the prepared statements later in your case is literally almost double the work as apposed to doing it right the first time.
  5. Well of course it's not sending in the mail and echoing on the screen below, that's where the code for processing it is, at the bottom after all the other stuff that already processed. PHP reads the code from top to bottom, if things are in the right order, they won't process in the right order. Put this block of code under your Validate User Comment check and remove it from the bottom of the page. if(!empty($_POST['Activity'])) { $Activity = implode(', ', $_POST['Activity']); $message = $message."\r\n\r\nActivities Selected:".$Activity } Lastly, $Activity is not a mail() parameter, so take that out of there. You don't just list out the vars you want sent in the mail(). You need to build up the actual message to be sent and then use only the parameters that the mail() uses to send. You can read the php manual on how to use the mail()
  6. You've got a couple issues. First you're naming of the bindValues doesn't match the sql string. The 3 bind you label :AES_ENCRYPT in the query string but then you bind it with :password below. Secondly, you are using bindValue but then also using an array in the execute() too. You only need one or the other, not both. Plus you have 2 try{} which is wrong. Lastly, you were trying to run the execute with $statment but you called the prepare on $stmt, so that won't work either. You need to make sure you're paying attention to what and how you are naming things and be consistent about it. Try this try { $stmt = $dbh->prepare("INSERT INTO passwords (description, username, password ) VALUES (:description, :username, :password)"); $stmt->bindParam(':description', $description); $stmt->bindParam(':username', $username); $stmt->bindParam(':password', $password); $stmt->execute(); } catch(PDOException $e) { echo "Exception caught: $e"; }
  7. Ah yes I didn't think about it maybe being called twice. You for sure need a check in there to see if the txn_id has already been inserted into the database, that way it can't be inserted again for the same transaction. They even talk about this somewhere in the paypal example codes, that there are certain basic checks you should do before inserting the info in the db. I have 4 quick checks in my ipn script. If any return true then I skip to the end and just log the $what for investigation manually. if($payment_status != 'Completed'){ $bad = TRUE; $what='status';} if(checkPurchaseTxn($txn_id) === TRUE) { $bad = TRUE; $what='txn';} if($receiver_email != $settings['paypal_email']) { $bad = TRUE; $what='email';} if($payment_currency != 'USD') { $bad = TRUE; $what='currency';}
  8. Looking at it I don't see any reason for the duplication, but you do have issues with the query vars. The main issue is that you are trying to use session information that would have been specific to the user and their visit of your site. That will not work in the ipn script cause it runs behind the scenes and those session vars will not exist when paypal sends the info because the actual user is not actually going to that page, only paypal is. The only info you can use in the ipn script is the $_POST that is sent back from paypal.
  9. On some other forums when you do that it makes a "mention" or something to the like of that for the other posters. Not real useful here, but whatever.
  10. Like Ginerjm says, you're overwriting the first $email_message because the second one doesn't have a .= but rather a = But there are a few other things that are wrong also. Most likely you meant to make the first $email_message be $headers instead. You're calling $headers in the mail() but you're not defining $headers anywhere. The line that would be considered a header is the first $email_message line. But even still you are missing some other crucial email headers like these $headers = 'MIME-Version: 1.0' . "\r\n"; // This might not be super crucial, but is generally sent. $headers .= 'Content-Type: text/html; charset=iso-8859-1' . "\r\n"; //This one you already have. $headers .= 'From: [email protected] <[email protected]>' . "\r\n"; // This one is very important. Replace the emails on this line with an actual email address at your domain. Those are just the minimum required headers. You honestly should be using a mailing library like PHPMailer, it will send all the required headers automatically and you can do a lot more than that with it. Sending email effectively is not as simple as the mail(), there is a ton more to it than that.
  11. Well I think you're misunderstanding the use of a sitemap. A sitemap is used to "help" crawlers locate pages on your site, it doesn't restrict the crawlers from indexing other pages it finds that are not in the sitemap. If you want to restrict the crawlers from indexing certain pages you would need to use a meta tag like this on whatever page you don't want indexed. <meta name="robots" content="noindex, nofollow"/> Honestly I find the google sitemap generator a great way to build a sitemap quickly. I have recently moved to a dynamic sitemap for one of my sites. But even that is still hard coded for parts of it simply cause there isn't a way even for php to know what pages to include in the site map unless you're going to scrape your own pages for a certain meta tag or phrase or make an array or pages to include. Either way it still needs some hard coding of the pages you want. The more dynamic thing that isn't "hard coded" is the ability to use a database to gather a list of say articles or products and then build the xml links based on those returned results.
  12. You'd have to either use the new html5 local storage method and have an if() in your jquery to check the status of that OR do the same kind of method with php sessions. The later will require an ajax call to set the session everytime they select a accordion option.
  13. So don't validate them then, just make the vars needed without the validateInput() on them. $Video = $_POST['video']; // Stuff like that
  14. My main site is very complex. I have to say the shared hosting control panel from ix is also fairly weird compared to most places, but it works fine. There are also minor tweaks that need to be done is you want to use your own php.ini file but it's fairly simple to do and they can help with that. I have just the standard expert plan I think they call it. It will work fine for most site unless you are trying to do some heavy duty email things, which then a shared hosting plan is not sufficient from anyone. Only dedicated IP's and dedicated servers can do that well, but cost a lot more to use than your standard shared servers, but that's a whole other subject. You can find links to a couple of my sites in my signature and from there you can find all the other sites in my portfolio.
  15. I would say that most webhosts don't have the issues you are talking about. I have a client on Hostgator that gets a faira mount of traffic and has never had a problem. I honestly didn't know that AT&T offers webhosting and even if I did I wouldn't use them, they know phones NOT webhosting, bad choice there in my opinion. I personally use ixwebhosting.com. Other than like 3 times where China was attacking their servers I have never had any down time period. I have also used networksolutions.com and bluehost.com, both of those seem reliable to me. But if you switch to any of those and you continue to have issues, it's not the host, it's your code!
  16. You could use something like this to show the last modified time of the file, taken straight form the php.net echo $value['filename'] was last modified: " . date ("F d Y H:i:s.", filemtime($value['filename'])) Depending on the actual value of $value['filename'] you may need to edit the path for the filetime() to use it properly.
  17. What is it you are having problems with? Showing the time of the file when uploaded or making the button do something when clicked? You need to clarify a bit more as to what you are trying to acheive.
  18. Having the From set to the persons email is likely part of the reason it's being spammed. The From should be your domain, then you can whitelist your own domain in your gmail account. You can leave the reply to the person that emailed you. But honestly there is a LOT more to it than that for reliable delivery.
  19. You could use a foreach loop to output each header. But the info you have provided doesn't exactly give us much to go on since the headers you showed are NOT in an array.
  20. "Repeat" is a mysql reserved keyword. You need to wrap your table column names in `backticks` (the key to the left of the 1 on the keyboard). Backticks tell the query that what's between them is not to be considered a reserve word.
  21. I understand completely what you are trying to do. I honestly don't know how to take the $_POST info, verify it and then send to a specific url like paypal. I would imagine you could use something like curl to send it after verification but my knowledge in that is limited. What I actually do in my cms I built is just let the transaction take place and then in the admin panel I have the trans flagged if the numbers don't match up when the IPN posts the data back to me. So basically when the IPN sends you the info, you do all your checks there instead and simply flag the trans if it doesn't add up to your calculations. I would generally say that anyone that is willing to give you money via paypal isn't generally going to know how to mess with the code. Plus paypal always sends you an invoice email for each trans anyway, you could easily verify that an amount paid doesn't look correct to what you actually charge.
  22. This block will always return true cause you are defining the var just before it runs. So it makes no difference if it's defined soemwhere earlier cause you are overwriting it right before the block anyway. $cur_car_year=""; // This line is given a value in another place. if($cur_car_year=='') { $year_html.='<option></option>'; }
  23. The watermark size is based on the actual watermark image you are using. The position is controlled by the $margin vars.
  24. Try restarting all the server services. I have had a issue with time being off on a dedicated webhost server before until I restarted everything. Beyond that, I don't know.
  25. In my opinion, using heredocs in the first place is the problem. The syntax is always a pain to get right. What's so hard with doing this echo 'Thank you for visiting our store and buying '.$tireqty.' and 3 '.$oilqty.'. Have a very nice day';
×
×
  • 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.