Thursday, July 29th 2010, 1:32pm UTC+2
You are not logged in.
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 |
include_once ("mysql_cl.inc.php");
$MySQL = new mysqlconn();
$MySQL->connects();
$results = $MySQL->_sqlselect("SELECT... ");
$results = $MySQL->_sqlinsert("INSERT... ");
$results = $MySQL->_sqlupdate("UPDATE... ");
$results = $MySQL->_sqlalter("ALTER... ");
$results = $MySQL->_sqldelete("DELETE.. ");
$results = $MySQL->_sqlclose();
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
<?php
/**********************************************************/
/* Autor: Ming */
/**********************************************************/
// Scriptname: mysql_cl.inc.php
/*
include_once ("mysql_cl.inc.php");
$MySQL = new mysqlconn();
$MySQL->connects();
$results = $MySQL->_sqlselect("SELECT... ");
$results = $MySQL->_sqlinsert("INSERT... ");
$results = $MySQL->_sqlupdate("UPDATE... ");
$results = $MySQL->_sqlalter("ALTER... ");
$results = $MySQL->_sqldelete("DELETE.. ");
$results = $MySQL->_sqlclose();
*/
class mysqlconn
{
var $DBHOST = "localhost";
var $DBASE = "webmast";
var $USER = "test";
var $PASS = "fummel";
function error($m, $l="", $info="")
{
print "<pre>" . $m . $l . $info . "</pre>";
return exit;
}
function connects()
{
$this->DBCON = mysql_connect($this->DBHOST, $this->USER, $this->PASS) or die ($this->error(mysql_error(), __LINE__). false);
$this->DBBASE = mysql_select_db($this->DBASE) or die ($this->error(mysql_error(), __LINE__). false);
}
function _sqlselect($SQL)
{
if (!ereg("^SELECT", $SQL))
{
$this->error("SQL SELECT ERROR:", __line__);
return false;
}
$query_str = mysql_query($SQL) or die ($this->error("QUERY ERROR:", mysql_error()));
if($query_str || !empty($query_str))
{
return $query_str;
} else {
$this->error("Kein query select:", __line__);
mysql_free_result($query_str);
return false;
}
}
function _sqlinsert($SQL)
{
if (!ereg("^INSERT", $SQL))
{
$this->error("SQL INSERT ERROR:", __line__);
return false;
}
$result = mysql_query($SQL) or die ($this->error("QUERY ERROR:", __line__." => ".mysql_error()));
if(!$result)
{
$this->error("Kein query insert:", __line__);
return false;
} else {
$result = mysql_insert_id();
return $result;
}
}
function _sqlupdate($SQL)
{
if (!ereg("^UPDATE", $SQL))
{
$this->error("SQL UPDATE ERROR:", __line__);
return false;
}
$result = mysql_query($SQL) or die ($this->error("QUERY ERROR:", __line__," => ".mysql_error()));
if(!$result)
{
$this->error("Kein query update:", __line__);
return false;
}
$results = mysql_insert_id();
return $result;
}
function _sqldelete($SQL)
{
if (ereg("^DELETE", $SQL))
{
$result = mysql_query($SQL) or die ($this->error("QUERY ERROR:", __line__," => ".mysql_error()));
if(!$result)
{
$this->error("Kein query delete:", __line__);
return false;
}
return $result;
} else {
return false;
}
}
function _sqlalter($SQL)
{
if (ereg("^ALTER", $SQL))
{
$result = mysql_query($SQL) or die ($this->error("QUERY ERROR:", __line__," => ".mysql_error()));
if(!$result)
{
$this->error("Kein query alter:", __line__);
return false;
}
return $result;
} else {
return false;
}
}
function _sqlclose()
{
mysql_close($this->DBCON);
}
function _settime()
{
setlocale (LC_TIME, "de_DE");
$time = date("H:i:s", mktime());
$date = strftime("%d %b %Y", mktime());
return $date . " um " . $time;
}
} //#Ende MySQLCL
?>
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 |
include_once("./Upload_cl.inc.php");
$Upload = new imageupload("./pics");
if(isset($_POST['SEND_FILE']) && isset($_FILES['THIS_FILE']))
{
if($Upload->_fileupload() == true)
echo "Upload erfolgreich!";
}
echo $Upload->_htmlpostfile();
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
/**********************************************************/
/* Autor: Ming */
/**********************************************************/
// Scriptname: Upload_cl.inc.php
/*
include_once("./Upload_cl.inc.php");
$Upload = new imageupload("./pics");
if(isset($_POST['SEND_FILE']) && isset($_FILES['THIS_FILE']))
{
if($Upload->_fileupload() == true)
echo "Upload erfolgreich!";
}
echo $Upload->_htmlpostfile();
*/
class imageupload
{
var $ALOWFILE = "image/pjpeg";
var $PFAD;
var $MAXSIZE = 500000;
var $FILES;
function imageupload($path)
{
$Verz = realpath($path);
if(is_dir($Verz) && is_writeable($Verz))
{
$this->PFAD = $Verz."/";
} else {
echo "Keine gültige Pfadangabe oder keine Schreibrechte! ". $path;
return exit;
}
}
function error($in,$info="")
{
$mess = array("Es fehlt ein Tempverzeichnis!",
"Die Datei ist zu groß!",
"Falscher Dateityp");
print "<font color=\"#FF0000\">ERROR:" . $mess[$in] . "</font> ". $info;
return exit;
}
function _htmlpostfile()
{
$print = "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\"
enctype=\"multipart/form-data\" id=\"uploadtag\">
<input type=\"file\" name=\"THIS_FILE\" id=\"THIS_FILE\" size=\"80\" accept=\"" . $this->ALOWFILE . "\" />
<input type=\"submit\" name=\"SEND_FILE\" value=\"Start\" />
</form>";
return $print;
}
function _fileupload()
{
if($_FILES['THIS_FILE']['size'] > $this->MAXSIZE)
{
unset($_FILES['THIS_FILE']['tmp_name']);
$this->error(1, $_FILES['THIS_FILE']['size'] ." Bytes");
}
if($_FILES['THIS_FILE']['type'] != $this->ALOWFILE)
{
unset($_FILES['THIS_FILE']['tmp_name']);
$this->error(2, $_FILES['THIS_FILE']['type']);
}
$Image_Neu = $this->PFAD.$_FILES['THIS_FILE']['name'];
if(move_uploaded_file($_FILES['THIS_FILE']['tmp_name'], $Image_Neu))
{
unset($_FILES['THIS_FILE']);
return true;
}
}
}
//#END CLASS
|
|
|
PHP Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
function ScanDirectory( $dir, $tpl = 'XmlDirTree' )
{
$xml = new DomDocument( '1.0', 'utf-8' );
$firstChild = $xml->createElement( 'explorer' );
$xml->appendChild( $firstChild );
$mp = realpath( strip_tags( $dir ) );
$dirh = new DirectoryIterator( $mp );
$nextChild = $xml->createElement( 'directory' );
$nextChild->setAttribute( 'basename', ucfirst( basename( $dir ) ) );
$firstChild->appendChild( $nextChild );
foreach ( $dirh as $f ) {
$Depth = ( substr_count( $f->getPathname(), "/" ) - substr_count( $mp, "/" ) );
if ( ! $f->isDot() ) {
$nextSibling = $xml->createElement( 'item' );
$nextSibling->appendChild( $xml->createElement( 'name', $f->getFilename() ) );
$nextSibling->appendChild( $xml->createElement( 'path', $f->getPathname() ) );
$nextSibling->appendChild( $xml->createElement( 'depth', $Depth ) );
$nextSibling->appendChild( $xml->createElement( 'type', $f->getType() ) );
$nextSibling->appendChild( $xml->createElement( 'lastmodified', $f->getMTime() ) );
$nextChild->appendChild( $nextSibling );
} else
continue;
}
unset( $dirh );
clearstatcache();
$xd = new DOMDocument( "1.0", "utf-8" );
$xd->load( "./" . $tpl . ".xslt" );
$xsl = new XSLTProcessor;
$xsl->registerPHPFunctions();
$xsl->importStyleSheet( $xd );
$out = $xsl->transformToXML( $xml );
return $out;
}
|