1. PHP / Говнокод #1251

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    <?
    ob_start();
    session_start();
    include("includes/applicationTop.php");
    ?>
    <?
    if($_SESSION["CONTACT_ID"]=="" || $_SESSION["CONTACT_ID"]==0)
    {
    	$contact_id=$_GET['contact_id'];
    }
    else
    {
    	$contact_id = $_SESSION["CONTACT_ID"];
    }
    if($_SESSION["ORDER_ID"]=="" || $_SESSION["ORDER_ID"]==0)
    {
    	$order_id=$_GET['order_id'];
    }
    else
    {
    	$order_id = $_SESSION["ORDER_ID"];
    }
    
    $selBillingInfo = "SELECT * FROM `contact` WHERE `contact_id`='".$contact_id."'";
    $resBillingInfo = $db->select_data($selBillingInfo);
    $selOrderInfo = "SELECT * FROM `order` WHERE `order_id`='".$order_id."'";
    $resOrderInfo = $db->select_data($selOrderInfo);
    ?>
    <? $exesql=mysql_query("select * from admin_updation where id = 1"); 
    $rs=mysql_fetch_object($exesql); $to_mail=$rs->paypal_id;?> 
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
    	<td width="30"><img src="images/spacer.gif" width="30" height="1" /></td>
    	<td><form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" ><!--<form class="formclass" method="post" action="https://www.paypal.com/cgi-bin/webscr"  id="myform" name="theForm" >-->
    		<input name="validate" value="1" type="hidden">
    		<input type="hidden" name="order_id" value="<?=$order_id?>" />
    		<?
    		$paypal[site_url]="http://говносайт";
    		$paypal[success_url]="/paymentReceipt.php?success=paypal&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[cancel_url]="/paymentReceipt.php?success=failed&pt=paypal&contact_id=$contact_id&order_id=$order_id";
    		$paypal[notify_url]="/ipn/ipn.php";
    		$paypal[return_method]="2"; //1=GET 2=POST
    		$paypal[currency_code]="USD"; //[USD,GBP,JPY,CAD,EUR]
    		$paypal[lc]="US";
    		$paypal[url]="https://www.sandbox.paypal.com/cgi-bin/webscr"; // For Test 
    		$paypal[post_method]="fso"; //fso=fsockopen(); curl=curl command line libCurl=php compiled with libCurl support
    		$paypal[curl_location]="/usr/local/bin/curl";
    		$paypal[bn]="toolkit-php";
    		$paypal[cmd]="_xclick";
    		$paypal[display_comment]="0"; //0=yes 1=no
    		$paypal[comment_header]="Comments";
    		$paypal[continue_button_text]="Continue >>";
    		$paypal[background_color]="1"; //""=white 1=black
    		$paypal[display_shipping_address]="1"; //""=yes 1=no
    		$paypal[display_comment]="1"; //""=yes 1=no
    		?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Live ?>
    		
    		<input type="hidden" name="business" value="<?=$to_mail?>"><? // For Test ?>
    		<!--<input type="hidden" name="business" value="[email protected]">--><? // For Test ?>
    		<input type="hidden" name="item_name" value="Говнобрэнд">
    		<input type="hidden" name="cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="redirect_cmd" value="<?=$paypal[cmd]?>">
    		<input type="hidden" name="image_url" value="">
    		<input type="hidden" name="return" value="<? echo "$paypal[site_url]$paypal[success_url]"; ?>">
    		<input type="hidden" name="cancel_return" value="<? echo "$paypal[site_url]$paypal[cancel_url]"; ?>">
    		<input type="hidden" name="notify_url" value="<? echo "$paypal[site_url]$paypal[notify_url]"; ?>">
    		<input type="hidden" name="rm" value="<?=$paypal[return_method]?>">
    		<input type="hidden" name="currency_code" value="<?=$paypal[currency_code]?>">
    		<input type="hidden" name="lc" value="<?=$paypal[lc]?>"><input type="hidden" name="bn" value="<?=$paypal[bn]?>">
    		<input type="hidden" name="cbt" value="<?=$paypal[continue_button_text]?>"><input type="hidden" name="no_shipping" value="<?=$paypal[display_shipping_address]?>">
    		<input type="hidden" name="no_note" value="<?=$paypal[display_comment]?>">
    		<input type="hidden" name="order_id" value="<?=$order_id?>"><input type="hidden" name="amount" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="first_name" value="<?=$resBillingInfo[0]['first_name']?>">	<input type="hidden" name="last_name" value="<?=$resBillingInfo[0]['last_name']?>">
    		<input type="hidden" name="company" value="<?=$resBillingInfo[0]['company']?>"><input type="hidden" name="address" value="<?=$resBillingInfo[0]['address']?>">
    		<input type="hidden" name="city" value="<?=$resBillingInfo[0]['city']?>"><input type="hidden" name="state" value="<?=$resBillingInfo[0]['state']?>">
    		<input type="hidden" name="zip" value="<?=$resBillingInfo[0]['zip']?>">
    		<input type="hidden" name="country" value="<?=$resBillingInfo[0]['country']?>">
    		<input type="hidden" name="phone" value="<?=$resBillingInfo[0]['phone']?>"> 	<input type="hidden" name="email " value="<?=$resBillingInfo[0]['email']?>">	<input type="hidden" name="a3" value="<?=$resOrderInfo[0]['amount']?>">
    		<input type="hidden" name="p3" value="1">	<input type="hidden" name="t3" value="M"> <input type="hidden" name="no_note" value="1">
    		<input type="hidden" name="src" value="1"><input type="hidden" name="sra" value="1">
    		<table width="100%" border="0" cellspacing="0" cellpadding="0">
    		  <tr>
    			<td class="text_body">&nbsp;</td>
    		  </tr>
    		  <tr>
    			<td align="left"></td>
    		  </tr>
    		</table>
    	  </form></td>
    	<td width="15"><img src="images/spacer.gif" width="15" height="1" /></td>
      </tr>
    </table>
    <script language="JavaScript">
    objfrm = document.getElementById("myform");
    objfrm.submit();
    </script>

    А вот занятный способ переброса посетителя на paypal.
    С помощью невидимой формы, который сама засабмитится (может быть).

    Источник тот же, что у #1244-#1245, #1248-#1250

    guest, 25 Июня 2009

    Комментарии (8)
  2. PHP / Говнокод #1250

    +143.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    if(!isset($err))
           {global $err;
    	    $err = array();
    	   }
              $f_ID=0;
            /* Get autoincreament id before inserting */
    		   $sqlSelctNextMem = "SHOW TABLE STATUS LIKE 'slideshow'";
    	       $resSelctNextMem = mysql_query($sqlSelctNextMem);
    	       $rr = mysql_fetch_array($resSelctNextMem);
               $maxRetailId =  $rr['Auto_increment'];
    		   /* Get autoincreament id before inserting */
    		    $ssf_arr=array();
    	   for($img=0; $img < $TotalNoOfFile;$img++)
    	   {
    	     if($_FILES['photo']['name'][$img]=="")
    		 {
    		    $t_cnt++;
    			if($t_cnt==$TotalNoOfFile)
    		    {
    		     $msg_dis.="<br><center><font class=required><img src=images/error.gif border=0>Image uploading failed.</font><center>";
    			}
    		 }
    		  if($_FILES['photo']['name'][$img]!="")
    		  {
    				$t=$f_ID+1;
    				$img_id=$img+1;
    				$filename = basename($_FILES['photo']['name'][$img]);
    				$my_firstfile=str_replace(" ","_",$_FILES['photo']['name'][$img]);
    				//$f_name_file=$_FILES['photo']['name'][$img];
    				$f_name_file=$my_firstfile;
    		    	$extp = substr($f_name_file, strrpos($f_name_file, '.') + 1);
    				
    		  
    		   //22_image_small_1,22_image_1,22_image
    			$filetypecmp=explode("/",$_FILES['photo']['type'][$img]);
    			$filetype=$filetypecmp[0];
    			$filetypeextcmp=explode(".",basename($_FILES['photo']['name'][$img]));
    			$filenamewithoutext=substr($filetypeextcmp[0],0,15);
    			$filetypeext=end($filetypeextcmp);
    			$new_filename=$maxRetailId."_image".".gif";
    			$new_filename_middle=$maxRetailId."_image_".$img_id.".gif";
    			$new_filename_small=$maxRetailId."_image_small".".gif";
    			// $_SESSION["ext"][$img]= basename($_FILES['photo']['name'][$img]);
    			$mediafolder = "tmp/uploads/eflyers/";
    			//$target_path = "uploads/eflyers/slideshow/".$filename;
    			// $target_thumbnail_path="uploads/eflyers/slideshow/thumbnails/".$filename;
    			$target_path_org = $mediafolder."slideshow/".$f_name_file;
    			$target_path = $mediafolder."slideshow/".$new_filename;
    			$target_thumbnail_path=$mediafolder."slideshow/".$new_filename_small;
    			$target_thumbnail_middle_path=$mediafolder."slideshow/".$new_filename_middle;
    			$result = 0;
    			$allowedfiletype="gif,jpg,jpeg,png,bmp,JPG,JPEG,PNG,GIF,BMP";
    			$pos="";
    			$pos = strpos($allowedfiletype,$filetypeext);
    			$hw=getimagesize($_FILES['photo']['tmp_name'][$img]);
    				  /* if($hw[0] > 800 || $hw[1] > 600){
    					 
    					 $msg.=basename($_FILES['photo']['name'][$img])."-> exceed the limit of 800x600 pixel<br>";
    						
    				   }else*/ if($pos === false)
    					  {
    						  //$msg.=basename($_FILES['photo']['name'][$img])."->Only following jpg,jpeg,pjpeg,png,gif types are allowed<br>";
    						   $msg_dis.=basename($_FILES['photo']['name'][$img])."->Only following jpg,jpeg,png,gif,bmp types are allowed<br>";
    						  //array_push($err,$msg);
    						 
    					   }else{
    					// chmod ($mediafolder, 0777); 
    					$temp_file=$_FILES['photo']['tmp_name'][$img];
    				 	 if(@move_uploaded_file($temp_file, $target_path)) 
    					   {
    							$db->resize_jpg($target_path,$target_path_org,50,40);
    							$db->resize_jpg($target_path,$target_thumbnail_path,50,40);
    							$db->resize_jpg($target_path,$target_thumbnail_middle_path,600,400);
    							//chmod ($mediafolder, 0755); 
    				        	if( $msg=="")
    							 $result = 1;
    							//$filesuploaded.=$_FILES['photo']['name'][$img]." Uploaded successfully<br>";
    							$filesuploaded.=str_replace(" ","_",$_FILES['photo']['name'][$img]).",";
    								 
    								// slideshow_id 	created slideshow
    							$creat_time=time();
    							$sql_media="insert into slideshow(`slideshow_id`,`created`)values('{$maxRetailId}','{$creat_time}')";
    							$res_media=$db->insert_data($sql_media);
    								 $_SESSION['SS_ID']=$maxRetailId;
    						        $sql_slideframe="insert into slideshow_frame(`frame_id`,`slideshow_id`,`title`,`smallfilename`,`filename`,`order_number`)values('','{$maxRetailId}','{$f_name_file}','{$new_filename_small}','{$new_filename_middle}','{$img_id}')";
    							    $res_slideframe=$db->insert_data($sql_slideframe);
    								 $ssf_in_id=mysql_insert_id();
    								 $_SESSION['SSF_ID']=$ssf_in_id;
    								 array_push($ssf_arr,$ssf_in_id); 
    								 $_SESSION['SSF_ID_ARRAY']=$ssf_arr;
    			           }//move
    		             }//else
              }
    	   } 
    	   $_SESSION['IMG_CNT']=$img_id;
    $msg.=$filesuploaded;
     sleep(1);

    guest, 25 Июня 2009

    Комментарии (4)
  3. PHP / Говнокод #1249

    +143.1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    if($_POST['schedule_meridian']=='0')
             {
                 $ampm_val="AM";
                 $shour=$_POST['schedule_hour'];
             }
             else
             if($_POST['schedule_meridian']=='1')
             {
                 $ampm_val="PM";
                 for($tv=1;$tv<=12;$tv++)
                 {
                     if($_POST['schedule_hour']==$tv)
                     $shour=12+$tv;
                 }
             }

    И снова кусок кода из той же золотой жилы, что и #1248.
    Хитрый перевод времени в 24х-часовой формат.

    $_POST['schedule_meridian'] - 0 или 1, означает AM/PM.
    $_POST['schedule_hour'] - час от 1 до 12.

    guest, 25 Июня 2009

    Комментарии (2)
  4. PHP / Говнокод #1248

    +53.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    /* for Shedular date */
    	$shd_Date=$db->get_field("`mailer`","datetime","eflyer_id",$eflyerid);
    	$sh_date=date ("d-m-Y-h-A", $shd_Date);
    	$sh_dateArr=explode('-',$sh_date);
    	$sd=trim($sh_dateArr[0]);
    	if($sd=='01')
    	$sd=1;
    	else
    	if($sd=='02')
    	$sd=2;
    	else
    	if($sd=='03')
    	$sd=3;
    	else
    	if($sd=='04')
    	$sd=4;
    	else
    	if($sd=='05')
    	$sd=5;
    	else
    	if($sd=='06')
    	$sd=6;
    	else
    	if($sd=='07')
    	$sd=7;
    	else
    	if($sd=='08')
    	$sd=8;
    	else
    	if($sd=='09')
    	$sd=9;
    	else
    	$sd=$sd;
    	$_POST['schedule_day']=$sd;
    	$sm=trim($sh_dateArr[1]);
    	if($sm=='01')
    	$sm=1;
    	else
    	if($sm=='02')
    	$sm=2;
    	else
    	if($sm=='03')
    	$sm=3;
    	else
    	if($sm=='04')
    	$sm=4;
    	else
    	if($sm=='05')
    	$sm=5;
    	else
    	if($sm=='06')
    	$sm=6;
    	else
    	if($sm=='07')
    	$sm=7;
    	else
    	if($sm=='08')
    	$sm=8;
    	else
    	if($sm=='09')
    	$sm=9;
    	else
    	$sm=$sm;
    	$_POST['schedule_month']=$sm;
    	$_POST['schedule_year']=trim($sh_dateArr[2]);
    	$_POST['schedule_hour']=trim($sh_dateArr[3]);
    	$_POST['schedule_meridian']=trim($sh_dateArr[4]);
    	/* for Shedular date */

    И снова индусский (как выяснилось по камментам там и сям) код. Источник тот же, что у #1244 и #1245.

    guest, 25 Июня 2009

    Комментарии (0)
  5. PHP / Говнокод #1247

    +136.4

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    if (mysql_num_rows($result) > 0) {
    $row=mysql_fetch_array($result);
    $strings = ($row[1]) + 1;
    $words = $row[2] + (substr_count(trim($parse[count($parse)-6]), ' ') + 1);
    $letters = $row[3]+strlen($parse[count($parse)-6]);
    $result = mysql_query("UPDATE `stat` SET `strings`='".$strings."', `words`='".$words."', `letters`='".$letters."', `last_say`='".$parse[count($parse)-6]."', `last_say_date`='".date('Y-m-d G:i:s')."' WHERE `id`=".$row['id']) or die(''.mysql_error($link));
    } else $result=mysql_query("INSERT into `stat` (`host`, `strings`, `words`, `letters`) VALUES ('".$parse[count($parse)-2]."', '1', '".(substr_count(trim($parse[count($parse)-6]), ' ') + 1)."', '".strlen($parse[count($parse)-6])."')") or die(''.mysql_error($link));

    Скрипт обновления статистики

    guest, 24 Июня 2009

    Комментарии (0)
  6. PHP / Говнокод #1246

    +54.2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    <form name='<? echo $tb_names[$i]; ?>' method='post' ENCTYPE='multipart/form-data' action="admin.php?task=del">
        <input type=hidden  name=login  value='<? echo @$_POST['login']; ?>'>
        <input type=hidden  name=password  value='<? echo @$_POST['password']; ?>'>
        <input name='tname' type=hidden value='<? echo $tb_names[$i]; ?>'>
        <p><input type='submit' value='Удалить прайс'>
    </form>

    Недавно дали сайт на обновление. Не мог понять почему при обновлении страницы брсает на авторизацию. Вот что я нашел когда начал разбираться, они даже не шифрованные там хранятся.

    guest, 24 Июня 2009

    Комментарии (0)
  7. PHP / Говнокод #1245

    +140.9

    1. 1
    2. 2
    3. 3
    $sqlt="select * from logos where is_delete='0'";
    $rest=$db->select_data($sqlt);
    $total=count($rest);

    Подсчет подходящих записей в таблице.
    Источник тот же, что и у говнокода 1244.
    В $rest возвращается ассоциативный массив.

    guest, 24 Июня 2009

    Комментарии (0)
  8. PHP / Говнокод #1243

    +140.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    if (isset($aCart['color_caption'])) {
        if (!isset($aCart['color_name']) && isset($aCart['color_caption'])) {
            $aInsert['color_name']    = $aCart[$i]['color_caption'];
            $aInsert['color_caption'] = $aCart[$i]['color_caption'];
        }
        elseif (isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
            $aInsert['color_name']    = $aCart[$i]['color_name'];
            $aInsert['color_caption'] = $aCart[$i]['color_name'];
        }
        elseif (!isset($aCart['color_name']) && !isset($aCart['color_caption'])) {
            $aInsert['color_name']    = 'N/A';
            $aInsert['color_caption'] = 'N/A';
        }
        else {
            $aInsert['color_name']    = $aCart['color_caption'];
            $aInsert['color_caption'] = $aCart['color_name'];
        }
    }

    Чем была забита моя голова не известно. Как я такую логику придумал?!

    guest, 24 Июня 2009

    Комментарии (0)
  9. PHP / Говнокод #1240

    +140.1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    function parce($string)
    
    
    
    {//function open
    $breaktags=array ("<"," ","=","","т");
       
       for ($pos=0;$pos<strlen($string);$pos++)
       {//for text
         
         if (substr($string,$pos,1)=="{" and substr($string,$pos+1,1)=="%")
    		{// if open symbols finded
    		   $tagopened=1;
    		   while($tagopened==1){//while opened
    			   for($inpos=$pos+2;$inpos<10000;$inpos++){// =)
    				   if ( (substr($string,$inpos,1)=="%" and substr($string,$inpos+1,1)=="}") or in_array(substr($string,$inpos,1),$breaktags)) {break 2;$tagopened=0;}//br
    				   $intag=$intag.substr($string,$inpos,1);
    		   }//for inpos
    		}//while opened closing
    		$intag=explode("->",$intag,2);
    		echo("$intag[0] with $intag[1] action!<br>");
    		unset($intag);
    				} else {//if symbols finded
    					$symbol=substr($string,$pos,1);
    					echo("$symbol");
    				}
    				
       }//for all text closing
       
    }//function end;

    guest, 23 Июня 2009

    Комментарии (3)
  10. PHP / Говнокод #1238

    +147

    1. 1
    2. 2
    3. 3
    <?php
       if ($_SESSION['gde'] != 'tut') {exit();}
    ?>

    Ты не тут? Выйди!

    guest, 22 Июня 2009

    Комментарии (2)