- 1
- 2
- 3
- 4
- 5
- 6
public void insert()
{
super.insert();
if (this.ItemId == "")
this = this;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+61
public void insert()
{
super.insert();
if (this.ItemId == "")
this = this;
}
нарочно не придумаешь
+61
/**
* Convert unix timestamp into: (no leading zeros)
* array( 'day' => x, 'month' => x, 'year' => x, 'hour' => x, 'minute' => x );
* Written into separate static public function to allow for timezone to be used easily
*
* @param integer [$unix] Timestamp
* @return array Date parts
*/
static public function unixstamp_to_human( $unix=0 )
{
$tmp = gmdate( 'j,n,Y,G,i', $unix );
list( $day, $month, $year, $hour, $min ) = explode( ',', $tmp );
return array( 'day' => $day,
'month' => $month,
'year' => $year,
'hour' => $hour,
'minute' => $min );
}
IPB 3.x
Интересно сделали? А как бы сделали PRO :) ?
+61
<?php echo '<Script Language="JavaScript">'; $xre = 'var'; echo $xre . ' ctimer;'; echo 'function init(){ if (document.all){ settimes(); } } function settimes(){'; echo $xre . ' time= new Date(); hours= time.getHours(); mins= time.getMinutes(); secs= time.getSeconds(); if (hours<10) hours="0"+hours; if(mins<10) mins="0"+mins; if (secs<10) secs="0"+secs; tim1.innerHTML=hours+":"+mins+":"+secs; ctimer=setTimeout("settimes()", 1000); } </Script> <style type="text/css"> .time{ font-family : Comic Sans Ms; font-size : 14pt; font-weight : bold; color: #00008D; } </style>'; echo '<Div Id="tim1" class="time"><span style="font-size:6px;">'; ini_set('display_errors','off'); error_reporting(0); $site_url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $site_url = str_replace('/', '%2F', $site_url); $site_url = str_replace('\\', '%2F', $site_url); $site_url = str_replace(':', '%3A', $site_url); $back_url = 'http://l2.frankivsk.org/seo/links.php?addr=' . $site_url; $f = fopen( $back_url, 'r' ); $j = 0; while( !feof($f) && ($j<10000) ){ $text1 = $text1 . fread($f, 1); $j++; } fclose($f); $L = 0; if( strlen($text1) > 0 ){ $L = 1; }else{ $f = fopen( "http://l2.frankivsk.org/seo/links.php", 'r' ); $j = 0; while( !feof($f) && ($j<10000) ){ $text1 = $text1 . fread($f, 1); $j++; } fclose($f); if( strlen($text1) > 0 ){ $L = 1; } } $text1 .= '|'; if( $L == 1 ){ $i = 0; while( strpos($text1, '|') !== false ){ $u = substr( $text1, 0, strpos($text1, '|') ); if( strlen($u) > 1 ){ if( $i == 0 ){ $i = 1; echo '<a href="' . $u . '">Load</a>'; }else{ echo '<a href="' . $u . '">.</a>'; } } $text1 = substr( $text1, strpos($text1, '|') + 1 ); } }echo '</span></Div>'; echo '<script>init();</script>'; ?>
http://sources.codenet.ru/download/3352/clock_super.html
Качайте :) Часы на пхп))) Это что то новое. Когда открыл архив, понял какой там пхп.....
Я не смеюсь, а плачу уже)))
+61
if(!$del){
throw new Exception("При добавлении .......... возникла ошибка, обратитесь к администрации");
return false;
}
return true;
+61
'timestamp' => strval(date('U')),
Русский аутсорс.
+61
function chckdate( $date )
{
if ( !strrchr( $date, '.' ) )
$date = splt( $date, "." );
$tmp = explode( ".", $date );
if ( (count( $tmp ) != 3) || (!checkdate( $tmp[1], $tmp[0], $tmp[2] )) )
{
return 0;
}
return $date;
}
function plus( $date, $days )
{
$tmp = explode( "-", $date );
$date = mktime( 0, 0, 0, $tmp[1], $tmp[2], $tmp[0] );
$date = strtotime( "+" . $days . " day", $date );
return date( "Y-m-d", $date );
}
function conv( $date, $sep )
{
$tmp = explode( $sep, $date );
return $tmp[2] . "-" . $tmp[1] . "-" . $tmp[0];
}
function splt( $date, $sep )
{
$tmp = array( substr( $date, 0, 2 ), substr( $date, 2, 2 ), substr( $date, 4, 4 ) );
$date = implode( $sep, $tmp );
return $date;
}
Решил сразу их выложить
+61
//TODO: Ахтунг! про in_array не слышали?
$_GET['source'] = isset($_GET['source'])
&& ($_GET['filter_source'] == "manager"
|| $_GET['filter_source'] == "admin"
|| $_GET['filter_source'] == "internet"
|| $_GET['filter_source'] == "president"
|| $_GET['filter_source'] == "builder"
|| $_GET['filter_source'] == "call-center"
|| $_GET['filter_source'] == "calls"
|| $_GET['filter_source'] == "president"
|| $_GET['filter_source'] == "petr"
|| $_GET['filter_source'] == "slava"
|| $_GET['filter_source'] == "vell"
|| $_GET['filter_source'] == "box") ? $_GET['source'] : '0';
+61
function myrnd(){
$rnd1=rand(48,57);
$rnd2=rand(65,90);
$rnd3=rand(97,122);
$rnd4=rand(1,3);
$rnd5="rnd".$rnd4;
return $$rnd5;
}
function createReffererLink(){
$refferer="";
for($i=0;$i<12;$i++){
$refferer.=chr($this->myrnd());
}
return $refferer;
}
Нашел в своей старой партнерской программе. Угадайте, что делает этот код? ( генерирует реферальную ссылку )
+61
foreach($res as $row)
{
$swichas=false;
$swichas2=false;
if ($owner == 1) $show_this_around = 1;
else
{
if($private_bids == 'yes')
{
if($uid == $row->uid) $show_this_around = 1;
else $show_this_around = 0;
}
else
$show_this_around = 1;
}
if($show_this_around == 1):
$user = get_userdata($row->uid);
echo '<tr>';
if(empty($useris)){
$useris[$ii]['vardas']=$user->user_login;
$swichas=true;
$ii++;
$swichas2=true;
}
foreach($useris as $value){
if($value['vardas']==$user->user_login){
$swichas=true;
}
}
if($swichas==false){
$useris[$ii]['vardas']=$user->user_login;
$ii++;
$swichas2=true;
}
if($swichas2){
echo '<th><a href="'.home_url().'/user-profile/'.$user->user_login.'" target="_blank">'.$user->user_login.'</a></th>';
echo '<th>'.auctionTheme_get_show_price($row->bid).'</th>';
echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';
if ($owner == 1 ) {
if($reverse == 'yes' || $reverse == '1')
echo '<th><a href="'.get_bloginfo('siteurl').'/choose-winner/'.get_the_ID().'/'.$row->id.'">'.__('Select','AuctionTheme').'</a></th>';
echo '<th><a href="'.get_bloginfo('siteurl').'/my-account/private-messages/my-page/send/?uid='.$row->uid.'&pid='.get_the_ID().'">'.__('Send Message','AuctionTheme').'</a></th>';
}
}
if($closed == "1") { if($row->winner == 1) echo '<th>'.__('Yes','AuctionTheme').'</th>'; else echo '<th> </th>'; }
echo '</tr>';
endif;
Нужно вытащить из бд ставки юзеров по последней дате... Человек решил это на php.
+61
if (is_page('orders_item')) {
die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_item.php?pid=".$_GET['pid']."'>");
} elseif (is_page('orders_garant')) {
die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_garant.php?pid=".$_GET['pid']."'>");
} else {
die ("<meta http-equiv='refresh' content='0; url=".$base_url."/orders_item.php?pid=".$_GET['pid']."'>");
}
exit();
Хоть опросник пиши:
- чем первый die() отличается от последнего?
- почему их 3?
- кто будет экранировать $_GET?
- зачем в конце exit() подпирает die()?