Jump to content

oavs

Members
  • Posts

    56
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Downunder

oavs's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi I have been asked to 'optimise ' this file header below. My server keeps blocking all IP's due to over use of this file. I have no idea why as this file is a part of many other files used in the ecommerce and all other files in the root directory have the same/similar headers. Why only this file? Server tech said this =================== Your account "stixandstones.com.au" hosted on elessar.nocdirect.com is running various CPU intensive php scripts which are causing very high load on the server and due to which server is going under very high load. Please have a look at the follow details about your php scripts running in parallel. Top Process %CPU 15.0 /usr/bin/php /home/stixands/public_html/proddetail.php Top Process %CPU 14.0 /usr/bin/php /home/stixands/public_html/proddetail.php Top Process %CPU 13.0 /usr/bin/php /home/stixands/public_html/proddetail.php stixands 605 0.0 0.1 44020 11716 ? S 15:38 0:00 /usr/bin/php /home/stixands/public_html/proddetail.php stixands 2094 0.0 0.1 44020 11712 ? S 15:39 0:00 /usr/bin/php /home/stixands/public_html/proddetail.php stixands 2685 0.0 0.1 47356 13900 ? S 15:40 0:00 /usr/bin/php /home/stixands/public_html/proddetail.php etc etc etc We had no choice but to block web access of your account to stabilize the server because server is currently under very high load. Please involve a web developer to check and optimize the code to decrease the resource usage. You should optimize your scripts/queries a little further because we believe that there is always some room for improvement. ================================================= Can anyone suggest how to optimise this file? ======proddetail.ph=============================== //Author: Vince Reid, vince@virtualred.net <?php session_cache_limiter('none'); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/db_conn_open.php"; include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/includes.php"; include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/languagefile.php"; include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/incfunctions.php"; include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/metainfo.php"; @include_once $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'].'/twatch_include/logger.php'; ?> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/inside.dwt.php" codeOutsideHTMLIsLocked="true" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="stix.css" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Stix and Stones Baby</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --><script language="JavaScript"> function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0, locationbar=0, statusbar=0,menubar=0,resizable=0,width=1000,height=600');"); } // End --> </script> <!-- InstanceEndEditable --> </head> <body> <table class="mainTbl" cellpadding="0" cellspacing="0"> <tr> <td valign="middle"> <div id="wrapper0"> <div id="wrapper"> <div class="mainWrapper"> <div id="slogan"><img src="images/fresh_and_funky.png" width="328" height="18" alt="fresh and funky keepsakes for mum and bub" /></div> </div> <div class="mainWrapper"> <img class="cherry" src="images/cherry_shop.png" width="181" height="235" alt="" usemap="#cherymap" /> <map name="cherymap" id="cherymap"> <area shape= "rect" href= "categories.php" coords= "63,177,175,233" alt="stix and stones baby homepage" /> </map> <img class="logo" src="images/logo.png" width="393" height="212" alt="" usemap="#logomap" /> <map name="logomap" id="logomap"> <area shape= "poly" href= "index.php" coords= "75,68,131,30,376,79,353,198,105,149,75,114" alt="stix and stones baby homepage" /> </map> <div class="box1TopLeft"><div class="box1TopRight"><div class="box1BotLeft"><div class="box1BotRight"> <div class="box1Pad"> <div id="navigation"> <a href="/index.php">home</a> <img src="images/bullet.gif" width="7" height="6" alt="" /> <a href="/meettheteam/">meet the team</a> <img src="images/bullet.gif" width="7" height="6" alt="" /> <a href="/babyography/">babyography®</a> <img src="images/bullet.gif" width="7" height="6" alt="" /> <a href="/babynames/">names for baby</a> <img src="images/bullet.gif" width="7" height="6" alt="" /> <a href="/contact/">contact us</a> <img src="images/bullet.gif" width="7" height="6" alt="" /> <a href="/stockists/">stockists</a> </div> <div id="leftSide"> <div class="pad1"> <?php include("vsadmin/inc/incsidemenu.php") ?> <div class="miniCart"> <?php include("vsadmin/inc/incminicart.php") ?> </div> <div class="hr2"> </div> <div id="babyNameDB" class="box2Top"><div class="box2Left"><div class="box2Right"><div class="box2Bot"> <div class="box2TopLeft"><div class="box2TopRight"><div class="box2BotLeft"><div class="box2BotRight"> <div class="pad4" > <h1 class="pad8">BABY NAME</h1> <h1 class="pink">database</h1> <div class="go2"><a href="/babynames/babynames.php"><img src="images/go2.gif" width="20" height="20" alt="GO" /></a></div> </div> </div></div></div></div> </div></div></div></div> <div class="hr2"> </div> <div id="subscribeBox" class="box2Top"><div class="box2Left"><div class="box2Right"><div class="box2Bot"> <div class="box2TopLeft"><div class="box2TopRight"><div class="box2BotLeft"><div class="box2BotRight"> <div class="pad9" > <a class="subscribeGo" href="/newsletter/"><img src="images/go2.gif" width="20" height="20" alt="GO" /></a> <h1>SUBSCRIBE!</h1> <h1 class="red">to our quarterly newsletter</h1> </div> </div></div></div></div> </div></div></div></div> </div> </div><!-- end leftSide --> <div id="rightSide2"> <?php include $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT']."/vsadmin/inc/nav/incbc.php"; ?> <!-- InstanceBeginEditable name="mainContent" --><?php include "vsadmin/inc/incproddetail.php" ?><!-- InstanceEndEditable --> </div><!-- end rightSide --> <div class="clear"> </div> </div> </div></div></div></div> </div><!-- end wrapper --> <div id="footer"> <div class="mainWrapper"> <div id="searchBox"> <p class="pad3">SEARCH THE SITE</p> <form id="search" action="/search.php" method="post"> <input type="hidden" name="posted" value="1" /> <input name="stext" type="text" class="text" /> <input class="go" type="image" src="images/go1.gif" /> </form> </div> <a class="startShopping" href="categories.php"><img src="images/start_shopping.gif" width="140" height="28" alt="START SHOPPING" /></a> <p class="copyright"> ©2007 Stix and Stones Baby. All rights reserved.<br /> Babyography® is a registered trademark of Tracey Donaghey. </p> <div class="clear"> </div> <div class="footerLinks"> <a href="/terms/#care">Customer Care</a> | <a href="/terms/#ordering">Ordering & Delivery</a> | <a href="/terms/#privacy">Privacy & Security</a> | <a href="/terms/#copyright">Copyright</a> | <a href="/terms/#terms">Terms & Conditions</a> | <a href="/faqs/">Faq's</a> | <a href="/links/">Links</a> </div> </div> </div><!-- end footer --> </div> </div><!-- end wrapper --></td> </tr> </table> </body> <!-- InstanceEnd --></html>
  2. Hey dolrichfortich! Are some genius or something? because it has worked and you must be! and until now no one has come of with such a simple solution to my problem. Many many thanks mate :-) First go and it worked. ..I am happy :-)
  3. can you show me where and how exactly please. This is my problem I have no idea how and where it supposed to go. Thanks for your kind reply.
  4. Hi I really would appreciate if some phpfreak can help me with this please :'(. I need to my contact page send emails so that when recipient receives it, it comes with the correct domain (same as the web address) it is coming from rather than the server name. At the moment they are coming as abcd20@elessar.nocdirect.com and would like them come as abcd20@myowndomain.com (lets say my password for that email is 'zzzaaa' and the domain was myowndomain.com ) Here is my email contact php script which works fine and hopefully would not have to change too much. My Contact form is posting to 'send.php' . On top of my contacts page there is a js script for 'jquery.js' and some jQuery stuff for validation.. Have seen many scripts but could not adapt to my existing send.php script. Can you please help? ------ Content of 'send.php' ----------------------------------- <?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','phone','message'); $required = array('name','email','phone','message'); $your_email = "abcd20@myowndomain.com"; $email_subject = "New Message: ".$_POST['subject']; $email_content = "New message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?> --------------------------------------------------------------------------------
  5. Actually problem wasn't that. It was a missing PayPal code. <input type="hidden" name="hosted_button_id" value="X3PRABCDEX822L4"> Ok Now that is sorted out I have a different but same form issue. Little explanation first. I have a form (like a contact form) which user selects the item and the price. When submitted it is presentaed by another page of the summary of the the order including the total amount. What I really really want to do (and this is where your expertise is required) is to place the Total amount into the paypal's form. In the paypay (2nd form page) I do have this <input type="hidden" name="amount" value="<?php echo $total; ?>"> and my 'total' field name is also called total in my first form page. I also did this in the first form page ...form here ... <input name="total" type="text" class="field text medium" id="total" tabindex="20" value="" maxlength="255" /> </form><?php $total=$_POST['total']; ?> So how do I get the value from my first form into paypal's form on the second page? I'll needed to be shown please :-)
  6. Hi Here is the code. I am no expert in php Thank you for your help. <?php print' <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input name="q0" type="hidden" value="1"> <input name="submit" type="image" src="https://www.paypal.com/en_AU/i/btn/btn_paynowCC_LG.gif" width="1" height="1" alt="PayPal - The safer, easier way to pay online." border="0" > <img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1" > <input type="hidden" name="add" value="1" > <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="business" value="123@xyz.com.au" > <input type="hidden" name="item_name" value="Canvas Order" > <input type="hidden" name="item_number" value="CAN" > <input type="hidden" name="amount" value="<? echo $total ; ?>"> <input type="hidden" name="shipping" value="0.00" > <input type="hidden" name="buyer_credit_promo_code" value="" > <input type="hidden" name="buyer_credit_product_category" value="" > <input type="hidden" name="buyer_credit_shipping_method" value="" > <input type="hidden" name="buyer_credit_user_address_change" value="" > <input type="hidden" name="no_shipping" value="0" > <input type="hidden" name="no_note" value="1" > <input type="hidden" name="currency_code" value="AUD" > <input type="hidden" name="tax" value="0.00" > <input type="hidden" name="lc" value="AU" > <input type="hidden" name="bn" value="PP-ShopCartBF" > </form>'; ?>
  7. Hi, Ever time I upload an image using Cushy.com it re names my image. I want to upload an image to replace the previous one therefore I need to upload the same file name image. And of course it isn't working. What sort of PHP code can use so that it displays may be the last updated image or the same file name. In my banner-advert.php include I have this. This is the file I need to uplad/replace every time. <img name="n01" class="cushycms" src="/includes/banner-advert_5_2525372575.jpg" id="n01" border="0" height="248" alt="" width="490" /> And in Cushy.com I can see it, but every time I upload a new image it still referring to the old file name thus showing as [X] Any suggestions would be most appreciated. (Images aren't stored in the database.) Thanks
  8. Thanks, I am not a coder but I do understand some of the basics. Thanks for letting me know. I really need to someone come up with a fix or alternative script suggestion if there is such thing I'll be very greatful.
  9. Hi I am grateful that you are reading this, so let me thank you first. I have form which works fine except the select field which has some options and the date select . When I receive my email I get all the fields except the option field. Not sure how to get the date fields yet. I hope you can help. This is the form: <script> // <![CDATA[ jQuery(document).ready(function(){ $('#contactform').submit(function(){ var action = $(this).attr('action'); $.post(action, { name: $('#name').val(), email: $('#email').val(), phone: $('#phone').val(), enquiries: $('#enquiries').val(), message: $('#message').val() }, function(data){ $('#contactform #submit').attr('disabled',''); $('.response').remove(); $('#contactform').before('<p class="response">'+data+'</p>'); $('.response').slideDown(); if(data=='Message sent!') $('#contactform').slideUp(); } ); return false; }); }); // ]]> </script> <form action="send.php" method="post" id="contactform"> <ol> <li> <label for="name">First Name <span class="red">*</span></label> <input id="name" name="name" class="text" /> </li> <li> <label for="email">Your email <span class="red">*</span></label> <input id="email" name="email" class="text" /> </li> <li> <label for="phone">Phone Contact <span class="red">*</span></label> <input id="phone" name="phone" class="text" /> </li> <li> <label for="enquiries">Enquiries <span class="red">*</span></label> <select name="enquiries" > <option value="Not Selected">--- Please Select ----</option> <option value="Bookings">Bookings</option> <option value="General Enquiry">General Enquiry</option> <option value="Expander">Expander</option> <option value="Swan">Swan</option> </select> </li> <li> <label for="date-from">Date <span class="red">*</span></label> <div style="float: left;"> <div style="float: left; padding-right: 3px; line-height: 18px;">from:</div> <div style="float: left;"> <?php $thisweek = date('W'); $thisyear = date('Y'); $dayTimes = getDaysInWeek($thisweek, $thisyear); //---------------------------------------- $date1 = date('Y-m-d', $dayTimes[0]); $date2 = date('Y-m-d', $dayTimes[(sizeof($dayTimes)-1)]); function getDaysInWeek ($weekNumber, $year, $dayStart = 1) { // Count from '0104' because January 4th is always in week 1 // (according to ISO 8601). $time = strtotime($year . '0104 +' . ($weekNumber - 1).' weeks'); // Get the time of the first day of the week $dayTime = strtotime('-' . (date('w', $time) - $dayStart) . ' days', $time); // Get the times of days 0 -> 6 $dayTimes = array (); for ($i = 0; $i < 7; ++$i) { $dayTimes[] = strtotime('+' . $i . ' days', $dayTime); } // Return timestamps for mon-sun. return $dayTimes; } $myCalendar = new tc_calendar("date3", true, false); $myCalendar->setIcon("images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($date1)), date('m', strtotime($date1)), date('Y', strtotime($date1))); $myCalendar->setPath("./"); $myCalendar->setYearInterval(1970, 2020); //$myCalendar->dateAllow('2009-02-20', "", false); $myCalendar->writeScript(); ?> <div style="float: left;"> <div style="float: left; padding-left: 3px; padding-right: 3px; line-height: 18px;">to</div> <div style="float: left;"> <?php $myCalendar = new tc_calendar("date4", true, false); $myCalendar->setIcon("images/iconCalendar.gif"); $myCalendar->setDate(date('d', strtotime($date2)), date('m', strtotime($date2)), date('Y', strtotime($date2))); $myCalendar->setPath("./"); $myCalendar->setYearInterval(1970, 2020); //$myCalendar->dateAllow("", '2009-11-03', false); $myCalendar->writeScript(); ?> </div> </div> </div> </div> </li> <li> <label for="message">Message <span class="red">*</span></label> <textarea id="message" name="message" rows="6" cols="50"></textarea> </li> <li class="buttons"> <input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" /> <div class="clr"></div> </li> </ol> </form> And this is the PHP form processor. <?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="<span class=\"error-red\">Invalid email address entered</span>"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','phone',$enquiries,'message'); $required = array('name','email','phone','enquiries','message'); $your_email = "my@email.com.au"; $email_subject = "Website Enquiries: ".$_POST['subject']; $email_content = "New message:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'enquiries' && $key != 'email') { if( empty($_POST[$value]) ) { echo '<span class="error-red">PLEASE FILL IN REQUIRED FIELDS!</span>'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?>
  10. Hi I am sorry but I don't know how to do that. If you can give me one line of example, may be I can follow and do the rest. I know what you are saying it is just I don't know how to evaluate it in flash as it has functions that not sure how to insert php code into.
  11. I have posted the flash email code above your answer. I don't know what else it needs.
  12. No difference. Still no emails are sent. It says it is sending when submitted blank or filled in,
  13. Thank you for your kind help. Form is now not sending at all.
×
×
  • 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.