- 1
- 2
- 3
<?php
die 'Превьюшки пока что не обрабатываются.';
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
<?php
die 'Превьюшки пока что не обрабатываются.';
Либо я уже спятил и что-то делаю не так, либо php.
die ('Превьюшки пока что не обрабатываются.'); работает на ура, а данный пример выбивает мне Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING.
Ничего не понимаю.
+126
private int VedOrderBy(int N_VED)
{
switch (N_VED)
{
case 2:
return 3;
break;
case 3:
return 5;
break;
case 4:
return 1;
break;
case 5:
return 0;
break;
case 6:
return 4;
break;
case 7:
return 6;
break;
case 8:
return 2;
break;
}
return 10;
}
+145
function eval()
{
this.obj = eval(obj);
}
выкопал из сорцов игрушки...
+118
if(wordApp != null)
{
try
{
if(isNewApp && wordApp.Documents.Count == 0)
{
object arg1 = Word.WdSaveOptions.
wdDoNotSaveChanges;
object arg2 = null;
object arg3 = null;
wordApp.Quit(ref arg1, ref arg2, ref arg3);
// Wait until Word shuts down.
for(;;)
{
Thread.Sleep(100);
try
{
// When word shuts down this call
// throws an exception.
string dummy = wordApp.Version;
}
catch
{
break;
}
}
}
}
catch {}
wordApp = null;
}
Вот такой вот Dispose для ворда
http://www.codeproject.com/KB/cs/winwordloader.aspx
+162
// the next few lines do the fiddling required to make sure the data
// looks right, whether it's viewed via the RSS feed or via the database
$longpost=str_replace("<br />", "\n", $post);
$shortpost=substr($post,0,600);
$shortpost=str_replace("<br />", "\n", $shortpost);
$pass=$_POST["pass"];
if ($pass == $password) {
include "db.inc";
// this line actually inserts the data
mysql_query("INSERT INTO entries VALUES (NULL, '$title', '$post')");
$getid=mysql_query("SELECT id FROM entries WHERE title='$title'");
$myrow=mysql_fetch_array($getid);
$postid=$myrow["id"];
// from here on in, we're building the RSS feed.
$arrFp = file("rss/feed.xml");
$lines = count($arrFp);
$insertat = $lines-2;
for ($i=0; $i<$insertat; $i++) {
$rsstext=$rsstext.$arrFp[$i];
}
$rsstext=$rsstext."<item>\n";
$rsstext=$rsstext."<title>".stripslashes($title)."</title>\n";
$rsstext=$rsstext."<description>".stripslashes($shortpost);
if (strlen($shortpost)<strlen($longpost)) {
$rsstext=$rsstext."...";
}
$rsstext=$rsstext."</description>\n";
$rsstext=$rsstext."<link>$url/comment.php?post=$postid</link>\n";
$rsstext=$rsstext."</item>\n";
$rsstext=$rsstext."</channel>\n";
$rsstext=$rsstext."</rss>";
$fp=fopen("rss/feed.xml", "w");
fwrite( $fp, $rsstext );
fclose($fp);
echo "Post successfully submitted!";
} else {
echo "You are not authorised to post to this server!";
}
Создаём RSS-ленту.
+121
if (Convert.ToBoolean(ViewState["IsProgram"]) != null && Convert.ToBoolean(ViewState["IsProgram"]))
{
// do work
}
Это взорвало мой мозг...
+166
<?php
# bla bla bla...
public function __construct ($dbname, $host = null, $user = null, $pass = null) {
$numargs = func_num_args ();
if ($numargs == 1)
parent::__construct ($dbname);
else
parent::__construct ($dbname, $host = null, $user = null, $pass = null);
$this->begin = time ();
}
# bla bla bla...
"гениальный" вызов конструктора!
+130
if ((!(((constmonth == 1) && (Finalday > 31))
|| ((constmonth == 2) && (Finalyear % 4 == 0) && (Finalday > 29))
|| ((constmonth == 2) && (Finalyear % 4 != 0) && (Finalday> 28))
|| ((constmonth == 3) && (Finalday > 31))
|| ((constmonth == 4) && (Finalday > 30))
|| ((constmonth == 5) && (Finalday > 31))
|| ((constmonth == 6) && (Finalday > 30))
|| ((constmonth == 7) && (Finalday > 31))
|| ((constmonth == 8) && (Finalday > 31))
|| ((constmonth == 9) && (Finalday > 30))
|| ((constmonth == 10) && (Finalday > 31))
|| ((constmonth == 11) && (Finalday > 30))
|| ((constmonth == 12) && (Finalday > 31))))
&& ((((constmonth + 1 == 1) && (Finalday > 31))
|| ((constmonth + 1 == 2) && (Finalyear % 4 == 0) && (Finalday > 29))
|| ((constmonth + 1 == 2) && (Finalyear % 4 != 0) && (Finalday > 28))
|| ((constmonth + 1 == 3) && (Finalday > 31))
|| ((constmonth + 1 == 4) && (Finalday > 30))
|| ((constmonth + 1 == 5) && (Finalday > 31))
|| ((constmonth + 1 == 6) && (Finalday > 30))
|| ((constmonth + 1 == 7) && (Finalday > 31))
|| ((constmonth + 1 == 8) && (Finalday > 31))
|| ((constmonth + 1 == 9) && (Finalday > 30))
|| ((constmonth + 1 == 10) && (Finalday > 31))
|| ((constmonth + 1 == 11) && (Finalday > 30))
|| ((constmonth + 1 == 12) && (Finalday > 31)))))
{
if ((constmonth + 1 == 2) && (Finalyear % 4 == 0)) { Finalday = 29; }
if ((constmonth + 1 == 2) && (Finalyear % 4 != 0)) { Finalday = 28; }
switch (constmonth + 1)
{
case 1: Finalday = 31; break;
case 3: Finalday = 31; break;
case 4: Finalday = 30; break;
case 5: Finalday = 31; break;
case 6: Finalday = 30; break;
case 7: Finalday = 31; break;
case 8: Finalday = 31; break;
case 9: Finalday = 30; break;
case 10: Finalday = 31; break;
case 11: Finalday = 30; break;
case 12: Finalday = 31; break;
}
//constmonth++;
+146
$news = new news($_GET["news"]);
Обьект класса news. Выводит нужную новость в соответствии с get запросом.
+162
// юзер просит :
// "Дату выводит как записано в базе к примеру 2010-10-26 15:17:01. А мне нужно вывести Только 15:17. Как так сделать не меняя записи в базе?"
$infochat=SQLrow("select datesend, id_user, message from minichat order by datesend desc limit 0,1");
// и варианты
$exp=explode(" ", $date);
$exp=explode(":", $exp);
echo $exp[0].':'.$exp[1];
//.........
$exp=substr("$date", 11, 3);
echo $exp;
// :D
С одного форума