macman hat geschrieben:Ok ok, ich muß aber erstmal die Dateien wieder finden, dann teste ich es noch mal, und dann packe ich es zu den Snippets. Weiß aber noch nicht, ob ich heute dazu komme.
Das ist ein wort...... Super...
Wenn dan dass buch
http://www.amazon.de/exec/obidos/ASIN/3 ... 39-1476007 raus kommt 1° oder 2° auflage mit deinem namen ... dann ist eine runde Faellig...
dass Problem bei diese http post ist einfach .. die header, und die muss man korrekt hinbekommen nach diesem rtf xxx standard sonst kommen die variable als $_SERVER["HTTP_AFAFAFF"] an und um diese Post richtig zu bekommen muss man stunden lang mit network sniffer & browser rummwuergen damit man es hin bekommt ....
Von PHP seite kann ich nur beobachten wass hineinkommt...
Code: Alles auswählen
<?php
ob_start(); /* alles abfangen was echo & Print ist */
/* post action upload & Variablen */
/* html form */
?> <pre>Array 1
<?php
print_r($DEFINITIONFILE);
?> </pre>
<pre> Array _POST
<?php
print_r($_POST);
?> </pre>
<pre>Array _GET
<?php
print_r($_GET);
?> </pre>
<pre>Array _FILE
<?php
print_r($_FILE);
?> </pre><?php
$puffermg=ob_get_contents();
while (@ob_end_clean());
file_put_contents("lastaction.html",$puffermg); /* im file lesen wass passiert ist*/
print($puffermg);
exit;
?>
Oder voll wie ich es mache..... mit eine phpinfo(); & PHP5 dann ist alles sichtbar.... wass fuer post hineinkommen.....
Code: Alles auswählen
<?php
ob_start();
set_time_limit(60 * 2);
if(!defined('QTDEST_DIR_FILE')) {
define('QTDEST_DIR_FILE',dirname(__FILE__).'/qtdir/');
}
/* check post pass ..... */
if ($_SERVER['REQUEST_METHOD'] == "POST") {
header("Content-Type: text/plain");
if ($_POST['action'] == "beamup") {
$TMPFILELOCATION=$_FILES['qtfile']['tmp_name'];
$ENDFILENAME=$_FILES['qtfile']['name'];
$TMPFILETYPE=$_FILES['qtfile']['type'];
if (is_file($TMPFILELOCATION)) {
/* move file e check type mime .... */
$DEFINITIONFILE=Pulitzer_Mime::Put_To_Box($TMPFILELOCATION,$ENDFILENAME);
}
print_r($DEFINITIONFILE);
print_r($_POST);
print_r($_GET);
$puffermg=ob_get_contents();
while (@ob_end_clean());
file_put_contents("lastaction.html",$puffermg);
print($puffermg);
exit;
}
}
/* check post pass ..... */
print_r($_POST);
print_r($_GET);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>QT Upload contest HTTP _POST</title>
</head>
<body>
<form action="tools.php" method="post" enctype="multipart/form-data" name="onlyclient" id="onlyclient">
<input type="hidden" name="action" value="beamup">
Username:<br/><input type="text" name="username"><br/><br/>
Password:<br/><input type="password" name="password"><br/><br/>
Your File:<BR><input type=file name=qtfile><BR><BR>
<input type=submit name=submit value="Upload">
</form>
</body>
</html>
<?php
phpinfo();
///Pulitzer_Mime::Get($file);
class Pulitzer_Mime {
public static function Get($src) {
$extension = substr($src,strrpos($src,".")+1);
switch ($extension) {
case "rtf";
return "text/rtf";
case "sxw":
case "odt":
case "ods":
case "sxc":
return "application/vnd.sun.xml.writer";
case "pdf":
return "application/pdf";
case "gif":
return "image/gif";
case "jpg":
case "jpeg":
return "image/jpeg";
case "png":
return "image/png";
case "css":
return "text/css";
case "xml":
case "xsl":
case "xsd":
case "rng":
case "eps":
case "ps":
case "zip":
case "sit":
case "gz":
case "tar":
case "mp3":
return "text/xml";
case "js":
return "text/javascript";
case "html":
case "htm":
case "xhtml":
return "text/html";
case "txt":
return "text/plain";
default:
if (file_exists($src)) {
$m = `file -b $src`;
return $m;
} else {
return "text/unknow";
}
}
}
public static function unix_file_size($file) {
///// return user /// ls -l file | awk '{print $3}' ////
$kb = 1024; // Kilobyte
$mb = 1024 * $kb; // Megabyte
$gb = 1024 * $mb; // Gigabyte
$tb = 1024 * $gb; // Terabyte
$size = filesize($file);
if ( $size == 0)
$size = exec("ls -l $file | awk '{print $5}'");
if($size < $kb) {
return $size." B";
}
else if($size < $mb) {
return round($size/$kb,2)." KB";
}
else if($size < $gb) {
return round($size/$mb,2)." MB";
}
else if($size < $tb) {
return round($size/$gb,2)." GB";
}
else {
return round($size/$tb,2)." TB";
}
return $size;
}
public static function Put_To_Box($src,$name) {
$name=str_replace("%20", "_", rawurlencode($name));
$name=str_replace("%", "", $name);
$DestFileGoTo=QTDEST_DIR_FILE.$name;
if (is_file($DestFileGoTo)) {
@unlink($DestFileGoTo);
}
if (!move_uploaded_file($src,$DestFileGoTo)) {
return false;
} else {
@chmod($DestFileGoTo,0664);
if (file_exists($DestFileGoTo)) {
$ma = `file -b $DestFileGoTo`;
}
$m = preg_replace('=([[:space:]]{2,})=im', ' ', trim($ma, " \n."));
$umime=self::Get($DestFileGoTo);
$proprieti['type']=$umime;
$proprieti['unixtype']=$m;
$proprieti['name']=$name;
$proprieti['source']=$DestFileGoTo;
$proprieti['size']=self::unix_file_size($DestFileGoTo);
$proprieti['checkone']=md5($umime);
return $proprieti;
}
}
}
/* anfang file #ob_start(); */
$puffermg=ob_get_contents();
while (@ob_end_clean());
file_put_contents("lastaction.html",$puffermg);
print($puffermg);
exit;
?>
Ich habe bereist solche post mit php gemacht & libcurl.....
Aber mit qt is es eben nochmals anders ... libcurl problemen zwichen os...
in etwa....
Code: Alles auswählen
$Ffields=array(
"__EVENTTARGET" => "repLang:_ct0:lbLang",
"__EVENTARGUMENT" => 'repLang$_ct0$lbLang',
"__VIEWSTATE" => $this->VIEWSTATE, /* asp secure nummer session read ... and transfer to all page. on read.. */
"dlg1:ctrl1:tbKunde" => "252525",
"dlg1:ctrl1:tbKuerzel" => "2352352",
"dlg1:ctrl1:PasswordTexBox" => "ygygsgsg",
"dlg1:ctrl1:cbPersistentLogin" => "on",
"dlg1:ctrl1:Btn_Login" => "Anmelden");
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST,true);
curl_setopt ($ch, CURLOPT_USERAGENT, $this->Set_Agent());
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->Workdir.'/also_cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->Workdir.'/also_cookie.txt');
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($Ffields));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 12);
$resultxml = curl_exec ($ch)