- 1
//так как в mysql есть ограничение на джойны (61), делаем следующим образом:...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+175
//так как в mysql есть ограничение на джойны (61), делаем следующим образом:...
−162
>>> mylist = [3,5,8,5,3,12]
>>> print dict().fromkeys(mylist).keys()
[8, 3, 12, 5]
"Getting rid of duplicate items in a list" типа способ убрать дубликаты в списке
+162
function SplitStr($V){
$ab=explode(' ',$V);
$V='';
foreach($ab as $a){
$a=substr($a,0,50).' '.substr($a,50,50).' '.substr($a,100,50).' '.substr($a,150,50).' '.substr($a,200,50).' '.substr($a,250,50).' '.substr($a,300,50).' '.substr($a,350,50);
$V.=$a.' ';
}
while(strpos($V, " ")){
$V = str_replace(" ", " ", $V);
}
return $V;
}
Регулярные выражения? Это что и зачем?
+162
$m=explode(";",$lang[nomarriage]);
foreach($m as $k=>$mm) {
if($lev[$k]==$o[marriage]) {
if(eregi('/',$mm)) {
$mm2=explode('/',$mm);
if($o[gender2]=='m') {
$o[marriage]=$mm2[0];
}
else {
$o[marriage]=$mm2[1];
}
}
else $o[marriage]=$mm;
}
}
Автор неизвестен.
"Мы не ищем легких путей!"
+165
<?php
#-----------------------------------------------------#
# ********* ROTORCMS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
# для его дальнейшего распространения #
#-----------------------------------------------------#
require_once ('includes/start.php');
require_once ('includes/functions.php');
require_once ('includes/header.php');
include_once ('themes/' . $config['themes'] . '/index.php');
if (empty($_GET['p'])) {
include_once (BASEDIR . 'includes/info.php');
include_once (DATADIR . 'main/index_head.dat');
include_once (DATADIR . 'main/begin.dat');
include_once (DATADIR . 'main/index.dat');
include_once (DATADIR . 'main/index_foot.dat');
} else {
if (empty($_GET['f'])) {
$_GET['f'] = 'index';
}
if (preg_match('|^[a-z0-9_\-]+$|i', $_GET['p']) && preg_match('|^[a-z0-9_\-]+$|i', $_GET['f'])) {
if (file_exists('files/' . $_GET['p'] . '/' . $_GET['f'] . '.' . $config['ras'])) {
include_once ('files/' . $_GET['p'] . '/' . $_GET['f'] . '.' . $config['ras']);
} else {
show_error('Ошибка! Файл с данными параметрами не найден!');
}
} else {
show_error('Ошибка! Недопустимое название страницы!');
}
echo '<img src="' . BASEDIR . 'images/img/act_home.gif" alt="image" /> <a href="' . BASEDIR . 'index.php?' . SID . '">На главную</a>';
}
include_once ('themes/' . $config['themes'] . '/foot.php');
?>
Представляем вашему вниманию первую версию движка RotorCMS!!!
p.s. Угадайте где здесь говнокод?)
+167
$url=$_SERVER['QUERY_STRING'];
parse_str($url, $out);
@$tbname=$out['tbname'];
@$pname=$out['pname'];
@$sub=$out['sub'];
http://forum.php.su/topic.php?forum=60&topic=1371#1281343178
А как ВЫ принимаете параметры запроса?
+144
static void Main(string[] args)
{
int[,] mas = new int[5, 5];
Random rnd = new Random();
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
mas[i, j] = rnd.Next(0, 100);
Console.Write(mas[i, j] + "\t");
}
Console.WriteLine();
}
}
+111
string filename = "pasker_ltd.xls";
string ConnectionString = String.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Extended Properties=Excel 8.0;", filename);
DataSet ds = new DataSet("EXCEL");
OleDbConnection cn = new OleDbConnection(ConnectionString);
cn.Open();
DataTable schemaTable =cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[] { null, null, null, "TABLE" });
string sheet1 = (string)schemaTable.Rows[0].ItemArray[2];
string select = String.Format("SELECT * FROM [{0}]", sheet1);
OleDbDataAdapter ad = new OleDbDataAdapter(select, cn);
ad.Fill(ds);
DataTable tb = ds.Tables[0];
dataGridView1.DataSource = tb;
+104
int x = 1, z = ++x + x;
Console.WriteLine (x.ToString () + " " + z.ToString ());
x = 1;
int z1 = x + ++x;
Console.WriteLine (x.ToString () + " " + z1.ToString ());
Вот такой код
+171
include('conf.php');
$domen=strip_tags($_POST['domain']);
$descr=strip_tags($_POST['descr']);
$admin=strip_tags($_POST['admin']);
$tech=strip_tags($_POST['tech']);
$nserver1=strip_tags($_POST['nserver1']);
$nserver2=strip_tags($_POST['nserver2']);
$mail=strip_tags($_POST['changed']);
$submit=strip_tags($_POST['s']);
if($_POST['s']){
$simbol='|[^a-z0-9-]|i'; if(!preg_match($simbol, $domen)) {
if($domen){
if($descr){
if($admin){
if($tech){
if($nserver1){
if($nserver2){
if($mail){if (preg_match("|[0-9a-z^_]+@[0-9a-z_^.]+.[a-z]{2,3}|i",$mail)){
$headers = "Content-Type: text/plain; charset=windows-1251\n";
$headers .= "From: ".$_POST['changed']."\n";
$headers .= "X-Priority: 3\r\n";
$tem="ADD $domen.org.ua";
$msg ="domain: $domen.org.ua
descr: $descr
admin-c: $admin
tech-c: $tech
nserver: $nserver1
nserver: $nserver2
changed: $mail ".date("Ymd")."
source: UANIC";
mail("[email protected]", "$tem", $msg, $headers);
echo "Заявка отправлена со следующими данными:<br><br>";
echo"Название домена: <strong><font color=\"#ff0000\">$domen.org.ua</font></strong><br>";
echo"Описание домена: <strong><font color=\"#ff0000\">$descr</font></strong><br>";
echo"Администратор домена: <strong><font color=\"#ff0000\">$admin</font></strong><br>";
echo"Технический контакт домена: <strong><font color=\"#ff0000\">$tech</font></strong><br>";
echo"DNS Сервер № 1: <strong><font color=\"#ff0000\">$nserver1</font></strong><br>";
echo"DNS Сервер № 1: <strong><font color=\"#ff0000\">$nserver2</font></strong><br>";
echo"Ваш E-mail: <strong><font color=\"#ff0000\">$mail</font> ".date("Ymd")."</strong><br><br>";
echo"В течении 10 минут проверьте ваш почтовый ящчик <strong><font color=\"#00ff00\">$mail</font></strong> на наличие ссылки о подтверждении регистрации доменного имени";
exit();
}else{echo "<center>$error9<br>"; include('index.html'); die;}
}else{echo "<center>$error8<br>"; include('index.html'); die;}
}else{echo "<center>$error7<br>"; include('index.html'); die;}
}else{echo "<center>$error6<br>"; include('index.html'); die;}
}else{echo "<center>$error5<br>"; include('index.html'); die;}
}else{echo "<center>$error4<br>"; include('index.html'); die;}
}else{echo "<center>$error3<br>"; include('index.html'); die;}
}else{echo "<center>$error2<br>"; include('index.html'); die;}
}else{echo "<center>$error10<br>"; include('index.html'); die;}
}else{echo "<center>$error1<br>"; include('index.html'); die;}
ящчик :D