Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] formularz prosty
bartek24m
post
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 17.06.2006

Ostrzeżenie: (0%)
-----


WItam,
problem polega na przesłaniu danych z formularza do nowego pliku php

czy jest jakaś możliwość uczynienia tego

mam w pliku index.php
cos takiego

[PHP]
  •                     $buf=fread($fp,$this->maxbuf) or die("Unable to read file"); // read max bytes from the file
  •                         $cursize=$cursize+strlen($buf);
  •                         if(fwrite($sock,$buf)) { // send data
  •                         }
  •                 }
  •                 fwrite($sock,$contenttail); // finished
  •                 $ret=fread($sock,10000); // receive data (links, hash, bytes)
  •                 preg_match("/rnrn(.+)/s",$ret,$match); // we don't need the http-header
  •          $ret=explode("n",$match[1]); // every line gets an entry in an array
  •         fclose($sock);
  •         fclose($fp);
  •                 foreach($ret as $id => $cont) {
  •                     if($id!=0) { // very boring stuff!
  •                             if($id>4) break; // break foreach
  •                             $key_val[]=substr($cont,8); // throw away the first eight chars
  •                         }
  •                 }
  •                 if($hash==$key_val[3]) { // if the hash is == hash of the local file
  •                  return $key_val;
  •                 } else {  // omg! upload failed!
  •                     printf("Upload FAILED! Your hash is %s, while the uploaded file has the hash %s",$hash,$key_val[3]);
  •                         return FALSE;
  •                 }
  •         }
  • }
  •  
  •  
  • if(isset($_POST['upload1'])){
  • $c=count($_POST['zaznacz']);
  • //echo $c;
  • echo ('<center>Zaznacz linki i skopiuj je !<BR><form><TEXTAREA style="FONT-SIZE: 11px;border:1px dashed #FF00FF;" rows="8" cols="90" name="pole">');
  • for ($x=1; $x<$c+1; $x++)
  • {
  •  //echo $_POST['zaznacz'][$x-1];
  •  $upload_file = $_POST['zaznacz'][$x-1];
  •  $upload=new rapidphp;
  •  $upload->config("prem","123","abc");
  •  $wynik=$upload->sendfile("$upload_file");
  •  echo ($wynik[0]);
  •  echo "n";
  • }
  • echo ('</TEXTAREA></form></center>');
  • }
  •  
  • ?>

    [/list]
    [PHP] imeout">stream_set_timeout($sock,3600); // anti timeout
  •                 $fp=    fopen($file,"r");
  •                 $boundary = "---------------------632865735RS4EVER5675864";
  •                 $contentheader="rnContent-Disposition: form-data; name="rsapi_v1"rnrn1rn";
  •                 if($this->zone=="prem") {  // premium
  •              $contentheader .= sprintf("%srnContent-Disposition: form-data; name="login"rnrn%srn",$boundary,$this->login);
  •              $contentheader .= sprintf("%srnContent-Disposition: form-data; name="password"rnrn%srn",$boundary,$this->passwort);
  •                 }
  •                 if($this->zone=="col") { // collector
  •              $contentheader .= sprintf("%srnContent-Disposition: form-data; name="freeaccountid"rnrn%srn",$boundary,$this->login);
  •              $contentheader .= sprintf("%srnContent-Disposition: form-data; name="password"rnrn%srn",$boundary,$this->passwort);
  •                 }
  •                 $contentheader .= sprintf("%srnContent-Disposition: form-data; name="filecontent"; filename="%s"rnrn",$boundary,$file);
  •        $contenttail = "rn".$boundary."--rn";
  •        $contentlength = strlen($contentheader) + $size + strlen($contenttail);
  •                 $header = "POST /cgi-bin/upload.cgi HTTP/1.0rnContent-Type: multipart/form-data; boundary=".$boundary."rnContent-Length: ".$contentlength."rnrn";
  •                 fwrite($sock,$header.$contentheader);
  •                 while($cursize < $size) { // If we didn't upload everything, repeat!
  •                     $buf=fread($fp,$this->maxbuf) or die("Unable to read file"); // read max bytes from the file
  •                         $cursize=$cursize+strlen($buf);
  •                         if(fwrite($sock,$buf)) { // send data
  •                         }
  •                 }
  •                 fwrite($sock,$contenttail); // finished
  •                 $ret=fread($sock,10000); // receive data (links, hash, bytes)
  •                 preg_match("/rnrn(.+)/s",$ret,$match); // we don't need the http-header
  •          $ret=explode("n",$match[1]); // every line gets an entry in an array
  •         fclose($sock);
  •         fclose($fp);
  •                 foreach($ret as $id => $cont) {
  •                     if($id!=0) { // very boring stuff!
  •                             if($id>4) break; // break foreach
  •                             $key_val[]=substr($cont,8); // throw away the first eight chars
  •                         }
  •                 }
  •                 if($hash==$key_val[3]) { // if the hash is == hash of the local file
  •                  return $key_val;
  •                 } else {  // omg! upload failed!
  •                     printf("Upload FAILED! Your hash is %s, while the uploaded file has the hash %s",$hash,$key_val[3]);
  •                         return FALSE;
  •                 }
  •         }
  • }
  •  
  •  
  • if(isset($_POST['upload1'])){
  • $c=count($_POST['zaznacz']);
  • //echo $c;
  • echo ('<center>Zaznacz linki i skopiuj je !<BR><form><TEXTAREA style="FONT-SIZE: 11px;border:1px dashed #FF00FF;" rows="8" cols="90" name="pole">');
  • for ($x=1; $x<$c+1; $x++)
  • {
  •  //echo $_POST['zaznacz'][$x-1];
  •  $upload_file = $_POST['zaznacz'][$x-1];
  •  $upload=new rapidphp;
  •  $upload->config("prem","123","abc");
  •  $wynik=$upload->sendfile("$upload_file");
  •  echo ($wynik[0]);
  •  echo "n";
  • }
  • echo ('</TEXTAREA></form></center>');
  • }
  •  
  • ?>

    [/list]
    [PHP] Go to the top of the page
  • +Quote Post

    Posty w temacie


    Reply to this topicStart new topic
    2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
    0 Zarejestrowanych:

     



    RSS Aktualny czas: 25.12.2025 - 01:35