Jump to content

kanchatchai

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by kanchatchai

  1. <?PHP$dir="upload/"; $files = scandir($dir); foreach($files as $file) { echo $file."<br>"; }?> and do you mean scan file in dir agin.
  2. to buy. .....do it like --show cart -- sectionin foreach($_SESSION['product'] as $key=>$value){..} between line 99 to line 116but need SQL insert code to buy table with $_SESSION["customer_id"]
  3. Please back tohttp://w3schools.invisionzone.com/index.php?showtopic=44974&view=findpost&p=252477again serthat included new source code.
  4. try otherway$size = getimagesize($_FILES['file1']['tmp_name']);echo $size['mime'];
  5. <form name="upload file" method="post" enctype="multipart/form-data" action=""><br/>File: <input type="file" name="file1"><br/><input type="submit" value="Start Upload" name="submit"></form><?PHP$allowfiletype='tif,gif,png,jpg,jpeg,doc,docx,xls,xlsx,ppt,pptx,jpg,pdf,zip,rar,txt';$allowedExts=explode(",",$allowfiletype);if (isset($_POST['submit'])){$filetype = explode('.', $_FILES['file1']['name']);$filetype = end($filetype);if (in_array($filetype, $allowedExts)){echo 'Good';}else{echo 'BAD';}}?>
  6. kanchatchai

    image size

    http://php.net/manual/en/function.getimagesize.php
  7. some codehttp://w3schools.invisionzone.com/index.php?showtopic=44974
  8. <?PHPinclude('connect.php');@session_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Product For You</title><style type="text/css"><!-- table{border-collapse:collapse;}table,th, td{border: 1px solid #8AB1B9;} #left_sidebar {float: left;width: 22%; padding: 15px 0;/* background-color: #ABE6ED;*/border: 1px solid #8AB1B9;}#right_sidebar {float: right;width: 23%;/* background-color: #ABE6ED;*/border: 1px solid #8AB1B9;padding: 15px 0;}#mainContent {margin: 0 24% 0 23.5%;}#productbox{/*background-color: #D4EAFC;*/border: 1px solid #A7B8C5;width:220px;padding:10px;margin:3px;float:left;} --></style></head><body> <div id="left_sidebar">Left Sidebar </div> <div id="right_sidebar"> <?PHP /*-------------------------------------- Add--------------------------------------*/if (isset($_POST['count'])){if (isset($_SESSION["product"][$_POST['productid']])) $_SESSION['product'][$_POST['productid']]=$_SESSION['product'][$_POST['productid']]+$_POST['count'];else $_SESSION['product'][$_POST['productid']]=$_POST['count'];}/*-------------------------------------- Delete --------------------------------------*/if (isset($_POST['delete_selected'])){ if (isset($_POST['check'])) foreach($_POST['check'] as $key=>$value){ unset ($_SESSION['product'][$key]); //echo $key; }}/*-------------------------------------- Update --------------------------------------*/ if (isset($_POST['update'])){ if (isset($_POST['new_count'])) foreach($_POST['new_count'] as $key=>$value){ //Can Use... //$_SESSION['product'][$key]=$_POST['value'][$key]; //or Use ... $_SESSION['product'][$key]=$value; } //echo '<br/>value updated<br/><br/>';} /*-------------------------------------- Show Cart --------------------------------------*/if (isset($_SESSION['product'])){echo '<b>Your Cart</b><br/><FORM Name="Form1" Method="POST">';echo '<table id="table_border1" ><tr ><th >Select</th><th>Name</th><th>Price</th><th>Count</th><th>Sum</th></tr>'; $total=0; foreach($_SESSION['product'] as $key=>$value) { echo '<tr ><td><input type="checkbox" name="check['.$key.']" >#'.$key.'</td>'; $result_select_product = mysql_query("SELECT * FROM tbl_product where product_id=".$key); while($row_select_product = mysql_fetch_array($result_select_product)) { $price=0; echo '<td>'.$row_select_product['product_name'].'</td>'; echo '<td align="right">'.$row_select_product['product_price'].'</td>'; $price=$row_select_product['product_price'];} echo '<td><input type="text" size="4" Style="text-align: right;" name="new_count['.$key.']" value="'.$_SESSION['product'][$key].'"></td>';$count_x_price=($price*$_SESSION['product'][$key]);$total=$total+$count_x_price;echo ' <td align="right">'.$count_x_price.'</td>';//sumecho '</tr>'; }echo ' <td colspan="4" align="center" ><b>TOTAL</b></td> <td align="right"><b>'.$total.'</b></td>';echo '</table>'; echo '<input type="submit" name="delete_selected" value="Delete Selected" />';echo '<input type="submit" name="update" value="Update" />';echo '<input type="submit" name="buynow" value="Buy Now" />';echo '</form>'; } // If Click Update show ..Updated... if (isset($_POST['update'])) echo "Your cart Updated"; if (isset($_POST['buynow'])) { if (isset($_SESSION["customer_id"])) { require('update_cart.php'); /*Update To Database ... ... ... ...and show user... */ echo "Your Cart Completed"; //Next Clear Cart Session unset($_SESSION['product']); } else { echo "Please Login to Complete Cart.";} } //End Show Cart ?> </div> <div id="mainContent"><?PHPif (isset($_SESSION['admin_id'])){echo '<a href="tbl_product_insert.php"><img src="icon/add.png" alt="+Add" title="Add New"/></a>';} $result_tbl_product = mysql_query("SELECT * FROM tbl_product"); while($row_tbl_product = mysql_fetch_array($result_tbl_product)) { ?> <div id="productbox"> <FORM Name="Form1" Method="POST"> <input type="hidden" name="productid" value ="<?PHP echo $row_tbl_product['product_id'];?>"> <b>Image:</b><br/> <img src="<?PHP echo $row_tbl_product['product_image']?>"><br/> <b> <?PHP echo "#".$row_tbl_product['product_id']." ".$row_tbl_product['product_name'];?></b><br/> <b>Price:</b> <?PHP echo $row_tbl_product['product_price'];?><br/> <b>Get it:</b> <input type="text" name="count" value="1" size="4" maxlength="4" Style="text-align: right;"> <input type="submit" name="button" id="button" value="Add to cart" /> </form></div><?PHP } ?></div><?PHP/*echo "Sessions";echo "<pre>";print_r($_SESSION);echo "</pre>";*/?></body></html> <?PHP mysql_close($con); ?>
  9. code Iload product from databasemove form in to loop and make it only one form .
  10. kanchatchai

    hide image url

    to header all of filetype with auto check work:) <?php/*credithttp://php.net/manual/en/function.mime-content-type.php#84361*/ if(!function_exists('mime_content_type')) { function mime_content_type($filename) { { preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix); switch(strtolower($fileSuffix[1])) { case "js" : return "application/x-javascript"; case "json" : return "application/json"; case "jpg" : case "jpeg" : case "jpe" : return "image/jpg"; case "png" : case "gif" : case "bmp" : case "tiff" : return "image/".strtolower($fileSuffix[1]); case "css" : return "text/css"; case "xml" : return "application/xml"; case "doc" : case "docx" : return "application/msword"; case "xls" : case "xlt" : case "xlm" : case "xld" : case "xla" : case "xlc" : case "xlw" : case "xll" : return "application/vnd.ms-excel"; case "ppt" : case "pps" : return "application/vnd.ms-powerpoint"; case "rtf" : return "application/rtf"; case "pdf" : return "application/pdf"; case "html" : case "htm" : case "php" : return "text/html"; case "txt" : return "text/plain"; case "mpeg" : case "mpg" : case "mpe" : return "video/mpeg"; case "mp3" : return "audio/mpeg3"; case "wav" : return "audio/wav"; case "aiff" : case "aif" : return "audio/aiff"; case "avi" : return "video/msvideo"; case "wmv" : return "video/x-ms-wmv"; case "mov" : return "video/quicktime"; case "zip" : return "application/zip"; case "tar" : return "application/x-tar"; case "swf" : return "application/x-shockwave-flash"; default : if(function_exists("mime_content_type")) { $fileSuffix = mime_content_type($filename); } return "unknown/" . trim($fileSuffix[0], "."); } }}}$file_path="pics/";//$filename="2/2.bmp";$filename="2/2.jpg";header("Content-type: ".mime_content_type($file_path.$filename));echo file_get_contents($file_path.$filename);?>
  11. kanchatchai

    hide image url

    header("Content-type: image/jpeg");// not changechange only filename in file_get_contents
  12. kanchatchai

    hide image url

    test of showimage.php <?PHPheader("Content-type: image/jpeg");echo file_get_contents("test.jpg");?> .htaccess # Don't show directory listings for URLs which map to a directory.Options -Indexes# Make handle any 404 errors.# Set the default handler.DirectoryIndex index.phpRewriteRule ^(pic/.*)$ index.php [L,QSA] #protect All Files In /pic/*.* fox idia work better because can protect .jpg filepic/.htaccess Order Allow DenyDeny From AllRewriteRule ^(*.*)$ index.php [L,QSA] #protect All Files In *.*
  13. http://w3schools.invisionzone.com/index.php?showtopic=44974&st=0&p=250448entry250448
  14. kanchatchai

    hide image url

    to protect image dir use php to read image fileand use (example) <img src="showimage.php?imageid=1"?> to protect file in folder use .haccess code sample RewriteRule ^(pic/.*)$ index.php [L,QSA] #protect All Files In /pic/*.*
  15. kanchatchai

    Contact Form

    <?php $errors = ''; myemail = 'example@example.com';$name="";$email_address="";$subject="";$message="";if (isset($_POST['submit'])){ if( empty($_POST['name']) || empty($_POST['email']) || empty($_POST['subject']) || empty($_POST['message'])) { $errors .= "\n Error: all fields are required"; } if (isset($_POST['name'])) $name = $_POST['name']; ; if (isset($_POST['email'])) $email_address = $_POST['email']; if (isset($_POST['subject'])) $subject = $_POST['subject']; if (isset($_POST['message'])) $message = $_POST['message'];} if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } if(empty($errors)) { $to = $myemail; $email_subject = "ORMT: $subject"; $email_body = "Name: $name\n Email: $email_address\n Message\n $message"; $headers = "From: $myemail\n"; $headers .= "Reply-To: $email_address"; mail($to,$email_subject,$email_body,$headers); echo "<p>Thank you for your interest, we will be in contact soon.</p>"; } ?> <form action="" method="post" name="contact"> <label>Name: <span class="error" id="contact_name_errorloc"></span></label> <input id="contactName" type="text" name="name" value="<?PHP echo $name; ?>"> <?PHP if (isset($_POST['submit'])&&$name=="") echo "Please provide your name."; ?> <br/> <label>E-Mail: <span class="error" id="contact_email_errorloc"></span></label> <input id="contactEmail" type="text" name="email" value="<?PHP echo $email_address; ?>"><?PHP if (isset($_POST['submit'])&&$email_address=="") echo "Please provide your email."; ?><br/> <label>Subject: <span class="error" id="contact_subject_errorloc"></span></label> <input id="contactSubject" type="text" name="subject" value="<?PHP echo $subject; ?>"><?PHP if (isset($_POST['submit'])&&$subject=="") echo "Please provide your subject."; ?><br/> <label>Message: <span class="error" id="contact_message_errorloc"></span></label> <textarea id="contactMessage" name="message" ><?PHP echo $message; ?></textarea><?PHP if (isset($_POST['submit'])&&$message=="") echo "Please provide your message."; ?> <input id="contactSend" type="submit" name="submit" value="Send"> </form> <?PHP echo $errors; ?>
  16. <?php$SrcArry = array(10,20,30,40,50);$DestArry = array();$Str = NULL;for ($i = 0;$i < 5;$i++) {$Str .= pack('I', $ScrArry[$i]);}
  17. http://www.w3schools.com/php/php_ajax_livesearch.asp
  18. SELECT products.*, users.* FROM users RIGHT JOIN products ON users.username = products.username;
  19. That great idia.That New knowledge. I wana to learn Thank....mmmmmmm..for as_bold_as_love reson i think canuse HttPRequest.open('POST',url,true); if possible on ajx code
  20. <?php if (isset($_POST['post2'])) { echo"Form 2 has been submitted."; }else{if (isset($_POST['post1'])){echo"Form 1 has been submitted.";/**********post 2*******************************/ //render form 2 ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="form2"><fieldset> <table id="site-form"> <tr> <td class="one_of_three"> </td> <td class="two_of_three"><input name="post2" id="post2" type="submit" value="Click Me (2)"/> <a href="">Cancel</a>.</td> <td> </td> </tr> </table> </fieldset></form> <?php/********** end post 2*******************************/}else{//render form 1?><form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" id="form1"><fieldset><table id="site-form"><tr> <td class="one_of_three"> </td> <td class="two_of_three"><input name="post1" id="post1" type="submit" value="Click Me (1)"/> <a href="">Cancel</a>.</td> <td> </td></tr></table></fieldset></form><?php}}// if (isset($_POST['post2']))
  21. create form and post to other pageand select from $_POST value $sql="SELECT * FROM users where users.Nname='".$_POST["Name"]."'";
  22. $options.="<OPTION VALUE=\"$id\">".$thing."</OPTION>";
  23. try reg_form_detail.php without requireormay plugin not start.
×
×
  • Create New...