画像を見せるとき n = 0 --> サムネイルを見せるとき num --> データベース登録NO ------------------------------------------------------------------------- */ /* define( 'DB_USER' , 'gmcorp' ); // DBユーザー define( 'DB_PASS' , 'x9Kn4skn' ); // DBパスワード define( 'DB_NAME' , 'PARTS' ); // DB名 define( 'CHRCODE' , 'EUC-JP' ); // 文字コード */ define( 'DB_USER' , 'gmparts' ); define( 'DB_PASS' , 'Adbzr343z' ); // DBパスワード define( 'DB_NAME' , 'gmparts' ); // DB名 define( 'CHRCODE' , 'UTF8' ); // 文字コード /* データベース接続 */ function AccessDB() { $link_ok = mysql_connect( 'localhost', DB_USER, DB_PASS ); if( !$link_ok ) err_msg( 'データベース接続失敗', 1 ); mysql_select_db( DB_NAME ); mysql_query( 'set names BINARY' ); // mysql_query( "set session sql_mode='MYSQL40'" ); return $link_ok; } /* end sub */ /* 画像なし */ function NoImage( $str ) { $info = preg_split( "/ /", $str ); $image = ImageCreate( 100, 100 ); $white = ImageColorAllocate( $image, 255, 255, 255 ); $blue = ImageColorAllocate( $image, 128, 255, 255 ); $yellow= ImageColorAllocate( $image, 255, 255, 0 ); $red = ImageColorAllocate( $image, 255, 0, 0 ); $black = ImageColorAllocate( $image, 0, 0, 0 ); ImageFilledRectangle( $image, 0, 0, 100, 100, $yellow ); ImageString( $image, 5, 20, 10, $info[0] , $red ); ImageString( $image, 5, 20, 30, $info[1] , $red ); ImageString( $image, 5, 20, 50, $info[2] , $red ); ImageString( $image, 5, 20, 70, $info[3] , $red ); ImageJPEG( $image ); } // NoImage( "Image is Not Registed" ); exit; // include( '../include.php' ); if( $_POST ) $buffer = $_POST; else if( $_GET ) $buffer = $_GET; if( $buffer ) { foreach( $buffer as $key => $val ) $$key = $val; } if( !$no ) exit; if( $base ) $column = 'partsbinaries'; else $column = 'partsbin_thumbnail'; // if( $base ) $column = 'BINARIES'; else $column = 'THUMBNAIL'; // $con = $db_class->access_db(); $con = AccessDB(); $command = "select * from partsbinaries where partsbin_id='$no'"; // print $command; exit; // $command = "select * from BINARIES where NUMBER='$no'"; $result = mysql_query( $command ); if( $result ) $rows = mysql_num_rows( $result ); if( $rows ) { $row = mysql_fetch_array( $result, MYSQLI_ASSOC ); if( $row[ $column ] ) { $type = $row['attribute']; // $type = $row['ATTRIBUTE']; $bin = $row[ $column ]; $fname = $row['filename']; // $fname = $row['FILENAME']; $fname = ( $base ) ? $fname : $ThumbHead . $fname; header( "Content-type: $type; filename=\"$fname\"" ); // header( "Content-type: $type" ); // header( "Content-Disposition: attachment; filename=\"$fname\"" ); print $bin; } else NoImage( "Image is Not Registed" ); } else NoImage( "Image Load Error!" ); exit; ?>