コード例 #1
0
function Decrypt($S)
{
    $chars = "KECTDPOSWNMFGQHL";
    $S = Substr($S, 1);
    $s1 = "";
    for ($F = 0; $F < StrLen($S) / 2; $F++) {
        $f1 = StrPos($chars, substr($S, $F, 1));
        $f2 = StrPos($chars, substr($S, StrLen($S) / 2 + $F, 1));
        $f2 = $f2 << 4;
        $ff = $f1 | $f2;
        $s1 = $s1 . Chr($ff);
    }
    return $s1;
}
コード例 #2
0
                $order = $orderxml->xpath("/BUILD/BuildTroops[Terrno/text()='" . substr($key, 2) . "']");
                $order[0]->Major = $val;
            } else {
                if (substr($key, 0, 2) == 'S-') {
                    $key = Substr($key, 2);
                    $orderxml->Strategic->{$key} = $val;
                } else {
                    if (substr($key, 0, 4) == 'max_') {
                        $orderxml->Storage->{$key} = $val;
                    } else {
                        if (substr($key, 0, 3) == 'RA_') {
                            $key = Substr($key, 3);
                            $orderxml->Research->{$key}->Amt = $val;
                        } else {
                            if (substr($key, 0, 3) == 'RV_') {
                                $key = Substr($key, 3);
                                $orderxml->Research->{$key}->Val = $val;
                            }
                        }
                    }
                }
            }
        }
    }
}
// Put XML back into the table
$row[0] = $orderxml->asXML();
$mysqli->query("Update sp_orders set order_code='{$row[0]}' where gameno={$gameno} and userno={$userno} and ordername='SR_ORDERXML'") or die($mysqli->error);
// Set orders to submitted
$mysqli->query("Update sp_orders Set order_code='Orders received' Where gameno={$gameno} and turnno={$turnno} and phaseno={$phaseno} and userno={$userno} and ordername='ORDSTAT'") or die($mysqli->error);
// Send message back to the user
コード例 #3
0
function afficherTel($num)
{
    if ($num) {
        $num = str_replace(" ", "", $num);
        $num = Substr($num, 0, 2) . " " . Substr($num, 2, 2) . " " . Substr($num, 4, 2) . " " . Substr($num, 6, 2) . " " . Substr($num, 8, 2);
    }
    return $num;
}
コード例 #4
0
ファイル: editconfig.php プロジェクト: j3k0/Wobi
     echo errorMessage() . "Error: The database username is blank.</p>";
     exit;
 }
 if ($_POST["dbpass"] == "") {
     echo errorMessage() . "Error: The database password is blank.</p>";
     exit;
 }
 if ($_POST["database"] == "") {
     echo errorMessage() . "Error: The database name is blank.</p>";
     exit;
 }
 if ($_POST["rss_link"] != "" && Substr($_POST["rss_link"], 0, 7) != "http://") {
     echo errorMessage() . "Error: The RSS website URL does not start with http://</p>";
     exit;
 }
 if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://") {
     echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
     exit;
 }
 if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0) {
     echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
     exit;
 }
 if (!is_numeric($_POST["max_uploads"]) || $_POST["max_uploads"] == "" || $_POST["max_uploads"] <= 0) {
     echo errorMessage() . "Error: The maximum uploads is not an integer, a negative number, or is blank.</p>";
     exit;
 }
 if ($_POST["timezone"] == "") {
     echo errorMessage() . "Error: The timezone is blank.</p>";
     exit;
 }
コード例 #5
0
ファイル: a.php プロジェクト: robocon/shs
function baht($nArabic)
{
    $nArabic = number_format($nArabic, 2, '.', '');
    $cTarget = Ltrim($nArabic);
    $cLtnum = "";
    $x = 0;
    while (substr($cTarget, $x, 1) != ".") {
        $cLtnum = $cLtnum . substr($cTarget, $x, 1);
        $x++;
    }
    $cRtnum = substr($cTarget, $x + 1, 2);
    $nUnit = $x;
    $nNum = $nUnit;
    $cRead = "(";
    include "../connect.inc";
    if ($cLtnum != "0") {
        $count = 0;
        for ($i = 0; $i <= $nNum; $i++) {
            $cNo = Substr($cLtnum, $count, 1);
            $count++;
            //��ҹ��ѡ
            if ($cNo != 0 and $cNo != "-") {
                if ($nUnit != 1) {
                    $query = "SELECT * FROM thaibaht WHERE fld1 = '{$nUnit}' ";
                    $result = mysql_query($query) or die("Query 1 failed");
                    for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                        if (!mysql_data_seek($result, $i)) {
                            echo "Cannot seek to row {$i}\n";
                            continue;
                        }
                        if (!($row = mysql_fetch_object($result))) {
                            continue;
                        }
                    }
                    $cVarU = $row->fld4;
                    //��ҹ��ѡ
                } else {
                    $cVarU = "";
                }
                //��ҹ�Ţ
                $query = "SELECT * FROM thaibaht WHERE fld1 = '{$cNo}' ";
                $result = mysql_query($query) or die("Query 2 failed");
                for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                    if (!mysql_data_seek($result, $i)) {
                        echo "Cannot seek to row {$i}\n";
                        continue;
                    }
                    if (!($row = mysql_fetch_object($result))) {
                        continue;
                    }
                }
                $cVar1 = $row->fld2;
                //��ҹ����Ţ
                ///
                if ($nUnit == '2' && $cNo == '2') {
                    $cVar1 = "���";
                } elseif ($nUnit == '2' && $cNo == '1') {
                    $cVar1 = "";
                } elseif ($nUnit == '1' && $cNo == '1' && $nNum != 1) {
                    $cVar1 = "���";
                } else {
                    echo "";
                }
                $cRead = $cRead . $cVar1 . $cVarU;
            }
            $nUnit--;
        }
        $cRead = $cRead . "�ҷ";
    }
    ////Stang////
    if ($cRtnum != "00") {
        $nUnit = 2;
        $count = 0;
        for ($i = 0; $i <= 2; $i++) {
            $cNo = Substr($cRtnum, $count, 1);
            $count++;
            if ($cNo != "0") {
                $query = "SELECT * FROM thaibaht WHERE fld1 = '{$cNo}' ";
                $result = mysql_query($query) or die("Query failed");
                for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                    if (!mysql_data_seek($result, $i)) {
                        echo "Cannot seek to row {$i}\n";
                        continue;
                    }
                    if (!($row = mysql_fetch_object($result))) {
                        continue;
                    }
                }
                $cVar1 = $row->fld2;
                /////
                if ($nUnit == '2' && $cNo == '2') {
                    $cVar1 = "���";
                }
                if ($nUnit == '2' && $cNo == '1') {
                    $cVar1 = "";
                }
                if ($nUnit == '1' && $cNo == '1') {
                    $cVar1 = "���";
                }
                if (Substr($cRtnum, 0, 1) == '0' && $cNo == '1') {
                    $cVar1 = "˹��";
                }
                ///////
                if ($nUnit != '1') {
                    $cRead = $cRead . $cVar1 . "�Ժ";
                } else {
                    $cRead = $cRead . $cVar1;
                }
            }
            $nUnit--;
        }
        $cRead = $cRead . "ʵҧ��)";
    } else {
        $cRead = $cRead . "��ǹ)";
    }
    include "../connect.inc";
    return $cRead;
}
コード例 #6
0
ファイル: barcode_label.php プロジェクト: katopenzz/openemr
 * @link http://www.open-emr.org 
 *
 * this is from the barcode-coder and FPDF website I used the examples and code snippets listed on the sites
 * to create this program
 *
 */
$fake_register_globals = false;
$sanitize_all_escapes = true;
require_once "../globals.php";
require_once "{$srcdir}/classes/PDF_Label.php";
require_once "{$srcdir}/formatting.inc.php";
require_once "{$srcdir}/classes/php-barcode.php";
//Get the data to place on labels
$patdata = sqlQuery("SELECT " . "p.fname, p.mname, p.lname, p.pubpid, p.DOB, " . "p.street, p.city, p.state, p.postal_code, p.pid " . "FROM patient_data AS p " . "WHERE p.pid = ? LIMIT 1", array($pid));
$today = date('m/d/Y');
$dob = substr($patdata['DOB'], 5, 2) . "/" . Substr($patdata['DOB'], 8, 2) . "/" . Substr($patdata['DOB'], 0, 4);
// -------------------------------------------------- //
//            BARCODE DATA AND TYPE
// -------------------------------------------------- //
$code = $patdata['pubpid'];
// what is wanted as the barcode
$bartype = $GLOBALS['barcode_label_type'];
// Get barcode type
switch ($bartype) {
    case '1':
        $type = 'std25';
        break;
    case '2':
        $type = 'int25';
        break;
    case '3':
コード例 #7
0
ファイル: LaTeXrender.php プロジェクト: a2call/commsy
	/**
	 * Checks if a formula is available from cache
	 *
	 * @param string formula in LaTeX format
	 * @returns the file's path if successful, null otherwise
	 */
	function checkFormulaCache($latex_formula,$folder) {
		// circumvent certain security functions of web-software which
		// is pretty pointless right here
		$latex_formula = preg_replace("/&gt;/i", ">", $latex_formula);
		$latex_formula = preg_replace("/&lt;/i", "<", $latex_formula);

		$formula_hash = md5($latex_formula).$this->_extraname;

		$filename = $formula_hash.".".$this->_image_format;
		$full_path_filename = $folder.$filename;

		// check if there's a file with the same md5 hash (first 32 characters)
		// either delete it or use it
		$handler = opendir($folder);
		// keep going until all files in directory have been read
		while ($file = readdir($handler)) {
			if (Substr($file, 0, 32).Substr($file, strlen($file)-4, 4) == Substr($filename, 0, 32).Substr($filename, strlen($filename)-4, 4)) {
				$filename = $file;
				$full_path_filename = $folder.$filename;
				break;
			}
		}
		// tidy up: close the handler
		closedir($handler);


		if (is_file($full_path_filename)) {
			return $filename;
		}
		else {
			return null;
		}
	}
コード例 #8
0
ファイル: Mp3.php プロジェクト: vojtajina/sitellite
 function mp3_id($file)
 {
     // Lux: we keep all variables internal within this function, that way our global namespace
     // is kept clean, and we can still call this method like a function without instantiating
     // a whole class to do so.
     //global $version, $layer, $crc, $bitrate, $bitindex, $freq, $mode, $copy, $genres;
     // Corrected by Luca (18/06/01): luca@linuxmendoza.org.ar
     $genres = array('Blues', 'Classic Rock', 'Country', 'Dance', 'Disco', 'Funk', 'Grunge', 'Hip-Hop', 'Jazz', 'Metal', 'New Age', 'Oldies', 'Other', 'Pop', 'R&B', 'Rap', 'Reggae', 'Rock', 'Techno', 'Industrial', 'Alternative', 'Ska', 'Death Metal', 'Pranks', 'Soundtrack', 'Euro-Techno', 'Ambient', 'Trip-Hop', 'Vocal', 'Jazz+Funk', 'Fusion', 'Trance', 'Classical', 'Instrumental', 'Acid', 'House', 'Game', 'Sound Clip', 'Gospel', 'Noise', 'AlternRock', 'Bass', 'Soul', 'Punk', 'Space', 'Meditative', 'Instrumental Pop', 'Instrumental Rock', 'Ethnic', 'Gothic', 'Darkwave', 'Techno-Industrial', 'Electronic', 'Pop-Folk', 'Eurodance', 'Dream', 'Southern Rock', 'Comedy', 'Cult', 'Gangsta', 'Top 40', 'Christian Rap', 'Pop/Funk', 'Jungle', 'Native American', 'Cabaret', 'New Wave', 'Psychadelic', 'Rave', 'Showtunes', 'Trailer', 'Lo-Fi', 'Tribal', 'Acid Punk', 'Acid Jazz', 'Polka', 'Retro', 'Musical', 'Rock & Roll', 'Hard Rock', 'Folk', 'Folk-Rock', 'National Folk', 'Swing', 'Fast Fusion', 'Bebob', 'Latin', 'Revival', 'Celtic', 'Bluegrass', 'Avantgarde', 'Gothic Rock', 'Progressive Rock', 'Psychedelic Rock', 'Symphonic Rock', 'Slow Rock', 'Big Band', 'Chorus', 'Easy Listening', 'Acoustic', 'Humour', 'Speech', 'Chanson', 'Opera', 'Chamber Music', 'Sonata', 'Symphony', 'Booty Bass', 'Primus', 'P**n Groove', 'Satire', 'Slow Jam', 'Club', 'Tango', 'Samba', 'Folklore', 'Ballad', 'Power Ballad', 'Rhythmic Soul', 'Freestyle', 'Duet', 'Punk Rock', 'Drum Solo', 'Acapella', 'Euro-House', 'Dance Hall');
     $genreids = array("Blues" => 0, "Classic Rock" => 1, "Country" => 2, "Dance" => 3, "Disco" => 4, "Funk" => 5, "Grunge" => 6, "Hip-Hop" => 7, "Jazz" => 8, "Metal" => 9, "New Age" => 10, "Oldies" => 11, "Other" => 12, "Pop" => 13, "R&B" => 14, "Rap" => 15, "Reggae" => 16, "Rock" => 17, "Techno" => 18, "Industrial" => 19, "Alternative" => 20, "Ska" => 21, "Death Metal" => 22, "Pranks" => 23, "Soundtrack" => 24, "Euro-Techno" => 25, "Ambient" => 26, "Trip-Hop" => 27, "Vocal" => 28, "Jazz+Funk" => 29, "Fusion" => 30, "Trance" => 31, "Classical" => 32, "Instrumental" => 33, "Acid" => 34, "House" => 35, "Game" => 36, "Sound Clip" => 37, "Gospel" => 38, "Noise" => 39, "AlternRock" => 40, "Bass" => 41, "Soul" => 42, "Punk" => 43, "Space" => 44, "Meditative" => 45, "Instrumental Pop" => 46, "Instrumental Rock" => 47, "Ethnic" => 48, "Gothic" => 49, "Darkwave" => 50, "Techno-Industrial" => 51, "Electronic" => 52, "Pop-Folk" => 53, "Eurodance" => 54, "Dream" => 55, "Southern Rock" => 56, "Comedy" => 57, "Cult" => 58, "Gangsta" => 59, "Top 40" => 60, "Christian Rap" => 61, "Pop/Funk" => 62, "Jungle" => 63, "Native American" => 64, "Cabaret" => 65, "New Wave" => 66, "Psychadelic" => 67, "Rave" => 68, "Showtunes" => 69, "Trailer" => 70, "Lo-Fi" => 71, "Tribal" => 72, "Acid Punk" => 73, "Acid Jazz" => 74, "Polka" => 75, "Retro" => 76, "Musical" => 77, "Rock & Roll" => 78, "Hard Rock" => 79, "Folk" => 80, "Folk-Rock" => 81, "National Folk" => 82, "Swing" => 83, "Fast Fusion" => 84, "Bebob" => 85, "Latin" => 86, "Revival" => 87, "Celtic" => 88, "Bluegrass" => 89, "Avantgarde" => 90, "Gothic Rock" => 91, "Progressive Rock" => 92, "Psychedelic Rock" => 93, "Symphonic Rock" => 94, "Slow Rock" => 95, "Big Band" => 96, "Chorus" => 97, "Easy Listening" => 98, "Acoustic" => 99, "Humour" => 100, "Speech" => 101, "Chanson" => 102, "Opera" => 103, "Chamber Music" => 104, "Sonata" => 105, "Symphony" => 106, "Booty Bass" => 107, "Primus" => 108, "P**n Groove" => 109, "Satire" => 110, "Slow Jam" => 111, "Club" => 112, "Tango" => 113, "Samba" => 114, "Folklore" => 115, "Ballad" => 116, "Power Ballad" => 117, "Rhythmic Soul" => 118, "Freestyle" => 119, "Duet" => 120, "Punk Rock" => 121, "Drum Solo" => 122, "Acapella" => 123, "Euro-House" => 124, "Dance Hall" => 125);
     // end
     $version = array("00" => 2.5, "10" => 2, "11" => 1);
     $layer = array("01" => 3, "10" => 2, "11" => 1);
     $crc = array("Yes", "No");
     $bitrate["0001"] = array(32, 32, 32, 32, 8, 8);
     $bitrate["0010"] = array(64, 48, 40, 48, 16, 16);
     $bitrate["0011"] = array(96, 56, 48, 56, 24, 24);
     $bitrate["0100"] = array(128, 64, 56, 64, 32, 32);
     $bitrate["0101"] = array(160, 80, 64, 80, 40, 40);
     $bitrate["0110"] = array(192, 96, 80, 96, 48, 48);
     $bitrate["0111"] = array(224, 112, 96, 112, 56, 56);
     $bitrate["1000"] = array(256, 128, 112, 128, 64, 64);
     $bitrate["1001"] = array(288, 160, 128, 144, 80, 80);
     $bitrate["1010"] = array(320, 192, 160, 160, 96, 96);
     $bitrate["1011"] = array(352, 224, 192, 176, 112, 112);
     $bitrate["1100"] = array(384, 256, 224, 192, 128, 128);
     $bitrate["1101"] = array(416, 320, 256, 224, 144, 144);
     $bitrate["1110"] = array(448, 384, 320, 256, 160, 160);
     $bitindex = array("1111" => "0", "1110" => "1", "1101" => "2", "1011" => "3", "1010" => "4", "1001" => "5", "0011" => "3", "0010" => 4, "0001" => "5");
     $freq["00"] = array("11" => 44100, "10" => 22050, "00" => 11025);
     $freq["01"] = array("11" => 48000, "10" => 24000, "00" => 12000);
     $freq["10"] = array("11" => 32000, "10" => 16000, "00" => 8000);
     $mode = array("00" => "Stereo", "01" => "Joint stereo", "10" => "Dual channel", "11" => "Mono");
     $copy = array("No", "Yes");
     if (!($f = @fopen($file, "r"))) {
         return -1;
         break;
     } else {
         // read first 4 bytes from file and determine if it is wave file if so, header begins five bytes after word 'data'
         $tmp = fread($f, 4);
         if ($tmp == "RIFF") {
             $idtag["ftype"] = "Wave";
             fseek($f, 0);
             $tmp = fread($f, 128);
             $x = StrPos($tmp, "data");
             fseek($f, $x + 8);
             $tmp = fread($f, 4);
         }
         // now convert those four bytes to BIN. maybe it can be faster and easier. dunno how yet. help?
         for ($y = 0; $y < 4; $y++) {
             $x = decbin(ord($tmp[$y]));
             for ($i = 0; $i < 8 - StrLen($x); $i++) {
                 $x .= "0";
             }
             $bajt .= $x;
         }
         // every mp3 framesynch begins with eleven ones, lets look for it. if not found continue looking for some 1024 bytes (you can search multiple for it or you can disable this, it will speed up and not many mp3 are like this. anyways its not standart)
         //     if(substr($bajt,1,11)!="11111111111") {
         //        return -1;
         //        break;
         //     }
         if (substr($bajt, 1, 11) != "11111111111") {
             fseek($f, 4);
             $tmp = fread($f, 2048);
             for ($i = 0; $i < 2048; $i++) {
                 if (ord($tmp[$i]) == 255 && substr(decbin(ord($tmp[$i + 1])), 0, 3) == "111") {
                     $tmp = substr($tmp, $i, 4);
                     $bajt = "";
                     for ($y = 0; $y < 4; $y++) {
                         $x = decbin(ord($tmp[$y]));
                         for ($i = 0; $i < 8 - StrLen($x); $i++) {
                             $x .= "0";
                         }
                         $bajt .= $x;
                     }
                     break;
                 }
             }
         }
         if ($bajt == "") {
             return -1;
             break;
         }
         // now parse all the info from frame header
         $len = filesize($file);
         $idtag["version"] = $version[substr($bajt, 11, 2)];
         $idtag["layer"] = $layer[substr($bajt, 13, 2)];
         $idtag["crc"] = $crc[$bajt[15]];
         $idtag["bitrate"] = $bitrate[substr($bajt, 16, 4)][$bitindex[substr($bajt, 11, 4)]];
         $idtag["frequency"] = $freq[substr($bajt, 20, 2)][substr($bajt, 11, 2)];
         $idtag["padding"] = $copy[$bajt[22]];
         $idtag["mode"] = $mode[substr($bajt, 24, 2)];
         $idtag["copyright"] = $copy[$bajt[28]];
         $idtag["original"] = $copy[$bajt[29]];
         // lets count lenght of the song
         if ($idtag["layer"] == 1) {
             $fsize = (12 * ($idtag["bitrate"] * 1000) / $idtag["frequency"] + $idtag["padding"]) * 4;
         } else {
             $fsize = 144 * ($idtag["bitrate"] * 1000 / $idtag["frequency"] + $idtag["padding"]);
         }
         // Modified by Luca (18/02/01): devel@lluca.com
         $idtag["lenght_sec"] = round($len / Round($fsize) / 38.37);
         // end
         $idtag["lenght"] = date("i:s", round($len / Round($fsize) / 38.37));
         // now lets see at the end of the file for id3 tag. if exists then  parse it. if file doesnt have an id 3 tag if will return -1 in field 'tag' and if title is empty it returns file name.
         if (!$len) {
             $len = filesize($file);
         }
         fseek($f, $len - 128);
         $tag = fread($f, 128);
         if (Substr($tag, 0, 3) == "TAG") {
             $idtag["file"] = $file;
             $idtag["tag"] = -1;
             // Modified by Luca (18/02/01): devel@lluca.com
             $idtag["title"] = Mp3Parser::strip_nulls(Substr($tag, 3, 30));
             $idtag["artist"] = Mp3Parser::strip_nulls(Substr($tag, 33, 30));
             $idtag["album"] = Mp3Parser::strip_nulls(Substr($tag, 63, 30));
             $idtag["year"] = Mp3Parser::strip_nulls(Substr($tag, 93, 4));
             $idtag["comment"] = Mp3Parser::strip_nulls(Substr($tag, 97, 30));
             // If the comment is less than 29 chars, we look for the presence of a track #
             if (strlen($idtag["comment"]) < 29) {
                 if (Ord(Substr($tag, 125, 1)) == chr(0)) {
                     // If char 125 is null then track (maybe) is present
                     $idtag["track"] = Ord(Substr($tag, 126, 1));
                 } else {
                     // If not, we are sure is not present.
                     $idtag["track"] = 0;
                 }
             } else {
                 // If the comment is 29 or 30 chars long, there's no way to put track #
                 $idtag["track"] = 0;
             }
             // end
             $idtag["genreid"] = Ord(Substr($tag, 127, 1));
             $idtag["genre"] = $genres[$idtag["genreid"]];
             $idtag["filesize"] = $len;
         } else {
             $idtag["tag"] = 0;
         }
         // close opened file and return results.
         if (!$idtag["title"]) {
             $idtag["title"] = Str_replace("\\", "/", $file);
             $idtag["title"] = substr($idtag["title"], strrpos($idtag["title"], "/") + 1, 255);
         }
         fclose($f);
         return $idtag;
     }
 }
コード例 #9
0
ファイル: newtorrents.php プロジェクト: j3k0/Wobi
function addTorrent()
{
    require "config.php";
    $tracker_url = $website_url . substr($_SERVER['REQUEST_URI'], 0, -15) . "announce.php";
    $hash = strtolower($_POST["hash"]);
    $db = mysql_connect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Couldn't connect to the database, contact the administrator</p>");
    mysql_select_db($database) or die(errorMessage() . "Can't open the database.</p>");
    require_once "funcsv2.php";
    require_once "BDecode.php";
    require_once "BEncode.php";
    if ($_FILES["torrent"]["error"] != 4) {
        $fd = fopen($_FILES["torrent"]["tmp_name"], "rb") or die(errorMessage() . "File upload error 1</p>\n");
        is_uploaded_file($_FILES["torrent"]["tmp_name"]) or die(errorMessage() . "File upload error 2</p>\n");
        $alltorrent = fread($fd, filesize($_FILES["torrent"]["tmp_name"]));
        $array = BDecode($alltorrent);
        if (!$array) {
            echo errorMessage() . "Error: The parser was unable to load your torrent.  Please re-create and re-upload the torrent.</p>\n";
            endOutput();
            exit;
        }
        if (strtolower($array["announce"]) != $tracker_url) {
            echo errorMessage() . "Error: The tracker announce URL does not match this:<br>{$tracker_url}<br>Please re-create and re-upload the torrent.</p>\n";
            endOutput();
            exit;
        }
        if ($_POST["httpseed"] == "enabled" && $_POST["relative_path"] == "") {
            echo errorMessage() . "Error: HTTP seeding was checked however no relative path was given.</p>\n";
            endOutput();
            exit;
        }
        if ($_POST["httpseed"] == "enabled" && $_POST["relative_path"] != "") {
            if (Substr($_POST["relative_path"], -1) == "/") {
                if (!is_dir($_POST["relative_path"])) {
                    echo errorMessage() . "Error: HTTP seeding relative path ends in / but is not a valid directory.</p>\n";
                    endOutput();
                    exit;
                }
            } else {
                if (!is_file($_POST["relative_path"])) {
                    echo errorMessage() . "Error: HTTP seeding relative path is not a valid file.</p>\n";
                    endOutput();
                    exit;
                }
            }
        }
        if ($_POST["getrightseed"] == "enabled" && $_POST["httpftplocation"] == "") {
            echo errorMessage() . "Error: GetRight HTTP seeding was checked however no URL was given.</p>\n";
            endOutput();
            exit;
        }
        if ($_POST["getrightseed"] == "enabled" && (Substr($_POST["httpftplocation"], 0, 7) != "http://" && Substr($_POST["httpftplocation"], 0, 6) != "ftp://")) {
            echo errorMessage() . "Error: GetRight HTTP seeding URL must start with http:// or ftp://</p>\n";
            endOutput();
            exit;
        }
        $hash = @sha1(BEncode($array["info"]));
        fclose($fd);
        $target_path = "torrents/";
        $target_path = $target_path . basename(clean($_FILES['torrent']['name']));
        $move_torrent = move_uploaded_file($_FILES["torrent"]["tmp_name"], $target_path);
        if ($move_torrent == false) {
            echo errorMessage() . "Unable to move " . $_FILES["torrent"]["tmp_name"] . " to torrents/</p>\n";
        }
    }
    if (isset($_POST["filename"])) {
        $filename = clean($_POST["filename"]);
    } else {
        $filename = "";
    }
    if (isset($_POST["url"])) {
        $url = clean($_POST["url"]);
    } else {
        $url = "";
    }
    if (isset($_POST["autoset"])) {
        if (strcmp($_POST["autoset"], "enabled") == 0) {
            if (strlen($filename) == 0 && isset($array["info"]["name"])) {
                $filename = $array["info"]["name"];
            }
        }
    }
    //figure out total size of all files in torrent
    $info = $array["info"];
    $total_size = 0;
    if (isset($info["files"])) {
        foreach ($info["files"] as $file) {
            $total_size = $total_size + $file["length"];
        }
    } else {
        $total_size = $info["length"];
    }
    //Validate torrent file, make sure everything is correct
    $filename = mysql_escape_string($filename);
    $filename = htmlspecialchars(clean($filename));
    $url = htmlspecialchars(mysql_escape_string($url));
    if (strlen($hash) != 40 || !verifyHash($hash)) {
        echo errorMessage() . "Error: Info hash must be exactly 40 hex bytes.</p>\n";
        endOutput();
    }
    if (Substr($url, 0, 7) != "http://" && $url != "") {
        echo errorMessage() . "Error: The Torrent URL does not start with http:// Make sure you entered a correct URL.</p>\n";
        endOutput();
    }
    $query = "INSERT INTO " . $prefix . "namemap (info_hash, filename, url, size, pubDate) VALUES (\"{$hash}\", \"{$filename}\", \"{$url}\", \"{$total_size}\", \"" . date('D, j M Y h:i:s') . "\")";
    $status = makeTorrent($hash, true);
    quickQuery($query);
    if ($status) {
        echo "<p class=\"success\">Torrent was added successfully.</p>\n";
        echo "<a href=\"newtorrents.php\"><img src=\"images/add.png\" border=\"0\" class=\"icon\" alt=\"Add Torrent\" title=\"Add Torrent\" /></a><a href=\"newtorrents.php\">Add Another Torrent</a><br>\n";
        //rename torrent file to match filename
        rename("torrents/" . clean($_FILES['torrent']['name']), "torrents/" . $filename . ".torrent");
        //make torrent file readable by all
        chmod("torrents/" . $filename . ".torrent", 0644);
        //run RSS generator
        require_once "rss_generator.php";
        //Display information from DumpTorrentCGI.php
        require_once "torrent_functions.php";
    } else {
        echo errorMessage() . "There were some errors. Check if this torrent has been added previously.</p>\n";
        //delete torrent file if it doesn't exist in database
        $query = "SELECT COUNT(*) FROM " . $prefix . "summary WHERE info_hash = '{$hash}'";
        $results = mysql_query($query) or die(errorMessage() . "Can't do SQL query - " . mysql_error() . "</p>");
        $data = mysql_fetch_row($results);
        if ($data[0] == 0) {
            if (file_exists("torrents/" . $_FILES['torrent']['name'])) {
                unlink("torrents/" . $_FILES['torrent']['name']);
            }
        }
        //make torrent file readable by all
        chmod("torrents/" . $filename . ".torrent", 0644);
        endOutput();
    }
}
コード例 #10
0
ファイル: profile.php プロジェクト: mirzavu/clothfarm
 public static function selectCountrySelect($i5f59c27d67973597e0e9b68674fc5cd69ab7f2b3, $ic675072ffc96928cacbe347efbd8e16c9ed75fd4 = false)
 {
     $i77cc319b5c0bea76103c0ad59ef40f87a2cd8424 = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $i77cc319b5c0bea76103c0ad59ef40f87a2cd8424 = StrToLower(Substr(chop($i77cc319b5c0bea76103c0ad59ef40f87a2cd8424[0]), 0, 2));
     if (strlen($i5f59c27d67973597e0e9b68674fc5cd69ab7f2b3) > 0) {
         $i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078 = $i5f59c27d67973597e0e9b68674fc5cd69ab7f2b3;
     } elseif (strlen($i77cc319b5c0bea76103c0ad59ef40f87a2cd8424) > 0) {
         $i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078 = SmsVariables::$countryNames[$i77cc319b5c0bea76103c0ad59ef40f87a2cd8424];
     }
     $i253d5c16c51c17c6504dfee113bc4cb27188a3fd = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "Cote DIvoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Monte Negro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Spain - Canary Islands", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City State", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis And Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zaire", "Zambia", "Zimbabwe", "OTHER");
     if ($ic675072ffc96928cacbe347efbd8e16c9ed75fd4) {
         $i639328b20a73e24c031e47977c13c785edf8c025 = 'onchange ="isVAT(document.forms[\'editAccount\'][\'companyvat\'].value,document.forms[\'editAccount\'][\'country0\'].value);"';
     } else {
         $i639328b20a73e24c031e47977c13c785edf8c025 = "";
     }
     $i02fcabda2448d40bdb76bd10f9e95950039649ee = "<select style=\"width:180px;\" name=\"country0\" {$i639328b20a73e24c031e47977c13c785edf8c025}>";
     foreach ($i253d5c16c51c17c6504dfee113bc4cb27188a3fd as $i8fbb986cf6c5f44a93f1d73bee36e57fedc47e28) {
         if ($i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078 == $i8fbb986cf6c5f44a93f1d73bee36e57fedc47e28) {
             $i638555cbe7ed2af60dac0c7d163508bf34c13283 = " selected=\"selected\"";
         } else {
             $i638555cbe7ed2af60dac0c7d163508bf34c13283 = "";
         }
         $i02fcabda2448d40bdb76bd10f9e95950039649ee .= "<option value=\"" . htmlspecialchars($i8fbb986cf6c5f44a93f1d73bee36e57fedc47e28) . "\"" . $i638555cbe7ed2af60dac0c7d163508bf34c13283 . ">" . htmlspecialchars($i8fbb986cf6c5f44a93f1d73bee36e57fedc47e28) . "</option>";
     }
     $i02fcabda2448d40bdb76bd10f9e95950039649ee .= "</select>";
     return $i02fcabda2448d40bdb76bd10f9e95950039649ee;
 }
コード例 #11
0
 public static function select_country()
 {
     $i05355412b857f5174e9a2f71b1e936a86ad60cd208b6ab1432322a285a2017d3ca0f4ef057519922 = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $i05355412b857f5174e9a2f71b1e936a86ad60cd208b6ab1432322a285a2017d3ca0f4ef057519922 = StrToLower(Substr(chop($i05355412b857f5174e9a2f71b1e936a86ad60cd208b6ab1432322a285a2017d3ca0f4ef057519922[0]), 0, 2));
     $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = "44";
     if (strlen($i05355412b857f5174e9a2f71b1e936a86ad60cd208b6ab1432322a285a2017d3ca0f4ef057519922) > 0) {
         $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = SmsVariables::$countryPrefix[$i05355412b857f5174e9a2f71b1e936a86ad60cd208b6ab1432322a285a2017d3ca0f4ef057519922];
     }
     return $iab6a314decb74f5c532ecb082cfeb1655b9e98bb;
 }
コード例 #12
0
function RSS($rssd, $rssm, $rssy)
{
    global $rssfeeds, $rssurl, $rssview;
    if (isset($rssview)) {
        $rssindex = $rssview;
    } else {
        $rssindex = 0;
    }
    $rssdate = date("j/n/Y", mktime(0, 0, 0, $rssm, $rssd, $rssy));
    $xml_parser = xml_parser_create();
    $rss_parser = new RSS_1_0_Parser();
    //	$rss_parser->setDate($rssdate);
    xml_set_object($xml_parser, $rss_parser);
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    $file = new GetWebObject($rssfeeds[$rssindex][1], 80, $rssfeeds[$rssindex][2]);
    $datas = $file->get_header();
    //echo $datas["status"];
    //echo $datas["Content-Type"];
    if (isset($datas["path"])) {
        //echo "<h3>".$datas["path"]."</h3>";
        //if (isset($datas["host"])) echo "<h3>".$datas["host"]."</h3>";
        $fileloc = new GetWebObject($datas["host"], 80, $datas["path"]);
        $fp = $fileloc->get_content();
    } else {
        $fp = $file->get_content();
    }
    $xml_declaration = "<?xml version=\"1.0\" ?>";
    $new_contents = "";
    $xml_declaration_count = substr_count(Substr($fp, 0, 10), "<?xml");
    if ($xml_declaration_count == "0") {
        $new_contents = $xml_declaration . $fp;
    } else {
        $new_contents = $fp;
    }
    if (!xml_parse($xml_parser, $new_contents)) {
        //echo($fp);
        // ignore xml parse error to proceed calendar display
        /*
        die(sprintf("Unable to parse : XML error: %s at line %d",xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser)));
        */
    }
    xml_parser_free($xml_parser);
    return $rss_parser->GetItems();
}
コード例 #13
0
ファイル: ipaccount.php プロジェクト: robocon/shs
function baht($nArabic)
{
    $cTarget = Ltrim($nArabic);
    $cLtnum = "";
    $x = 0;
    while (substr($cTarget, $x, 1) != ".") {
        $cLtnum = $cLtnum . substr($cTarget, $x, 1);
        $x++;
    }
    $cRtnum = substr($cTarget, $x + 1, 2);
    $nUnit = $x;
    $nNum = $nUnit;
    $cRead = "**";
    include "connect.inc";
    if ($cLtnum != "0") {
        $count = 0;
        for ($i = 0; $i <= $nNum; $i++) {
            $cNo = Substr($cLtnum, $count, 1);
            $count++;
            //ÍèÒ¹ËÅÑ¡
            if ($cNo != 0 and $cNo != "-") {
                if ($nUnit != 1) {
                    $query = "SELECT * FROM thaibaht WHERE fld1 = '{$nUnit}' ";
                    $result = mysql_query($query) or die("Query 1 failed");
                    for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                        if (!mysql_data_seek($result, $i)) {
                            echo "Cannot seek to row {$i}\n";
                            continue;
                        }
                        if (!($row = mysql_fetch_object($result))) {
                            continue;
                        }
                    }
                    $cVarU = $row->fld4;
                    //ÍèÒ¹ËÅÑ¡
                } else {
                    $cVarU = "";
                }
                //ÍèÒ¹àÅ¢
                $query = "SELECT * FROM thaibaht WHERE fld1 = '{$cNo}' ";
                $result = mysql_query($query) or die("Query 2 failed");
                for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                    if (!mysql_data_seek($result, $i)) {
                        echo "Cannot seek to row {$i}\n";
                        continue;
                    }
                    if (!($row = mysql_fetch_object($result))) {
                        continue;
                    }
                }
                $cVar1 = $row->fld2;
                //ÍèÒ¹µÑÇàÅ¢
                ///
                if ($nUnit == '2' && $cNo == '2') {
                    $cVar1 = "ÂÕè";
                } elseif ($nUnit == '2' && $cNo == '1') {
                    $cVar1 = "";
                } elseif ($nUnit == '1' && $cNo == '1' && $nNum != 1) {
                    $cVar1 = "àÍç´";
                } else {
                    echo "";
                }
                $cRead = $cRead . $cVar1 . $cVarU;
            }
            $nUnit--;
        }
        $cRead = $cRead . "ºÒ·";
    }
    ////Stang////
    if ($cRtnum != "00") {
        $nUnit = 2;
        $count = 0;
        for ($i = 0; $i <= 2; $i++) {
            $cNo = Substr($cRtnum, $count, 1);
            $count++;
            if ($cNo != "0") {
                $query = "SELECT * FROM thaibaht WHERE fld1 = '{$cNo}' ";
                $result = mysql_query($query) or die("Query failed");
                for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
                    if (!mysql_data_seek($result, $i)) {
                        echo "Cannot seek to row {$i}\n";
                        continue;
                    }
                    if (!($row = mysql_fetch_object($result))) {
                        continue;
                    }
                }
                $cVar1 = $row->fld2;
                /////
                if ($nUnit == '2' && $cNo == '2') {
                    $cVar1 = "ÂÕè";
                }
                if ($nUnit == '2' && $cNo == '1') {
                    $cVar1 = "";
                }
                if ($nUnit == '1' && $cNo == '1') {
                    $cVar1 = "àÍç´";
                }
                if (Substr($cRtnum, 0, 1) == '0' && $cNo == '1') {
                    $cVar1 = "˹Öè§";
                }
                ///////
                if ($nUnit != '1') {
                    $cRead = $cRead . $cVar1 . "ÊÔº";
                } else {
                    $cRead = $cRead . $cVar1;
                }
            }
            $nUnit--;
        }
        $cRead = $cRead . "ʵҧ¤ì**";
    } else {
        $cRead = $cRead . "¶éǹ**";
    }
    include "connect.inc";
    return $cRead;
}
コード例 #14
0
ファイル: init.php プロジェクト: shesai0519/sunshineCRM
function returnsystemlang($tablename = 'department', $addtablename = '')
{
    global $systemlang, $newtablename;
    global $_SESSION, $SUNSHINE_USER_LANG_VAR;
    global $db, $SYSTEM_MODE;
    $databaseType = $db->databaseType;
    //$db_mysql = $db;
    //强制使用MYSQL数据库得到界面语言信息--结束
    //print_R($db);
    if ($newtablename != '') {
        $addtablename != "" ? $tablename = $newtablename : '';
    } else {
        $addtablename != "" ? $tablename = Substr($addtablename, 0, strlen($addtablename) - 4) : '';
    }
    $addtablename != "" ? $tablename = $addtablename : '';
    //当附加参数存在时使用附加参数
    if ($tablename == "") {
        return array();
    }
    //参数不存时返回一个数组
    //处理系统语言表没有包含的数据表,也用于不愿意初使化时所直接访问数据表-开始
    //global $MetaTables;
    //$MetaTablesArray = array();
    //for($i=0;$i<sizeof($MetaTables);$i++)			{
    //	$MetaTablesArray[] = $MetaTables[$i];
    //}
    global $SYSTEM_TABLE_VISION_MODE;
    //print $SYSTEM_TABLE_VISION_MODE;
    if ($SYSTEM_TABLE_VISION_MODE == "1" && $tablename != "common_html") {
        $MetaColumns = $db->MetaColumnNames($tablename);
        $MetaColumns = @array_values($MetaColumns);
        for ($i = 0; $i < sizeof($MetaColumns); $i++) {
            $fieldname = $MetaColumns[$i];
            $html_temp[$tablename][$fieldname] = $fieldname;
        }
        $html_temp[$tablename]["list" . $tablename] = "List " . $tablename;
        $html_temp[$tablename]["view" . $tablename] = "View " . $tablename;
        $html_temp[$tablename]["edit" . $tablename] = "Edit " . $tablename;
        $html_temp[$tablename]["add" . $tablename] = "New " . $tablename;
        $html_temp[$tablename]["search" . $tablename] = "Search " . $tablename;
        //print_R($html_temp);
        return $html_temp;
        //exit;
    } else {
        if ($SYSTEM_TABLE_VISION_MODE == "1" && $tablename == "common_html") {
            $html_temp['common_html']['choose'] = "Choose";
            $html_temp['common_html']['chooseall'] = "Choose All";
            $html_temp['common_html']['add'] = "New";
            $html_temp['common_html']['edit'] = "Edit";
            $html_temp['common_html']['view'] = "View";
            $html_temp['common_html']['delete'] = "Delete";
            $html_temp['common_html']['operation'] = "Operation";
            $html_temp['common_html']['already_exist'] = "Your input information already exists";
            $html_temp['common_html']['return'] = "Return";
            $html_temp['common_html']['submit'] = "Submit";
            $html_temp['common_html']['addsuccess'] = "Add Success";
            $html_temp['common_html']['editsuccess'] = "Edit Success";
            $html_temp['common_html']['deletesuccess'] = "Delete Success";
            $html_temp['common_html']['warning'] = "Warning";
            $html_temp['common_html']['trip'] = "Trip";
            $html_temp['common_html']['totalrecords'] = "Total Records";
            $html_temp['common_html']['indexto'] = "Jump to";
            $html_temp['common_html']['search'] = "Search";
            $html_temp['common_html']['editnull'] = "Edit information cann‘t null";
            $html_temp['common_html']['newnull'] = "New record can‘t null";
            $html_temp['common_html']['browser'] = "Browser";
            $html_temp['common_html']['import'] = "Import";
            $html_temp['common_html']['export'] = "Export";
            $html_temp['common_html']['tableexport'] = "Table Data Export";
            $html_temp['common_html']['contentexport'] = "Content Data Export";
            $html_temp['common_html']['goback'] = "Goback";
            $html_temp['common_html']['yes'] = "Yes";
            $html_temp['common_html']['no'] = "No";
            $html_temp['common_html']['clear'] = "Clear";
            $html_temp['common_html']['close'] = "Close";
            $html_temp['common_html']['shutdown'] = "Shutdown";
            $html_temp['common_html']['female'] = "Female";
            $html_temp['common_html']['male'] = "Female";
            $html_temp['common_html']['print'] = "Print";
            $html_temp['common_html']['selectall'] = "Select ALL";
            $html_temp['common_html']['totalrecords'] = "Total Records";
            $html_temp['common_html']['allrecords'] = "All Records";
            $html_temp['common_html']['cancel'] = "Cancel";
            $html_temp['common_html']['submit'] = "Submit";
            $html_temp['common_html']['save'] = "Save";
            $html_temp['common_html']['new'] = "New";
            //print_R($html_temp);
            return $html_temp;
            //exit;
        }
    }
    //处理系统语言表没有包含的数据表,也用于不愿意初使化时所直接访问数据表-结束
    $sql = "select * from systemlang where tablename='{$tablename}'";
    if ($SYSTEM_MODE == "1") {
        //等于1时,表示系统处于调试阶段,使用间断较小的缓存
        $rs = $db->Execute($sql);
    } else {
        //不等于1时,表示系统处于正常运行阶段,使用间断较大的缓存
        $rs = $db->CacheExecute(150, $sql);
    }
    $rsa = $rs->GetArray();
    //print_R($rsa);
    foreach ($rsa as $list) {
        $index = $list['tablename'];
        if ($databaseType == "oracle" && $tablename != "common_html") {
            //ORACLE时所有字段调整为大写
            $fieldname = strtoupper($list['fieldname']);
        } else {
            $fieldname = $list['fieldname'];
        }
        $chinese = $list['chinese'];
        $english = $list['english'];
        $remark = $list['remark'];
        $html_temp['zh'][$tablename][$fieldname] = $chinese;
        $html_temp['en'][$tablename][$fieldname] = $english;
        $html_temp['zh'][$tablename][$fieldname . "_remark"] = $remark;
    }
    //print_R($_SESSION);exit;
    if ($_SESSION[$SUNSHINE_USER_LANG_VAR] == '') {
        $systemlang = 'zh';
    } else {
        $systemlang = $_SESSION[$SUNSHINE_USER_LANG_VAR];
    }
    //print_R($html_temp);
    return $html_temp[$systemlang];
}
コード例 #15
0
ファイル: defalut.php プロジェクト: cin-system/vtigercrm-cin
function DataInsert($tableName, $flagNoEscape = false, $flagErrorToGo = false)
{
    $fields = array();
    //接続文読み込み
    require 'SQLConnect.php';
    $sql1 = "";
    $sql2 = "";
    $idName = "";
    $idValue = "";
    $rs = mysql_list_fields("_seotool", $tableName, $GLOBALS[dbHandle]);
    for ($i = 0; $i < mysql_num_fields($rs); $i++) {
        //print mysql_fieldname($rs, $i);
        $fldname = mysql_fieldname($rs, $i);
        if ($i == 0) {
            $idName = $fldname;
        }
        $sql1 .= "`" . $fldname . "`,";
        //予めエスケープ処理されたものを扱うか否かで処理分け(DEFAULTは"$flagNoEscape = false")
        if ($flagNoEscape) {
            $sql2 .= "'" . $_POST[$fldname] . "',";
        } else {
            $sql2 .= "'" . mysql_real_escape_string($_POST[$fldname]) . "',";
        }
        //print mysql_fieldname($rs, $i) . " ";
    }
    //切断文読み込み
    require 'SQLClose.php';
    $sql1 = Substr($sql1, 0, -1);
    $sql2 = Substr($sql2, 0, -1);
    $sql = "insert into `" . $tableName . "` (" . $sql1 . ")" . " VALUES (" . $sql2 . ")";
    //print $sql . "<BR><BR>";
    require 'SQLConnect.php';
    //sql文を実行する
    if ($flagErrorToGo) {
        $c_hit = @mysql_db_query("_seotool", $sql);
    } else {
        $c_hit = mysql_db_query("_seotool", $sql) or die('error: ' . mysql_errno() . ', ' . mysql_error());
    }
    if (!$c_hit) {
        print "DB Error, could not query the database<br />";
        print 'MySQL Error: ' . mysql_error();
    }
    //End if
    #  $sql_bk = $sql;
    #  mysql_close($GLOBALS[dbHandle]);
    #  require('SQLConnect.php');
    //データバックアップ
    #  $sql = "insert into `jas_sql_backup` (`jsb_id`,`jsb_datetime`,`jsb_name`,`jsb_kind`,`jsb_sql`)" .
    #         " VALUES ('','" . DateNow(0) . "','" . $_SESSION[jm_name] . "','Insert','".
    #         " VALUES ('','" . DateNow(0) . "','大熊','Insert','".
    #         mysql_real_escape_string($sql_bk)."')";
    //print $sql . "<BR><BR>";
    //  $c_hit = mysql_db_query("_seotool",$sql)
    //    or die('error: '.mysql_errno().', '.mysql_error());
    #  mysql_close($GLOBALS[dbHandle]);
    //idを取る
    require 'SQLConnect.php';
    $sql = "SELECT * FROM `" . $tableName . "` Order By " . $idName . " DESC Limit 0,1;";
    //print $sql . "<br><br>";
    //SQL文を実行する
    $rs = mysql_db_query($dbName, $sql);
    $rsCount = mysql_num_rows($rs);
    //レコード数
    $row = @mysql_fetch_array($rs);
    $idValue = $row[$idName];
    //まあ要らないか
    //require('SQLClose.php');
    return $idValue;
}
コード例 #16
0
 public static function selectCountrySelect($i358dc5a1e604ce179c02a507117b6f891d13fe96, $ia34435986e3261ac61175019c2e7cd9aa4aaa7c3 = false)
 {
     $i08b6ab1432322a285a2017d3ca0f4ef057519922 = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $i08b6ab1432322a285a2017d3ca0f4ef057519922 = StrToLower(Substr(chop($i08b6ab1432322a285a2017d3ca0f4ef057519922[0]), 0, 2));
     if (strlen($i358dc5a1e604ce179c02a507117b6f891d13fe96) > 0) {
         $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = $i358dc5a1e604ce179c02a507117b6f891d13fe96;
     } elseif (strlen($i08b6ab1432322a285a2017d3ca0f4ef057519922) > 0) {
         $iab6a314decb74f5c532ecb082cfeb1655b9e98bb = SmsVariables::$countryNames[$i08b6ab1432322a285a2017d3ca0f4ef057519922];
     }
     $iad164d85afb79026dea640e85e23d5a17f1227b3 = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Cook Islands", "Costa Rica", "Cote DIvoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard and Mc Donald Islands", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Monte Negro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Spain - Canary Islands", "Sri Lanka", "St. Helena", "St. Pierre and Miquelon", "Sudan", "Suriname", "Svalbard and Jan Mayen Islands", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks and Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City State", "Venezuela", "Vietnam", "Virgin Islands (British)", "Virgin Islands (U.S.)", "Wallis And Futuna Islands", "Western Sahara", "Yemen", "Yugoslavia", "Zaire", "Zambia", "Zimbabwe", "OTHER");
     if ($ia34435986e3261ac61175019c2e7cd9aa4aaa7c3) {
         $i9dbfdeff206b76f15d07ab66514ecd55f8a049fc = 'onchange ="isVAT(document.forms[\'editAccount\'][\'companyvat\'].value,document.forms[\'editAccount\'][\'country0\'].value);"';
     } else {
         $i9dbfdeff206b76f15d07ab66514ecd55f8a049fc = "";
     }
     $iae8c74e5273dec25096dbae362493a9f609ecfc8 = "<select style=\"width:180px;\" name=\"country0\" {$i9dbfdeff206b76f15d07ab66514ecd55f8a049fc}>";
     foreach ($iad164d85afb79026dea640e85e23d5a17f1227b3 as $if752f824e46416c66bba9ad132e341bac8dd3b80) {
         if ($iab6a314decb74f5c532ecb082cfeb1655b9e98bb == $if752f824e46416c66bba9ad132e341bac8dd3b80) {
             $i0b528d1be9ee802a3400dc2dc8e66f5f242b1790 = " selected=\"selected\"";
         } else {
             $i0b528d1be9ee802a3400dc2dc8e66f5f242b1790 = "";
         }
         $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= "<option value=\"" . htmlspecialchars($if752f824e46416c66bba9ad132e341bac8dd3b80) . "\"" . $i0b528d1be9ee802a3400dc2dc8e66f5f242b1790 . ">" . htmlspecialchars($if752f824e46416c66bba9ad132e341bac8dd3b80) . "</option>";
     }
     $iae8c74e5273dec25096dbae362493a9f609ecfc8 .= "</select>";
     return $iae8c74e5273dec25096dbae362493a9f609ecfc8;
 }
コード例 #17
0
ファイル: wobi.php プロジェクト: j3k0/Wobi
function _wobi_addTorrent($torrent_file_path, $torrent_file_url, $file_path, $file_url)
{
    require "config.php";
    $tracker_url = WOBI_TRACKER_URL;
    $httpseed = true;
    $tmp1 = explode("/wp-content/", $file_path);
    $relative_path = "../../" . $tmp1[1];
    $getrightseed = false;
    $httpftplocation = $file_url;
    $target_path = "torrents/";
    $autoset = true;
    $filename = "";
    // $file_path; // Extracted from torrent (if $autoset)
    $url = "{$file_url}";
    // Extracted from torrent (if $autoset)
    $hash = "";
    // Extracted from torrent (if $autoset)
    // TODO: Only if not already connected.
    // $db = mysql_connect($dbhost, $dbuser, $dbpass) or die(errorMessage() . "Couldn't connect to the database, contact the administrator.</p>");
    // mysql_select_db($database) or die(errorMessage() . "Can't open the database.</p>");
    require_once "funcsv2.php";
    require_once "BDecode.php";
    require_once "BEncode.php";
    // Check for errors, we don't care right?
    $fd = fopen($torrent_file_path, "rb") or die(_wobi_errorMessage() . "File upload error 1</p>\n");
    // is_uploaded_file($torrent_file_path) or die(_wobi_errorMessage() . "File upload error 2</p>\n");
    $alltorrent = fread($fd, filesize($torrent_file_path));
    $array = BDecode($alltorrent);
    if (!$array) {
        $wobi_error = _wobi_errorMessage() . "Error: The parser was unable to load your torrent.  Please re-create and re-upload the torrent.</p>\n";
        return false;
    }
    if (strtolower($array["announce"]) != $tracker_url) {
        $wobi_error = _wobi_errorMessage() . "Error: The tracker announce URL does not match this:<br>{$tracker_url}<br>Please re-create and re-upload the torrent.</p>\n";
        return false;
    }
    if ($httpseed && $relative_path == "") {
        $wobi_error = _wobi_errorMessage() . "Error: HTTP seeding was checked however no relative path was given.</p>\n";
        return false;
    }
    if ($httpseed && $relative_path != "") {
        if (Substr($relative_path, -1) == "/") {
            if (!is_dir($relative_path)) {
                $wobi_error = _wobi_errorMessage() . "Error: HTTP seeding relative path ends in / but is not a valid directory.</p>\n";
                return false;
            }
        } else {
            if (!is_file($relative_path)) {
                $wobi_error = _wobi_errorMessage() . "Error: HTTP seeding relative path is not a valid file.</p>\n";
                return false;
            }
        }
    }
    if ($getrightseed && $httpftplocation == "") {
        $wobi_error = _wobi_errorMessage() . "Error: GetRight HTTP seeding was checked however no URL was given.</p>\n";
        return false;
    }
    if ($getrightseed && (Substr($httpftplocation, 0, 7) != "http://" && Substr($httpftplocation, 0, 6) != "ftp://")) {
        $wobi_error = _wobi_errorMessage() . "Error: GetRight HTTP seeding URL must start with http:// or ftp://</p>\n";
        return false;
    }
    $hash = @sha1(BEncode($array["info"]));
    fclose($fd);
    $target_path = $target_path . basename($torrent_file_path);
    $move_torrent = rename($torrent_file_path, $target_path);
    if ($move_torrent == false) {
        $wobi_error = errorMessage() . "Unable to move {$torrent_file_path} to torrents/</p>\n";
    }
    if (!empty($filename)) {
        // XXX can probably remove this...
        $filename = clean($filename);
    }
    if (!empty($url)) {
        // XXX and this
        $url = clean($url);
    }
    if ($autoset) {
        if (strlen($filename) == 0 && isset($array["info"]["name"])) {
            $filename = $array["info"]["name"];
        }
    }
    //figure out total size of all files in torrent
    $info = $array["info"];
    $total_size = 0;
    if (isset($info["files"])) {
        foreach ($info["files"] as $file) {
            $total_size = $total_size + $file["length"];
        }
    } else {
        $total_size = $info["length"];
    }
    //Validate torrent file, make sure everything is correct
    $filename = mysql_escape_string($filename);
    $filename = htmlspecialchars(clean($filename));
    $url = htmlspecialchars(mysql_escape_string($url));
    if (strlen($hash) != 40 || !verifyHash($hash)) {
        $wobi_error = _wobi_errorMessage() . "Error: Info hash must be exactly 40 hex bytes.</p>\n";
        return false;
    }
    if (Substr($url, 0, 7) != "http://" && $url != "") {
        $wobi_error = _wobi_errorMessage() . "Error: The Torrent URL does not start with http:// Make sure you entered a correct URL.</p>\n";
        return false;
    }
    $query = "INSERT INTO " . $prefix . "namemap (info_hash, filename, url, size, pubDate) VALUES (\"{$hash}\", \"{$filename}\", \"{$url}\", \"{$total_size}\", \"" . date('D, j M Y h:i:s') . "\")";
    $status = makeTorrent($hash, true);
    quickQuery($query);
    chmod($target_path, 0644);
    if ($status) {
        $wobi_error = "<p class=\"success\">Torrent was added successfully.</p>\n";
        require_once "wobi_functions.php";
        _wobi_addWebseedfiles($target_path, $relative_path, $httpftplocation, $hash);
        return true;
    } else {
        $wobi_error = _wobi_errorMessage() . "There were some errors. Check if this torrent has been added previously.</p>\n";
        return false;
    }
}
コード例 #18
0
ファイル: ipbill_part.php プロジェクト: robocon/shs
function baht($nArabic){
    $cTarget = Ltrim($nArabic);
    $cLtnum="";
    $x=0;
    while (substr($cTarget,$x,1) <> "."){
            $cLtnum=$cLtnum.substr($cTarget,$x,1);
            $x++;
	}
   $cRtnum=substr($cTarget,$x+1,2);
   $nUnit=$x;
   $nNum=$nUnit;
   $cRead  = "**";

include("connect.inc");
 
 IF ($cLtnum <> "0"){
  $count=0;
  For ($i = 0;$i<=$nNum;$i++){
    $cNo   = Substr($cLtnum,$count,1);
     $count++;
//��ҹ��ѡ
    IF ($cNo <>0 and $cNo != "-"){
      If ($nUnit <> 1){  

          $query = "SELECT * FROM thaibaht WHERE fld1 = '$nUnit' ";
          $result = mysql_query($query) or die("Query 1 failed");

          for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
          if (!mysql_data_seek($result, $i)) {
              echo "Cannot seek to row $i\n";
              continue;
          }

           if(!($row = mysql_fetch_object($result)))
               continue;
         }

        $cVarU = $row->fld4;  //��ҹ��ѡ
                }
      Else {
        $cVarU = "";
              }

//��ҹ�Ţ
          $query = "SELECT * FROM thaibaht WHERE fld1 = '$cNo' ";
          $result = mysql_query($query) or die("Query 2 failed");

          for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
          if (!mysql_data_seek($result, $i)) {
              echo "Cannot seek to row $i\n";
              continue;
          }

           if(!($row = mysql_fetch_object($result)))
               continue;
         }

      $cVar1 = $row->fld2; //��ҹ����Ţ
///           
if ($nUnit =='2' && $cNo =='2'):
   $cVar1 = "���";
elseif ($nUnit == '2' && $cNo=='1'):
         $cVar1 =  "";
elseif ($nUnit =='1' && $cNo =='1' && $nNum <> 1 ):
          $cVar1 = "���";
else:
   echo "";
endif; 

      $cRead  = $cRead.$cVar1.$cVarU;
        }
      $nUnit--;
            }
$cRead = $cRead."�ҷ";
	}
////Stang////  
  IF ($cRtnum <> "00"){
    $nUnit = 2;
    $count=0;
    For ($i = 0;$i<=2;$i++){  
      $cNo = Substr($cRtnum,$count,1);
      $count++;
      If ($cNo != "0"){

          $query = "SELECT * FROM thaibaht WHERE fld1 = '$cNo' ";
          $result = mysql_query($query) or die("Query failed");

          for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
          if (!mysql_data_seek($result, $i)) {
              echo "Cannot seek to row $i\n";
              continue;
          }

           if(!($row = mysql_fetch_object($result)))
               continue;
         }

         $cVar1 = $row->fld2 ;
         /////
         If ($nUnit == '2' && $cNo == '2'){
            $cVar1 = "���";
            }
         if ($nUnit == '2' && $cNo == '1'){
            $cVar1 = "" ;
             }   
         if ($nUnit == '1' && $cNo =='1'){
              $cVar1 = "���";
            }            
         If (Substr($cRtnum,0,1) == '0' && $cNo == '1'){
            $cVar1 = "˹��";
            }
         ///////
         If ($nUnit != '1'){ 
           $cRead = $cRead.$cVar1."�Ժ";
                 }
         Else{
           $cRead = $cRead.$cVar1;
                }
      }   
         $nUnit--;
             }
    $cRead = $cRead."ʵҧ��**"  ;
	}    
    else{
           $cRead = $cRead."��ǹ**" ;
           }  
    include("connect.inc");

   return $cRead;
}
コード例 #19
0
ファイル: mtbqqq.php プロジェクト: BirenRathod/indicia-code
 /**
  * Converts a WKT polygon for a grid square (easting northing OSGB) into the
  * spatial reference notation. Only accepts POINT & POLYGON WKT at the moment.
  */
 public static function wkt_to_sref($wkt, $precision = null, $output = null, $metresAccuracy = null)
 {
     if (substr($wkt, 0, 7) == 'POLYGON') {
         $points = substr($wkt, 9, -2);
     } elseif (substr($wkt, 0, 5) == 'POINT') {
         $points = substr($wkt, 6, -1);
         if ($metresAccuracy === null) {
             throw new Exception('wkt_to_sref translation for POINTs requires a metres accuracy.');
         }
     } else {
         throw new Exception('wkt_to_sref translation only works for POINT or POLYGON wkt.');
     }
     $points = explode(',', $points);
     $point = explode(' ', $points[0]);
     $easting = $point[0];
     $northing = $point[1];
     /*if ($easting < 0 || $easting > 700000 || $northing < 0 || $northing > 1300000)
       throw new Exception('wkt_to_sref translation is outside range of grid.');*/
     $y = (ORIGIN_Y - $northing) / SIXMINUTES + GRIDORIGIN_Y;
     $yy = Floor($y);
     $x = ($easting - ORIGIN_X) * 6 + GRIDORIGIN_X;
     $xx = Floor($x);
     $y8th = Floor(($y - $yy) * 8) + 1;
     $x8th = Floor(($x - $xx) * 8) + 1;
     // Start on 111
     $q1 = 1;
     $q2 = 1;
     $q3 = 1;
     // Work out each shift according to y8th
     if (in_array($y8th, array(5, 6, 7, 8))) {
         $q1 = 3;
     }
     if (in_array($y8th, array(3, 4, 7, 8))) {
         $q2 = 3;
     }
     if (in_array($y8th, array(2, 4, 6, 8))) {
         $q3 = 3;
     }
     // Work out each additional shift according to x8th
     if (in_array($x8th, array(5, 6, 7, 8))) {
         $q1++;
     }
     if (in_array($x8th, array(3, 4, 7, 8))) {
         $q2++;
     }
     if (in_array($x8th, array(2, 4, 6, 8))) {
         $q3++;
     }
     if ($yy < 1 || $xx < 1 || $yy > 99 || $xx > 99) {
         throw new Exception('Outside bounds for MTB squares.');
     } else {
         $StrY = Substr('00' . $yy, -2);
         $StrX = Substr('00' . $xx, -2);
         $ref = sprintf('%s%s/%d%d%d', $StrY, $StrX, $q1, $q2, $q3);
         // assume full accuracy
         $len = 8;
         if ($metresAccuracy) {
             if ($metresAccuracy > 16000) {
                 $len = 4;
                 // e.g. 6402
             } elseif ($metresAccuracy > 8000) {
                 $len = 6;
                 // e.g. 6402/1
             } elseif ($metresAccuracy > 4000) {
                 $len = 7;
                 // e.g. 6402/11
             }
         }
         return substr($ref, 0, $len);
     }
 }
コード例 #20
0
ファイル: Suppliers.php プロジェクト: patmark/weberp-elct
function Is_ValidAccount($ActNo)
{
    if (StrLen($ActNo) < 16) {
        echo _('NZ account numbers must have 16 numeric characters in it');
        return False;
    }
    if (!Is_double((double) $ActNo)) {
        echo _('NZ account numbers entered must use all numeric characters in it');
        return False;
    }
    $BankPrefix = mb_substr($ActNo, 0, 2);
    $BranchNumber = (int) mb_substr($ActNo, 3, 4);
    if ($BankPrefix == '29') {
        echo _('NZ Accounts codes with the United Bank are not verified') . ', ' . _('be careful to enter the correct account number');
        exit;
    }
    //Verify correct branch details
    switch ($BankPrefix) {
        case '01':
            if (!($BranchNumber >= 1 and $BranchNumber <= 999 or $BranchNumber >= 1100 and $BranchNumber <= 1199)) {
                echo _('ANZ branches must be between 0001 and 0999 or between 1100 and 1199') . '. ' . _('The branch number used is invalid');
                return False;
            }
            break;
        case '02':
            if (!($BranchNumber >= 1 and $BranchNumber <= 999 or $BranchNumber >= 1200 and $BranchNumber <= 1299)) {
                echo _('Bank Of New Zealand branches must be between 0001 and 0999 or between 1200 and 1299') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '03':
            if (!($BranchNumber >= 1 and $BranchNumber <= 999 or $BranchNumber >= 1300 and $BranchNumber <= 1399)) {
                echo _('Westpac Trust branches must be between 0001 and 0999 or between 1300 and 1399') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '06':
            if (!($BranchNumber >= 1 and $BranchNumber <= 999 or $BranchNumber >= 1400 and $BranchNumber <= 1499)) {
                echo _('National Bank branches must be between 0001 and 0999 or between 1400 and 1499') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '08':
            if (!($BranchNumber >= 6500 and $BranchNumber <= 6599)) {
                echo _('National Australia branches must be between 6500 and 6599') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '09':
            if ($BranchNumber != 0) {
                echo _('The Reserve Bank branch should be 0000') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '12':
            //"13" "14" "15", "16", "17", "18", "19", "20", "21", "22", "23", "24":
            if (!($BranchNumber >= 3000 and $BranchNumber <= 4999)) {
                echo _('Trust Bank and Regional Bank branches must be between 3000 and 4999') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '11':
            if (!($BranchNumber >= 5000 and $BranchNumber <= 6499)) {
                echo _('Post Office Bank branches must be between 5000 and 6499') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '25':
            if (!($BranchNumber >= 2500 and $BranchNumber <= 2599)) {
                echo _('Countrywide Bank branches must be between 2500 and 2599') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '29':
            if (!($BranchNumber >= 2150 and $BranchNumber <= 2299)) {
                echo _('United Bank branches must be between 2150 and 2299') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '30':
            if (!($BranchNumber >= 2900 and $BranchNumber <= 2949)) {
                echo _('Hong Kong and Shanghai branches must be between 2900 and 2949') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '31':
            if (!($BranchNumber >= 2800 and $BranchNumber <= 2849)) {
                echo _('Citibank NA branches must be between 2800 and 2849') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        case '33':
            if (!($BranchNumber >= 6700 and $BranchNumber <= 6799)) {
                echo _('Rural Bank branches must be between 6700 and 6799') . '. ' . _('The branch number used is invalid');
                return False;
                exit;
            }
            break;
        default:
            echo _('The prefix') . ' - ' . $BankPrefix . ' ' . _('is not a valid New Zealand Bank') . '.<br />' . _('If you are using webERP outside New Zealand error trapping relevant to your country should be used');
            return False;
            exit;
    }
    // end of first Bank prefix switch
    for ($i = 3; $i <= 14; $i++) {
        $DigitVal = (double) mb_substr($ActNo, $i, 1);
        switch ($i) {
            case 3:
                if ($BankPrefix == '08' or $BankPrefix == '09' or $BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = 0;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 6;
                }
                break;
            case 4:
                if ($BankPrefix == '08' or $BankPrefix == '09' or $BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = 0;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 3;
                }
                break;
            case 5:
                if ($BankPrefix == '08' or $BankPrefix == '09' or $BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = 0;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 7;
                }
                break;
            case 6:
                if ($BankPrefix == '08' or $BankPrefix == '09' or $BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = 0;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 9;
                }
                break;
            case 7:
                if ($BankPrefix == '08') {
                    $CheckSum = $CheckSum + $DigitVal * 7;
                } elseif ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal * 1;
                }
                break;
            case 8:
                if ($BankPrefix == '08') {
                    $CheckSum = $CheckSum + $DigitVal * 6;
                } elseif ($BankPrefix == '09') {
                    $CheckSum = 0;
                } elseif ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal * 7;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 10;
                }
                break;
            case 9:
                if ($BankPrefix == '09') {
                    $CheckSum = 0;
                } elseif ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal * 3;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 5;
                }
                break;
            case 10:
                if ($BankPrefix == '08') {
                    $CheckSum = $CheckSum + $DigitVal * 4;
                } elseif ($BankPrefix == '09') {
                    if ($DigitVal * 5 > 9) {
                        $CheckSum = $CheckSum + (int) Substr((string) ($DigitVal * 5), 0, 1) + (int) Substr((string) ($DigitVal * 5), mb_strlen((string) ($DigitVal * 5)) - 1, 1);
                    } else {
                        $CheckSum = $CheckSum + $DigitVal * 5;
                    }
                } elseif ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 8;
                }
                break;
            case 11:
                if ($BankPrefix == '08') {
                    $CheckSum = $CheckSum + $DigitVal * 3;
                } elseif ($BankPrefix == '09') {
                    if ($DigitVal * 4 > 9) {
                        $CheckSum = $CheckSum + (int) mb_substr($DigitVal * 4, 0, 1) + (int) Substr($DigitVal * 4, mb_strlen($DigitVal * 4) - 1, 1);
                    } else {
                        $CheckSum = $CheckSum + $DigitVal * 4;
                    }
                } elseif ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal * 7;
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 4;
                }
                break;
            case 12:
                if ($BankPrefix == '25' or $BankPrefix == '33') {
                    $CheckSum = $CheckSum + $DigitVal * 3;
                } elseif ($BankPrefix == '09') {
                    if ($DigitVal * 3 > 9) {
                        $CheckSum = $CheckSum + (int) Substr($DigitVal * 3, 0, 1) + (int) Substr($DigitVal * 3, mb_strlen($DigitVal * 3) - 1, 1);
                    } else {
                        $CheckSum = $CheckSum + $DigitVal * 3;
                    }
                } else {
                    $CheckSum = $CheckSum + $DigitVal * 2;
                }
                break;
            case 13:
                if ($BankPrefix == '09') {
                    if ($DigitVal * 2 > 9) {
                        $CheckSum = $CheckSum + (int) Substr($DigitVal * 2, 0, 1) + (int) Substr($DigitVal * 2, mb_strlen($DigitVal * 2) - 1, 1);
                    } else {
                        $CheckSum = $CheckSum + $DigitVal * 2;
                    }
                } else {
                    $CheckSum = $CheckSum + $DigitVal;
                }
                break;
            case 14:
                if ($BankPrefix == '09') {
                    $CheckSum = $CheckSum + $DigitVal;
                }
                break;
        }
        //end switch
    }
    //end for loop
    if ($BankPrefix == '25' or $BankPrefix == '33') {
        if ($CheckSum / 10 - (int) ($CheckSum / 10) != 0) {
            echo '<p>' . _('The account number entered does not meet the banking check sum requirement and cannot be a valid account number') . '</p>';
            return False;
        }
    } else {
        if ($CheckSum / 11 - (int) ($CheckSum / 11) != 0) {
            echo '<p>' . _('The account number entered does not meet the banking check sum requirement and cannot be a valid account number') . '</p>';
            return False;
        }
    }
}
コード例 #21
0
ファイル: statistics.php プロジェクト: j3k0/Wobi
        $page_limit = ($_GET["page_number"] - 1) * 5;
        $query = "SELECT * FROM " . $prefix . "summary LEFT JOIN " . $prefix . "namemap ON " . $prefix . "summary.info_hash = " . $prefix . "namemap.info_hash {$where} ORDER BY " . $prefix . "namemap.filename LIMIT {$page_limit},5";
    }
}
$results = mysql_query($query) or die(errorMessage() . "Can't do SQL query - " . mysql_error() . "</p>");
while ($data = mysql_fetch_row($results)) {
    $xhash = "x" . $data[0];
    $query2 = "SELECT * FROM " . $prefix . "{$xhash}";
    $results2 = mysql_query($query2) or die(errorMessage() . "Can't do SQL query - " . mysql_error() . "</p>");
    if (mysql_num_rows($results2) == 0 && isset($_GET["activeonly"])) {
        break;
    } else {
        echo "<hr><table>\n";
        echo "<tr><th>Info Hash</th><th>Filename</th><th>URL</th><th>File Size</th><th>Publication Date</th></tr>\n";
        echo "<tr><td>" . $data[0] . "</td><td>" . $data[11] . "</td><td>\n";
        if (Substr($data[12], 0, 7) == "http://") {
            echo "<a href=\"" . $data[12] . "\">" . $data[12] . "</a>\n";
        } else {
            echo $data[12];
        }
        echo "</td><td>" . bytesToString($data[13]) . "</td>\n";
        echo "<td>" . $data[14] . "</td></tr>\n";
        echo "</table>\n";
    }
    echo "<table>\n";
    echo "<tr><th class=\"subheader\">IP Address</th><th class=\"subheader\">Data Left to Download</th><th class=\"subheader\" width=200>Percent Finished</th><th class=\"subheader\">Port</th><th class=\"subheader\">Last Update</th><th class=\"subheader\">NAT User</th></tr>\n";
    while ($data2 = mysql_fetch_row($results2)) {
        //grab information on each user
        echo "<tr><td>" . $data2[2] . "</td>\n";
        echo "<td>" . bytesToString($data2[1]) . "</td>\n";
        //calculate percent done for user
コード例 #22
0
ファイル: smsController.php プロジェクト: mirzavu/clothfarm
 public static function select_country()
 {
     $id960ddd9e843150fe4875c48e896395edac7ca1d77cc319b5c0bea76103c0ad59ef40f87a2cd8424 = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
     $id960ddd9e843150fe4875c48e896395edac7ca1d77cc319b5c0bea76103c0ad59ef40f87a2cd8424 = StrToLower(Substr(chop($id960ddd9e843150fe4875c48e896395edac7ca1d77cc319b5c0bea76103c0ad59ef40f87a2cd8424[0]), 0, 2));
     $i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078 = "44";
     if (strlen($id960ddd9e843150fe4875c48e896395edac7ca1d77cc319b5c0bea76103c0ad59ef40f87a2cd8424) > 0) {
         $i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078 = SmsVariables::$countryPrefix[$id960ddd9e843150fe4875c48e896395edac7ca1d77cc319b5c0bea76103c0ad59ef40f87a2cd8424];
     }
     return $i5a4616ba4ac4a7f21e69ba2afe5e994ae9927078;
 }
コード例 #23
0
 public function findofnotemapdataAction()
 {
     $params = $this->_getAllParams();
     $this->_helper->layout->disableLayout();
     $mapdata = new Findspots();
     $mapdatas = $mapdata->getFindsofNoteMap();
     $dom = new DOMDocument("1.0");
     $node = $dom->createElement("markers");
     $parnode = $dom->appendChild($node);
     foreach ($mapdatas as $mapdata) {
         $allowed = array('fa', 'admin', 'hero', 'research', 'flos', 'treasure');
         if ($this->_auth->hasIdentity()) {
             $user = $this->_auth->getIdentity();
             if (in_array($user->role, $allowed)) {
                 $lat = $mapdata['declat'];
                 $long = $mapdata['declong'];
             }
         } else {
             $lat = Substr($mapdata['declat'], 0, 4);
             $long = SUBSTR($mapdata['declong'], 0, 4);
         }
         $html = '';
         if (isset($mapdata['i'])) {
             $html .= '<div id="tmb">' . '<img src="http://' . $_SERVER['SERVER_NAME'] . '/images/' . 'thumbnails/' . $mapdata['i'] . '.jpg"/></div>';
         }
         $html .= '<div id="detailsmap"><p>' . ucwords(strtolower($mapdata['county'])) . ' <br /> <a href="http://' . $_SERVER['SERVER_NAME'] . $this->view->url(array('module' => 'database', 'controller' => 'artefacts', 'action' => 'record', 'id' => $mapdata['id']), null, true) . '" title="View record\'s details">' . $mapdata['old_findID'] . '</a><br />' . $mapdata['objecttype'] . '<br />' . $mapdata['broadperiod'] . '</p></div>';
         $node = $dom->createElement("marker");
         $newnode = $parnode->appendChild($node);
         $newnode->setAttribute("name", $html);
         $newnode->setAttribute("broadperiod", $mapdata['broadperiod']);
         $newnode->setAttribute("lat", $lat);
         $newnode->setAttribute("lng", $long);
         $newnode->setAttribute("type", $mapdata['objecttype']);
         $newnode->setAttribute("workflow", str_replace(array('1', '2', '3', '4'), array('quarantine', 'review', 'published', 'validation'), $mapdata['secwfstage']));
     }
     header('Content-Type: text/xml');
     echo $dom->saveXML();
 }
コード例 #24
0
 function Mark70($AccountNo)
 {
     $AccountNo = $this->ExpandAccount($AccountNo);
     if (substr($AccountNo, 3, 1) == '5') {
         $Mark70 = $this->Method06($AccountNo, '000765432', FALSE, 10, 11);
     } elseif (Substr($AccountNo, 3, 2) == '69') {
         $Mark70 = $this->Method06($AccountNo, '000765432', FALSE, 10, 11);
     } else {
         $Mark70 = $this->Method06($AccountNo, '432765432', FALSE, 10, 11);
     }
     return $Mark70;
 }
コード例 #25
0
ファイル: init2.php プロジェクト: shesai0519/sunshineCRM
function returnsystemlang($tablename = 'department', $addtablename = '')
{
    global $systemlang, $newtablename;
    global $db, $_SESSION, $SUNSHINE_USER_LANG_VAR;
    if ($newtablename != '') {
        $addtablename != "" ? $tablename = $newtablename : '';
    } else {
        $addtablename != "" ? $tablename = Substr($addtablename, 0, strlen($addtablename) - 4) : '';
    }
    $sql = "select * from systemlang where tablename='{$tablename}'";
    $rs = $db->Execute($sql);
    $rsa = $rs->GetArray();
    $addtablename != "" ? $tablename = $addtablename : '';
    foreach ($rsa as $list) {
        $index = $list[tablename];
        $fieldname = $list[fieldname];
        $chinese = $list[chinese];
        $english = $list[english];
        $html_temp['zh'][$tablename][$fieldname] = $chinese;
        $html_temp['en'][$tablename][$fieldname] = $english;
    }
    //print_R($_SESSION);exit;
    if ($_SESSION[$SUNSHINE_USER_LANG_VAR] == '') {
        $systemlang = 'zh';
    } else {
        $systemlang = $_SESSION[$SUNSHINE_USER_LANG_VAR];
    }
    return $html_temp[$systemlang];
}