- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
if (row[0]["IsAdmin"].ToString() == "True")
{
return true;
}
else
{
return false;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+148
if (row[0]["IsAdmin"].ToString() == "True")
{
return true;
}
else
{
return false;
}
+154
php_value error_reporting 7
AddDefaultCharset UTF-8
# CharsetDisable On
# CharsetDefault windows-1251
# CharsetSourceEnc windows-1251
# CharsetRecodeMultipartForms off
Options All -Indexes
RewriteEngine On
RewriteRule ^/?$ index.php [L]
RewriteRule ^rated/?$ index.php?act=rated_screen [L]
RewriteRule ^upload/?$ test.php?act=upload_screen [L]
RewriteRule ^settings/?$ index.php?act=settings_screen [L]
RewriteRule ^logout/?$ index.php?act=logout [L]
RewriteRule ^([0-9]+)?$ index.php?act=id_screen&id=$1 [L]
RewriteRule ^([0-9]+)/i.jpg?$ templates/direct.php?id=$1 [L]
Есть в .htaccess вот такое "RewriteRule ^upload/?$ index.php?act=upload_screen [L]" и при переходе по ссылке site.ru/upload в адресной строке появляется http://site.ru/upload/?act=upload_screen ... почему такое может быть?
+148
template<class T>
T from_string(const std::string &str)
{
std::istringstream iss(str);
T ret_val;
iss>>ret_val;
return ret_val;
}
template <class T>
std::string to_string(T val)
{
std::ostringstream oss;
oss<<val;
return oss.str();
}
template<> inline
double from_string<double>(const std::string &str)
{
return atof(str.c_str());
}
взято с http://forums.realcoding.net/lofiversion/index.php/t15556.html
конвертация строки в число/числа в строку
+152
$str.= "<div class=\"matchtour2\"><table class='maintable' align=right width=590 cellspacing=0><tr bgcolor=#56B945 style='color:white; margin:0;' class='header'><td align=center width=50><b>время</b></td><td align=center><b>событие</b></td><td width=50 align=center><b>победа<br>1</b></td><td width=50 align=center><b>ничья<br>X</b></td><td width=50 align=center><b>пoбеда<br>2</b></td><td width=50> </td></tr></table></div><br><br>";
Мечта верстальщика
+139.5
#include <iostream>
#include <deque>
#include <time.h>
using namespace std;
int arr[10][10] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define SHIPS 1
struct point{
int x, y;
};
int num = -1, count = 0;
deque<point> ship;
int way[] = {0, 0, 0, 0};
void step(){
for (int i = 0; i < 10; i++){
for (int j = 0; j < 10; j++)
cout << arr[i][j] << ' ' ;
cout << '\n';
}
cout << '\n';
if (num == ship.size()){
memset(way, 0, sizeof(way));
while(!ship.empty()){
arr[ship.front().x + 1][ship.front().y] = 7;
arr[ship.front().x + 1][ship.front().y + 1] = 7;
arr[ship.front().x][ship.front().y + 1] = 7;
arr[ship.front().x + 1][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y + 1] = 7;
arr[ship.front().x - 1][ship.front().y - 1] = 7;
arr[ship.front().x][ship.front().y - 1] = 7;
arr[ship.front().x - 1][ship.front().y] = 7;
ship.pop_front();
}
count++;
if (count == SHIPS) {
cout << "Win" << '\n';
exit(0);
}
cout << num << " was killed" << '\n';
num = -1;
}
int x, y;
point tmp;
if (ship.empty()){
x = rand()%10;
y = rand()%10;
while (arr[x][y] == 7){
x = rand()%10;
y = rand()%10;
}
if (arr[x][y] != 0 && arr[x][y] != 7){
num = arr[x][y];
tmp.x = x;
tmp.y = y;
ship.push_front(tmp);
arr[x][y] = 7;
if (x > 0) if (arr[x][y - 1] != 7) way[0] = 1;
if (y > 0) if (arr[x - 1][y] != 7) way[1] = 1;
if (x < 9) if (arr[x][y + 1] != 7) way[2] = 1;
if (y < 9) if (arr[x + 1][y] != 7) way[3] = 1;
step();
}else{
arr[x][y] = 7;
return;
}
}else{
int t = rand()%4;
while (way[t] == 0){
t = rand()%4;
}
switch(t){
case 0:
x = ship.back().x;
y = ship.back().y - 1;
if(arr[x][y] == num){
way[1] = 0;
way[3] = 0;
tmp.x = x;
tmp.y = y;
ship.push_back(tmp);
arr[x][y] = 7;
step();
}else{
arr[x][y] = 7;
way[0] = 0;
return;
}
Морской бой
+151
for($i=0; $i<count($a); $i++)
{
$b=explode("|",$a[$i]);
for($j=0; $j<count($b); $i++)
echo $b[$j] . "<hr>";
}
Часто бывает...
−90
def Auth(req, email, pwd):
try:
pass#checking ability of set cookies
except:
return error='error_of_set_cookies'
else:
if a.ValidateUsers(mail_replace_back(email),pwd)
email=Cookie.Cookie('email', CookieName)
Cookie.add_cookie(req, email)
pwd=Cookie.Cookie('pwd', CookieName)
Cookie.add_cookie(req, pwd)
return None
else:
return error='not_in_bd'
немного бесполезная Функция авторизации.
+153
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</SCRIPT>
Лёгких путей не ищем. С форума.
+143
public function some($value)
{
...
$value = $html;
return $value;
}
+150
_strlwr(buf);
if(buf[0] == '\"') strcpy(buf, &(buf[1]));
if(strstr(buf, "\""))
{
if(strrchr(buf, '\\'))
{
if(strchr(strrchr(buf, '\\'), ' '))
{
*(strchr(strrchr(buf, '\\'), ' ')) = 0;
}
}
strncpy(szPath, buf, (DWORD)strstr(buf, "\"") - (DWORD)buf);
return 0;
}
else
{
if(strrchr(buf, '\\'))
{
if(strchr(strrchr(buf, '\\'), ' '))
{
*(strchr(strrchr(buf, '\\'), ' ')) = 0;
}
}
strcpy(szPath, buf);
return 0;
}
Определение дефолтного браузера