?
Path : /home/admin/domains/happytokorea.com/public_html_bk/promice/Admin/examples/ |
Current File : /home/admin/domains/happytokorea.com/public_html_bk/promice/Admin/examples/article.php |
<? @session_start(); ob_start(); require_once "../include/tdate.php"; require_once "../include/connect.php"; require_once "../include/connectdb.php"; $sql="select * from useradmin where useradmin='$useradmin'"; $db_query=mysql_db_query($db,$sql); $result=mysql_fetch_array($db_query); $id=$result[id]; $adminname=$result[name]; $user_admin=$result[useradmin]; $pass_admin=$result[passadmin]; ?> <html> <head> <title><? echo "$headtxt"; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- Fireworks MX Dreamweaver MX target. Created Sat Apr 02 10:29:23 GMT+0700 (SE Asia Standard Time) 2011--> <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js", // Style formats style_formats : [ {title : 'Bold text', inline : 'b'}, {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}}, {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}}, {title : 'Example 1', inline : 'span', classes : 'example1'}, {title : 'Example 2', inline : 'span', classes : 'example2'}, {title : 'Table styles'}, {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'} ], // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript" src="/js/tiny_mce/jquery.tinymce.js"></script> <script type="text/javascript" src="/js/plupload/source/plupload.js"></script> <script type="text/javascript" src="/js/plupload/source/plupload.silverlight.js"></script> <script type="text/javascript" src="/js/plupload/source/plupload.flash.js"></script> <script type="text/javascript" src="/js/plupload/source/plupload.html5.js"></script> </head> <body bgcolor="#ffffff"> <div align="center"><strong> </strong> <table width="89%" border="0" align="center" cellpadding="1" cellspacing="1"> <tr valign="top"> <td width="57%"><? echo "$headtxt | $e_date $etime"; ?><br> <div align="left">Now page : <a href="Main.php">mainpage</a> --> <strong>article</strong></div></td> <td width="43%"> <div align="right">Hello <? echo "<u>$adminname</u>"; ?><br> [ <a href="ChangePass.php">change pass</a> ] <a href="logout.php">sign out</a> </div></td> </tr> <tr> <td colspan="2"><table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E9E9E6"> <tr> <td><div align="center"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div align="center"><br> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div align="center"> <table width="82%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><div align="center"> <script language="JavaScript"> function checkprd() { var prd1 = document.webFormprd.productstypecode.value; var prd2 = document.webFormprd.productsname.value; var prd3 = document.webFormprd.productsdetail.value; var prd4 = document.webFormprd.productsprice.value; var prd5 = document.webFormprd.productsphoto.value; var prd6 = document.webFormprd.amount.value; var prd7 = document.webFormprd.productskeyword.value; var prd8 = document.webFormprd.productstitle.value; var prd9 = document.webFormprd.productsdesc.value; if( prd1.length ==0) { alert("กรุณาใส่ประเภทสินค้าด้วยค่ะ"); document.webFormprd.productstypecode.focus(); return false; }else if( prd2.length ==0) { alert("กรุณาใส่ชื่อสินค้าด้วยค่ะ"); document.webFormprd.productsname.focus(); return false; }else if( prd3.length ==0) { alert("กรุณาใส่ราคาิสินค้าด้วยค่ะ"); document.webFormprd.productsprice.focus(); return false; }else if( prd4.length ==0) { alert("กรุณาใส่รายละเอียดสินค้าด้วยค่ะ"); document.webFormprd.productsdetail.focus(); return false; }else if( prd5.length ==0) { alert("กรุณาใส่รูปสินค้าด้วยค่ะ"); document.webFormprd.productsphoto.focus(); return false; }else if( prd6.length ==0) { alert("กรุณาใส่จำนวนสินค้าด้วยค่ะ"); document.webFormprd.amount.focus(); return false; } else return true; } function chkForm(){ if(document.webFormprd.productstypecode.value==0){ alert("กรุณาเลือกประเภทสินค้าด้วยค่ะ"); document.form.productstypecode.focus(); return false; } return true; } </script> <table width="716" border="0" align="center" cellpadding="1" cellspacing="1"> <form method="post" action="articleSave.php" enctype="multipart/form-data" name="webFormprd" onSubmit="return checkprd()"> <tr bgcolor="#FFFFFF"> <td width="151"> <div align="right">Type</div></td> <td width="558"> <?php $sql2 = "select * From article_category"; $result2 = mysql_query($sql2); $Num_Rows2 = mysql_num_rows($result2); $result2 = mysql_query($sql2); echo "<select name=article_category_id id=article_category_id class=input>"; echo "<option value=0>Choose type article"; While($row2= mysql_fetch_array($result2)){ $typecode = $row2["id"]; $typename = $row2["category_name"]; ?> <option value=<? echo "$typecode"; ?> onBlur="return chkForm();"><? echo "$typecode"; ?>-<? echo "$typename "; ?> <? } echo "</option></select>"; ?> </td> </tr> <tr bgcolor="#FFFFFF"> <td> <div align="right">Subject :</div></td> <td> <input name="subject" type="text" class="input" id="subject" size="40"> </td> </tr> <tr bgcolor="#FFFFFF"> <td valign="top"> <div align="right">Detail :</div></td> <td> <textarea name="detail" id="detail"></textarea></td> </tr> <tr bgcolor="#FFFFFF"> <td> <div align="right">image :</div></td> <td> <div id="container"> <a id="pickfiles" href="javascript:;">[Select files]</a> <a id="uploadfiles" href="javascript:;">[Upload files]</a> </div> <br /> <pre id="console"></pre> <script type="text/javascript"> // Custom example logic var uploader = new plupload.Uploader({ runtimes : 'html5,flash,silverlight,html4', browse_button : 'pickfiles', // you can pass in id... container: document.getElementById('container'), // ... or DOM Element itself url : "examples/upload", filters : { max_file_size : '10mb', mime_types: [ {title : "Image files", extensions : "jpg,gif,png"}, {title : "Zip files", extensions : "zip"} ] }, // Flash settings flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf', // Silverlight settings silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap', init: { PostInit: function() { document.getElementById('filelist').innerHTML = ''; document.getElementById('uploadfiles').onclick = function() { uploader.start(); return false; }; }, FilesAdded: function(up, files) { plupload.each(files, function(file) { document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>'; }); }, UploadProgress: function(up, file) { document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>"; }, Error: function(up, err) { document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message; } } }); uploader.init(); </script></td> </tr> <tr bgcolor="#FFFFFF"></tr> <tr bgcolor="#FFFFFF"> <td><div align="right"></div></td> <td> <input name="submit" type="submit" class="submit" value="Add"> </td> </tr> </form> </table> </div></td> </tr> <tr> <? $numproducts ="select * from article"; $query_select=mysql_query($numproducts); $numall=mysql_num_rows($query_select); ?> <td><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td><strong>:: amount <? echo "$numall"; ?> Query::</strong></td> </tr> <tr> <td><div align="center"> <table width="85%" border="0" cellspacing="0" cellpadding="0"> <tr class="jobscss"> <td bgcolor="#FFFFFF"> <? $page = $_GET['page']; $select_type="select * from article order by id desc"; $query_select=mysql_query($select_type); $num_rows=mysql_num_rows($query_select); if($num_rows<1){ echo "<br><br><center><b>ยังไม่มีการเพิ่มข้อมูลค่ะ</b></center>"; }else{ $select="select * from article order by id desc"; $q_ry = mysql_query($select); $num_rows=mysql_num_rows($q_ry); $pagesize=8; $rt=$num_rows%$pagesize; if($rt!=0) { $totalpage=floor($num_rows/$pagesize)+1; } else { $totalpage=floor($num_rows/$pagesize); $toppic_id=1; } if(empty($page)) { $page=1; } mysql_free_result($q_ry); $goto=($page-1)*$pagesize; $sql_select_mem="Select * From article order by id desc limit $goto,$pagesize"; $fect=mysql_query($sql_select_mem); if(!$fect) { ("ติดต่อฐานข้อมูลไม่ได้".mysql_error()); exit; } $bgcount=0; while($rows=mysql_fetch_array($fect)) { $idx =$rows['id']; $article_category_id =$rows['article_category_id']; $subject = $rows['subject']; $dates = $rows['date']; $detail = mb_substr($rows[detail],0,250,'UTF-8'); $images = $rows['images']; $amount = $rows['count']; $bgcount=$bgcount+1; $bgmod=$bgcount%2; if($bgmod==0){ $bgcolor="#E9E9E8"; }else{ $bgcolor="#FFFFFF"; } ?> <table width="92%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="763"> <div align="left"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="100"><div align="center"><? echo "<a href=ShowProducts.php?PrdID=$idx><img src=../images/images_article/$images width=100 height=100 border=0></a>"; ?><br> </div></td> <td width="659"><? echo "<b><u>$subject</u></b><br><img src=../images/48be2683.gif>"; ?><? echo strip_tags("$detail..."); ?></span><br /></td> </tr> </table> </div></td> <td width="73"> <div align="center"> <table width="60" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="76"> </td> <td width="76"><div align="center"><a href="editarticle.php?PrdID=<? echo "$idx"; ?>"><img src="../images/pencil.jpg" width="20" height="20" border="0"></a></div></td> <td width="78"><div align="center"><a href="delarticle.php?PrdID=<? echo "$idx"; ?>&PhotoName=<? echo "$images"; ?>"><img src="../images/delete.png" width="22" height="22" border="0"></a></div></td> </tr> </table> </div></td> </tr> <tr> <td colspan="2"><img src="images/line.jpg" width="839" height="3"></td> </tr> </table> <? } } ?> </td> </tr> <tr class="jobscss"> <td><strong><span class="maekhawtom"><br> Page :</span></strong> <span class="maekhawtom"> <? for($i=1;$i<$page;$i++) { echo"[<a href='$PHP_SELF?page=$i'>$i</a>]"; } echo"[<b>$page</b>]"; for($i=$page+1;$i<=$totalpage;$i++) { echo"[<a href='$PHP_SELF?page=$i'>$i</a>]"; } ?> </span><span class="maekhawtom"> </span></td> </tr> <tr> <td><div align="center"></div></td> </tr> </table> </div></td> </tr> </table></td> </tr> </table> </div></td> </tr> </table> <br> <br> </div></td> </tr> </table> </div></td> </tr> </table></td> </tr> <tr> <td colspan="2"><div align="center"><br> <? echo "$buttomtxt"; ?> </div></td> </tr> </table> </div> </body> </html>