Jump to content

micah1701

Members
  • Posts

    613
  • Joined

  • Last visited

Everything posted by micah1701

  1. The code does not post the senders name into the message body of the e-mail. The line: $message = stripslashes(strip_tags(trim($_POST['message']))); sets the variable "$message" with the "Message" form field that has been sent from the form Then, the line that sends the emal is: if (mail($your_email, $subject, $message, $from)) { notice it just passes that "$message" variable along. No where in there is the persons name ever attached to the message.
  2. Using an ORM is definitely the way to go, centralizing the codebase for making queries helps with future expansion (as well as if you need to swap out db technologies) and, with well implemented libraries, will help mitigate security holes such as sql-injection. For lightweight use, I'm a big fan of Idiorm (and Paris if you need active record support) http://j4mie.github.io/idiormandparis/
  3. I suspect it has more to do with your site's framework set up and/or the post back link to your search page. I see your URL is "index.php?search=XXX" The "?search" variable is part of the searched for keywords but it does not tell the index.php script which page to load. I suspect the URL should be something like "localhost/mmdb/index.php/search/?search=XXX" or simply "localhost/mmdb/search/?search=XXX" or maybe even "localhost/mmdb/search.php?search=XXX" Does the search page load at all (before you actually search for something?) If so, what is the URL of THAT page?
  4. so when setting the URL, I found that (at least on this window's machine) I can use "http://localhost" and it works just fine. Go figure.
  5. From your code, it looks like you're using a slider called "jssor" I googled it and it has a lot of examples of how to use it, including a parameter called "autoPlay" that can be set to not automatically start the slide show http://slideshow.jssor.com/development/reference-options.html#.UgpP62RASd0
  6. after your form, where you call the first function, "sendMailToAdmin()" I think you just need to call the other 2 functions as well and you should be all set, something like: if( sendEmailToAdmin($make, $model,$isSetupHelpReqd) // call the first function ) { $boolMailSent = true; }else{ $boolMailSent = false; } sendEmailToSupport($make, $model,$isSetupHelpReqd); // call the second function it occurs to me that both functions have the line "require("scripts/phpmailer/class.phpmailer.php");" calling it a second time in the second function may error out, you might want to change that to require_once().
  7. I have the need to use cURL to request content from my own website. I've been using the same function on several sites on my own server but recently needed to set up my code on a client's Windows machine (running apache and php w/ cURL enabled). Something about the new host's configuration causes all my cURL requests to timeout when calling URL's on the same site as the code initiating the request. if I set the url to yahoo.com or bing.com it works but if I set it to $_SERVER['HTTP_HOST'] or my domain name it times out. any thoughts?
  8. so something like: <?php if( !isset($_SESSION['audio_played'] || !$_SESSION['audio_played'])) { $_SESSION['audio_played'] = true; //set flag // code to play the dumb audio file goes here } ?>
  9. is this code within form tags? I noticed you're using $_GET and not $_POST, is that the specified method in your form? what if you use $_POST instead of GET?
  10. if your code and mail server haven't changed, maybe its your e-mail client that changed and is now incorrectly displaying plain text line breaks. Have your tried looking at the e-mail in a different mail client? (ie, check it gmail, thunderbird, outlook, etc) otherwise,
  11. there are several ways to do this, including in the SQL directly using a join statement, but for your sake since this code is kinda a mess I would suggest nesting your loops and doing multiple queries. something like this (this is not tested code, just showing you what I mean) <?php //first, look up all the categories and loop through them $categories = mysql_query("SELECT * FROM `category` ORDER BY `category_name` "); while( $category = mysql_fetch_assoc($categories) ){ ?> <h1><?php echo $category['category_name'] ?></h1> <?php //now look up all the items associated with this category $items = mysql_query("SELECT * FROM `item` WHERE category_id = ". $category['id'] ." ORDER BY `item_name` "); while( $item = mysql_fetch_assoc($items){ ?> Your HTML HERE about this particular $item array <?php } // end the loop through all of the items in this category } // end the loop through all of the categories ?> hope that helps
  12. wow! I knew I was missing something simple. thank you so much!!!
  13. So i need to dynamically call a function in my object, depending on certain parameters. Currently, I'm doing this: <?php $myObject = new Object_Class; $the_function_to_call = "do_something"; // this is not really a static variable; it changes each time the script loads. eval("\$myObject->". $the_function_to_call ."();"); // run $myObject->do_something(); ?> This works fine but I'd rather not use eval() if I can help it. Is there an easy way to do this that I'm just missing?
  14. are you saying that the included files can't access the defined variable? or that the files aren't being included because the the code you listed above doesn't seem to load the defined variable currently? if its the latter, maybe the issue isn't that the variable doesn't exist but that the path it stores is not the actual base path to your files. is the folder that all those files are in really "csm" and not maybe something more common like "cms"?
  15. exactly. also, i should point out a tiny flaw in my code. since you're using a unix timestamp, the "30 days ago" is based on 30 days before the current second of today. so things that happened on the day 30 days ago but before the current time won't be found. so really, instead of: strtotime("-30 days"); // which is 30 days before the current second of the current day you should use: strtotime("-30 days", strtotime(date("Y-m-d")) ); // which is 30 days before this morning at midnight hope that helps! FYI, next time it might be better to just use the "date" column type in MySQL in the first place which formats all your deads in human readable "YYYY-MM-DD" format and allows mysql to do some pretty easy calculations as well.
  16. something like... <?php $thirty_days_ago = strtotime("-30 days"); $sql = "SELECT * FROM `table_name` WHERE dateline >= $thirty_days_ago ?>
  17. <?php $date_from_date_picker = "21 Sep 2011"; $mysql_friendly_date_string = date("Y-m-d", strtotime( $date_from_date_picker ) ); ?> also, you can probably configure the datepicker to give you the format you want too. but thats a different forum
  18. ah, I see. Yeah, i've run into this before where you want to basically copy a row but change one thing about it. Usually when you ask this on a message board people make fun of you and say that means you have a poorly designed database or something... but I get what you're trying to do. I'm not familiar with a specific SQL function in MySQL to "copy" a row (although there may be something and I just don't know it) Your best bet is probably to use a combo of PHP and multiple queries like: <?php // this is untested code, just a suggestion of how you could do this... $sql = "SELECT * FROM table_name WHERE datum = '2011-09-01' "; $results = mysql_query($sql); foreach(mysql_fetch_assoc($results) as $result){ mysql_query("INSERT INTO table_name (column1,column2,datum) VALUES ('$result[column1]','$result[column2]','2011-09-02')"); } ?>
  19. looks like the phpfreaks homework help hotline is now open for the semester. LOL
  20. I think this should work. I didn't test it though... <?php function getSunday($weekNumber,$year=false){ $year = (!$year) ? date("Y") : $year; // if no year passed to function, assume this year $week_string = $year."W".$weekNumber; // ie: 2011W34 $monday = strtotime($week_string); // returns timestamp for Mon, 22 Aug 2011 00:00:00 return date("Y-m-d", strtotime("last sunday",$monday) ); } echo "Sunday's date in the 34th week is ". getSunday(34); ?> EDIT: although, since it seems since PHP thinks the week starts on Monday, I suppose you might want that last line of the function to use "next sunday" instead of "last sunday."
  21. what is the error that it gives? i'm guessing its because the drop down selection only POSTs the selected value, not a coma separated list of e-mail addresses which your PHP script is looking for.
  22. i'm not sure i exactly get what your code is trying to do but proper "INSERT" format for an SQL statement is: INSERT INTO `table_name` (list,of,columns,to,update) VALUES ('string','text','for','$each','column') there shouldn't be a WHERE clause or anything else unless you really want to UPDATE a row? then you want: UPDATE `table_name` SET column_name = 'string value', column2 = 'value', you_get = 'the idea' WHERE some_column = 'some_value'
  23. how about... <?php //$url = $_SERVER['REQUEST_URI']; // echo $url; // $parts = explode("=", $url); // If ($parts==component){ if(isset($_GET['tmpl']) && $_GET['tmpl'] == "component"){ ?> <input type="hidden" name="tmpl" value="component"/> <?php }else{echo ""; } ?>
  24. I'd guess that your server is timing out. do you have access to tweak your config/ini settings for apache and php? up your memory_limit
×
×
  • 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.