Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Can the general public access the root. That seems to be the problem, is that normal people can only hit account-area. Usually stuff above that level is locked to general public and only available for internal viewing/processing. Moving that file up a level will work.
  2. It all depends on what the email form is for. Most of my contact forms I only allow at most 1 link, any more is considered spam. Reason being is that if someone is reporting a link, it needs to be allowed. As I most my emails are sent as text and not html, no images should be included. That and my email converts http:// and www. to links, which I do understand certain places like AOL needs the herf=. It all depends on what he needs/is needed. I was just throwing out a suggestion/alternative solution.
  3. You probably want to post this in the html section. Or google html forms
  4. header.php <html> <head> <title>Your Title</title> </head> <body> footer.php </body></html> index.php <?php include('header.php'); ?> test test <?php include('footer.php'); ?>
  5. What you seem to be looking for is a cronjob I think. Vague explanation with no example. What have you tried? Do you just want a script with buttons you push that call another script or do you want it automatic? Post more information if you would like more than a vague response.
  6. <form action="enquiry_sender.php" method="post"> Try that the ../ goes up one directory.
  7. Let me through this out there, why check for href=? I would check for http:// and or www. as those generally signify a link, which broadens your search and chances of catching a spammer is greater. To do that you do not need preg_match, simply stristr would work (make sure you use the === to check for false. $mail = new PHPMailer(); $mail->SetLanguage("en", "inc/"); $mail->From = "bob@bob.com"; $mail->FromName = "Admin"; if ($test == 'FAIL') { $mail->AddAddress("spam@bob.com"); } else { $mail->AddAddress("$email"); } $mail->WordWrap = 50; $mail->IsHTML(true); $mail->Subject = "Your Enquiry, $name"; $mail->Body = "HTML of message goes here"; if (stristr($text, "www.") !== false || stristr($text, "http://") !== false) { die("We do not like spammers"); }else { $mail->Send(); // only send if they are not a spammer. }
  8. Why even say == 1? <?php function auth($user, $pass){ $sql = mysql_query("SELECT * FROM `". MEMBERS ."` WHERE `username` = '". $user ."' AND `password` = '". md5($pass) ."'"); return (mysql_num_rows($sql) == 1)?true:false; } if (auth($user, $pass)) { echo "Welcome $user"; }else { echo "Not logged in."; } ?> A bit less coding meaning less chance for messing up. The return part is called the ternary operator which acts like an if/else in a short form.
  9. www.php.net/strtotime www.php.net/date <?php $date = "01-01-2007"; $tstamp = strtotime($date); $newdate = date("Y-m-d", $tstamp); echo $newdate; ?>
  10. Use javascript so it does not have to post back, or AJAX as mentioned above.
  11. Suggest you pay someone a lot of money to write the code for you and hope they don't take you to the cleaners.
  12. Or if you want just simply turn display_errors off using ini_set or via php.ini.
  13. <?php $editedtext = $_POST['edittext']; if ($_POST['Submit']) { $date = date("Y-m-d", time()); $query=" UPDATE text SET textblock='$editedtext', lastedit='$date' WHERE textid = '3' "; mysql_query($query) or die("I'm sorry, we encountered an error with this query.".mysql_error()); echo "Record Updated"; //print $query; //if you echo out the query, people can see what you're doing } ?> www.php.net/date use that with www.php.net/time to get the format you need.
  14. If the web hosting sites gui offers it than you can use it. Windows alternative to cron job is Scheduled Tasks. More limited, but may be able to do the same thing. Usually Cronjobs are setup via SSH, unless the webhost specifically has a place in their GUI, if it is a windows hosted machine you may not have that option.
  15. More specification would help. Combined totals of what? Of the total Y's or the total Y's for a column? <?php $query = "SELECT greeted,quality,cleanliness,service,informed,promised,additional,refer FROM data"; $result = mysql_query($query) or die ("Can't do anything with the query!"); $total = mysql_num_rows($result); $totalsy = array("greeted" => 0, "quality" => 0, "cleanliness" => 0, "service" =>0, "informed"=>0, "promised" =>0, "additional" =>0, "refer" => 0); $totalsn = array("greeted" => 0, "quality" => 0, "cleanliness" => 0, "service" =>0, "informed"=>0, "promised" =>0, "additional" =>0, "refer" => 0); while ($row = mysql_fetch_assoc($result)) { foreach ($totals as $key => $val) { if ($row[$key] == "Y") { $totalsy[$key] = $val + $totalsy[$key]; }else { $totalsn[$key] = $val + $totalsn[$key]; } } } echo 'The total amount of y\'s for greeted was ' . $totalsy['greeted']; ?> Assuming that is what you are after. A more dynamic approach would be: <?php $query = "SELECT greeted,quality,cleanliness,service,informed,promised,additional,refer FROM data"; $result = mysql_query($query) or die ("Can't do anything with the query!"); $total = mysql_num_rows($result); $totals = array(); while ($row = mysql_fetch_assoc($result)) { foreach ($row as $key => $val) { if ($row[$key] == "Y") { $totals[$key]['y'] = $val + $totals[$key]['y']; }else { $totals[$key]['n'] = $val + $totals[$key]['n']; } } } echo 'The total amount of y\'s for greeted was ' . $totals['greeted']['y']; ?>
  16. <?php // Where ever $yourresults is defined it is an object of an array of objects // For every array of objects in Sales make them the variabel $sales foreach ($YourResults->SALES as $SALES) { // Use this section to insert into the machinesales info table print("<B>"); // Since $SALES is just an object now you can now access individual properties, such as ReadDate etc printf("ReadDate: %s\n", $SALES->ReadDate); print("</B>"); print ("<BR>"); // $SALES->Items is an array of an item object, so loop through those and assign // the current object to $Item // use this section to insert into columnsales info table foreach ($SALES->Items->Item as $Item) { printf("Coil: %s\n", $Item->ColumnName); printf("Price: %s\n", $Item->Price); printf("Vends: %s\n", $Item->Vends); printf("Sales: %s\n", $Item->Sales); print ("<BR>"); } } ?> See comments above.
  17. Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.jpg$ images.php [nc] Since I believe the best way to learn is by reading it yourself look http://httpd.apache.org/docs/1.3/misc/rewriteguide.html For a full guide on how to create a mod rewrite htaccess file (look at the rewritecond and rewriterule).
  18. Remove the < and > from the output or view the source. Remember that < and > are considered html tags and will be hidden in the source of a page and not displayed.
  19. All images are ported to a central file, images.php via .htaccess From there they use the url to determine if the file exists, if not the images.php prints out the generic 404 for images. If it does it goes and retrieves the file and print that out instead.
  20. Either way if it is or is not depreciated/being depreciated. It is good practice to not use the short tags due to XML conflicts and the fact that any server can turn them off. http://talks.php.net/show/php-best-practices/10 Something to consider one way or the other.
  21. $query="SELECT access FROM `user` WHERE `username` = '$nick'"; Single quote around values, backticks around tables and columns.
  22. what!?!?!?!? I guess to say they have been depreciated would be incorrect, there has been talk on php.net stating that it may be in the future so code for it: Basically <?php is the proper cross-server way to code as it will work on any php server, the short tags may not work due to server settings etc.
  23. If this is a local server you need to allow remote access to files. If you are on a shared server, well you are SOL. As they disable the fetching of remote files for security reasons as I explained above. The setting would be in php.ini and something like fopen_url or similar. Look at the help contents of www.php.net/include and www.php.net/file_get_contents it tells you what has to be enabled to use the including/fetching of remote files.
  24. I would post the code I used, but I have customized it so much there is too much to filter. That and I consider it proprietary information due to certain aspects of it. Anyhow a simple google search will provide you with more than enough information. http://www.google.com/search?hl=en&q=php+seo+friendly+url&btnG=Google+Search http://www.sitepoint.com/article/search-engine-friendly-urls http://techie-buzz.com/ask-techie/create-seo-friendly-urls-using-mod-rewrite-and-php-part-1.html A few different ways, which is best for you is for you to choose.
×
×
  • 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.