Jump to content

papaface

Members
  • Posts

    1,437
  • Joined

  • Last visited

    Never

Posts posted by papaface

  1. Hello,

     

    I have a script which is used to get a file off a remote server however the transfer is taking place an an EXTREMELY slow rate.

     

    Does anyone have any idea what could be causing this?

    		$this->ch = curl_init($url);
    	$parts = parse_url($url);
    	curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,1);
    	curl_setopt($this->ch,CURLOPT_FOLLOWLOCATION,1);
    	$header = array("Host: {$parts['host']}","Accept: text/xml,application/xml,application/xhtml+xml,text/html,;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070625 Ubuntu/7.10 (gutsy) Firefox/3.0.0.7", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300");
    	curl_setopt($this->ch, CURLOPT_HTTPHEADER, $header);

  2. Probably a better way to do this, but just do:

     

    $count = mysql_query("SELECT `request_tel` FROM `request` WHERE `request_tel`='".$_POST['request_tel']."' ");
    if (mysql_num_rows($count) <= 3)
    {
    $Query = mysql_query('INSERT INTO `request` (
          `request_year`,
          `request_month`,
          `request_day`,
          `request_date`,
          `request_ip`,
          `request_tel`,
          `request_txt`,
          `request_artist`,
          `request_title`,
          `request_datetime`,
          `request_ipp`
          
       ) VALUES (
          "'.$_POST['request_year'].'",
          "'.$_POST['request_month'].'",
          "'.$_POST['request_day'].'",
          "'.$_POST['request_year'].$_POST['request_month'].$_POST['request_day'].'",
          "'.$_POST['request_ip'].'",
          "'.$_POST['request_tel'].'",
          "'.$NoPregText.'",
          "'.$_POST['request_artist'].'",
          "'.$_POST['request_title'].'",
          "'.date('Y-m-d H:i:s').'",
          "'.getenv('REMOTE_ADDR').'"
       )');
    
      if ($Query)
        {
         //inserted correctly
        }
      else
        {
         //issue inserting
        }
    
    }
    else
    {
    //3 or more with the same tel in db
    }

  3. You could try:

    $_FILES = array();
    $_POST = array();
    

    But for a fool proof way, I think you may have to generate a value in a hidden field which is unique. When someone uploads something have that value inserted into the database IF its not already in the table. If it is then it is a duplicate (i.e the person refreshed the page) and have the script exit or produce an error.

  4. Code should be:

    <?php
    
    $payment = "3.50";
    
    $ref = $_COOKIE['ref'];
    
    mysql_connect($server, $db_user, $db_pass)
          or die ("Database CONNECT Error (line ");
          
          
    mysql_select_db($database); //cant see the $database var defined anywhere....
    
    $monthlydue = mysql_query("select `monthlydue` from `affiliates` where `memid`= '".$ref."'");
    while	($row = mysql_fetch_array($monthlydue))
    {
    mysql_query("UPDATE `affiliates` SET `monthlydue` ='".$row['monthlydue'] + $payment."' WHERE `memid` ='".$ref."'");
    }
    ?>
    

    You may also be able to do this:

    <?php
    
    $payment = "3.50";
    
    $ref = $_COOKIE['ref'];
    
    mysql_connect($server, $db_user, $db_pass)
          or die ("Database CONNECT Error (line ");
          
          
    mysql_select_db($database); //cant see the $database var defined anywhere....
    
    mysql_query("UPDATE `affiliates` SET `monthlydue` = '`monthlydue`+".$payment."' WHERE `memid` ='".$ref."'");
    
    ?>

×
×
  • 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.