Jump to content

jitesh

Members
  • Posts

    807
  • Joined

  • Last visited

Everything posted by jitesh

  1. <?php $username = "admin"; $password = "admin123"; if(preg_match("/".$username."/i",$password)){ echo "Please Change Password"; }else{ echo "Password is ok"; } ?>
  2. header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: image/jpeg"); header('Content-Description: File Transfer'); header("Content-Disposition: attachment; filename=\"".basename($filename)."\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); set_time_limit(0); @readfile("$filename") or die("File not found.");
  3. set header with this headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  4. <script language="javascript"> function submitform(frmObj,pressedascii){ if(pressedascii == 13){ frmObj.submit(); } } </script> <form name="frmname" action="test1.php" method="post"> <input type="text" name="name" value="" onkeypress="javascript:submitform(this.form,event.Keycode);" </form>
  5. if(preg_match("/^[a-zA-Z_]+(\w+)*((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/i",$_REQUEST['email']){ echo "valid email"; }else{ echo "Invalid Email"; }
  6. $sSqlQuery3="select * from ".RESERVATION_TABLE." WHERE user_reserve_date = '".$user_sel_date."'";
  7. First of all you have multiple table with your product so this is not a proper normalize data. You may follow like this table 1 : Master products items product_item_id product_item_name 1 fragrances 2 skincare 3 shaving table 2 : Product table product_id product_item_id product_name avail browse 1 1 (fragrances) prd1 true 1 2 1 (fragrances) prd2 true 1 3 2 (skincare) prd3 true 2 So for above case you have only one query if(isset($_GET['browse']) and !empty($_GET['browse']) and is_integer($_GET['browse'])){ select * from product where avail = 'true' and browse = '"$_GET['browse']."'"; }else{ echo "Invalid input for browse"; }
  8. if(isset($_GET['category']) and !empty($_GET['category']) and is_integer($_GET['category'])){ $sql = "select * from product where category = ".$_GET['category']; ................. ................ }else{ echo "Invalid input for category"; }
  9. http://www.phpfreaks.com/forums/index.php/topic,134298.msg565373.html#msg565373
  10. <?php echo "<td class=".$class_bg."> <table width=\"25\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\"> <tr> <td> </td> <td align=\"right\" valign=\"top\" class=".$date_class."><a href=\"#\" onMouseOver=\"doTooltip(event, msgTips)\" onmouseout=\"hideTip();\" class=".$date_class.">".$i."</a></td> <td style=\"width:3px\">"; $_SESSION['mydate']= $i; echo " </td> </tr> <tr> <td colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td colspan=\"2\" style=\"height:8px\"></td> </tr> </table></td> </tr> </table> </td>";?>
  11. check in php.ini "register_long_arrays" is On + Restart Webserver
  12. if ($where) { $sql = "SELECT * FROM items WHERE " . implode(' AND ', $where); // query and display results }
  13. This may be better in your case. while ($row5=mysql_fetch_array($res5)){ $rows_a = array(); $rows_a = str_split($row5[text1],20); foreach($rows_a as $key => $value){ echo "<tr>".$value."</tr>"; } }
  14. wordwrap <?php $row5[text1] = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($row5[text1], 20, "<br />\n"); echo $newtext; ?>
  15. <table cellpadding="5" cellspacing="5" border="0"> <tr><td> <?php header("Content-Type:image/jpeg"); $img1 = imagecreatetruecolor(50,10); $bgcolor = imagecolorallocate($img1,100,120,210); imagejpeg($img1,"img1.jpg"); imagedestroy($img1); header("Content-Type:text/html"); ?> <img src="img1.jpg" /> </td></tr> <tr><td> <?php header("Content-Type:image/jpeg"); $img2 = imagecreatetruecolor(100,10); $bgcolor = imagecolorallocate($img2,100,120,210); imagejpeg($img2,"img2.jpg"); imagedestroy($img2); header("Content-Type:text/html"); ?> <img src="img2.jpg" /> </td></tr> <tr><td> <?php header("Content-Type:image/jpeg"); $img3 = imagecreatetruecolor(70,10); $bgcolor = imagecolorallocate($img3,100,120,210); imagejpeg($img3,"img3.jpg"); imagedestroy($img3); header("Content-Type:text/html"); ?> <img src="img3.jpg" /> </td></tr> </table> <table cellpadding="5" cellspacing="5" border="0"> <tr><td width="20" valign="bottom"><?php header("Content-Type:image/jpeg"); $img4 = imagecreatetruecolor(10,50); $bgcolor = imagecolorallocate($img4,100,120,210); imagejpeg($img4,"img4.jpg"); imagedestroy($img4); header("Content-Type:text/html"); ?> <img src="img4.jpg" /></td> <td width="20" valign="bottom"><?php header("Content-Type:image/jpeg"); $img5 = imagecreatetruecolor(10,100); $bgcolor = imagecolorallocate($img5,100,120,210); imagejpeg($img5,"img5.jpg"); imagedestroy($img5); header("Content-Type:text/html"); ?><img src="img5.jpg" /></td> <td width="20" valign="bottom"><?php header("Content-Type:image/jpeg"); $img6 = imagecreatetruecolor(10,70); $bgcolor = imagecolorallocate($img6,100,120,210); imagejpeg($img6,"img6.jpg"); imagedestroy($img6); header("Content-Type:text/html"); ?> <img src="img6.jpg" /></td> </tr> </table>
  16. For This you must have to set display_error = On in php.ini and set error_reporting = E_ALL and for others set like this ;error_reporting = E_ALL & E_NOTICE ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR ;error_reporting = E_ALL & E_NOTICE ; display all errors, warnings and notices i mean to say only one "error_reporting" should have to enable.
  17. Session and cookie both are temporary saved the data in temporary files. The main diff is session's temporary files are saved in server while cookie's temporary files are saved in client machine. session will lost data when browser closed. while in case of cookie you can use persistent cookie so save data londger ........ ........................ .......................
  18. test this <script language="javascript"> function message(){ alert("<?php echo "Alert Message";?>"); } </script> <input type="button" name="Click" value="Click" onclick="javscript:message();"/>
  19. use $_POST['remember'] insted of $_POSTS['remember']
  20. Attached is tree view with categories up to n level. [attachment deleted by admin]
  21. <?php $unix_timestamp = mktime(); echo date("Y-m-d h:i:s",$unix_timestamp); ?>
  22. This is one solution <?php $str = "I say This is a string And String . If It has multiple chars."; $str_array = explode(" ",$str); $new_array = array(); foreach($str_array as $key => $value){ if(!preg_match("/^And$|^Or$|^If$|^We$|^An$|^A$|^I$/i",$value)){ $new_array[] = $value; } } echo $str; echo "<br>"; echo implode(" ",$new_array); ?>
  23. if($user_authority == 3){ include('file1.php'); }else{ include('file2.php'); }
  24. <?php $value = 19.11; if(preg_match("/^\d{1,3}(,?\d{3})*(\.\d{2})?$/",$value)){ echo "Right"; }else{ echo "Wrong"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.