-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
//код компилируйте clang-ом, иначе не закомпилится
int main(int argc, char *argv[])
{
if(argc != 2) {
printf("Укажите способ (1,2)\n");
_exit(1);
}
int способ = atoi(argv[1]);
int ch;
switch(способ)
{
case 1:
{
while( (ch=getchar()) != EOF ) {
printf("%i", ch);
}
break;
}
case 2:
{
int twoch;
char arr[2];
int new;
while( (ch=getchar()) != EOF ) {
twoch = getchar();
if(twoch == EOF) break;
sprintf(arr, "%c%c", (char)ch, (char)twoch);
new = atoi(arr);
printf("%c", new); //попытка не пытка
}
break;
}
default:
printf("Неизвестный способ\n");
}
return 0;
}
без слов
KoderOT-Boga,
17 Октября 2017
-
−3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
#include <stdio.h>
int main(int argc, char *argv[])
{
int ch;
while( (ch=getchar()) != EOF ) {
ch+=77;
putchar(ch);
}
return 0;
}
вот и зашифровка
KoderOT-Boga,
17 Октября 2017
-
−2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
#include <stdio.h>
int main(int argc, char *argv[])
{
int ch;
while( (ch=getchar()) != EOF ) {
ch-=77;
putchar(ch);
}
return 0;
}
расшифровка
KoderOT-Boga,
17 Октября 2017
-
−1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
<?php
$f = fopen('comments', 'a');
$name = htmlspecialchars($_POST['name']);
if( strlen($name)<8 || strlen($name)>40 ) #из-за русских символов умножаем на два
exit("Имя должно иметь длину от 4 до 20 символов!");
$msg = htmlspecialchars($_POST['text']);
if( strlen($msg)<30 || strlen($msg)>500 )
exit("Сообщение должно иметь длину от 30 до 500 символов!");
$text = "\n#${name}\n##${msg}";
$r = fwrite($f, $text);
if($r) echo <<<TEXT
Спасибо за ваш комментарий!<br>
<a href="comments.php">Вернуться назад</a>
TEXT;
else echo 'Ошибка IO_WRITE';
fclose($f);
?>
Часть 2! Зацениваем пацаны по 100 больной шкале
KoderOT-Boga,
17 Октября 2017
-
−1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
<html>
<br>
<div style="text-align:center">
<form action="add.php" method="post">
Ваше имя: <input type="text" name="name" /><br>
Текст: <input type="text" name="text" /><br>
<input type="submit" value="Отправить"/>
</form>
</div>
<br>
<div>
<h2 style="text-align:center">Комментарии</h1>
<?php
$f = fopen("comments", "r");
if($f)
{
while(!feof($f))
{
echo '<div style="border-style:groove; margin-bottom:10px">';
$ch = fgetc($f);
if($ch = '#')
{
fgetc($f);
echo '<span style="font-weight:bold">';
echo fgets($f); //читаем имя
echo "</span><br>";
}
fgetc($f); fgetc($f);
echo fgets($f), "<br>"; //читаем комментарий
echo '</div>';
}
fclose($f);
}
else
echo "Ошибка загрузки комментариев! Свяжитесь с администратором.";
?>
</div>
</html>
Минималистичное комментирование! Часть 1
KoderOT-Boga,
17 Октября 2017
-
−1
- 1
- 2
- 3
- 4
- 5
if(keys.b && !keys.n) //ГЛЮЧИТ АЛГОРИТМ
{
if(old_ch != '\n' && ch == '\n') System.out.format("%6d ", ++line);
System.out.format("\nLINE: %d\told_ch=='%c' \t ch='%c'\n", line, old_ch, ch); //дебаг
}
Нихуя так read использовать
KoderOT-Boga,
17 Октября 2017
-
0
- 1
UPDATE `xxx` SET `updated_count` = (UPDATE `yyy` SET `zzz` = 0 WHERE `zzz` = 42)
Минимальный код в моей проблеме. Проблема в том, что UPDATE должен возвращать число изменённых строк, а MYSQL говорит, что тут ошибка. Что же мне теперь делать?
d_fomenok,
16 Октября 2017
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
include 'db.php';
$login = $_POST['login'];
$pass = $_POST['pass']);
$check = mysql_query("SELECT * FROM `users` WHERE login = '" .$login. "'");
$dbarr = mysql_fetch_array($check);
if($dbarr['pass'] != $pass) {
setcookie("wrongpass", 'yes', time() + 4, "/");
header("Location: /index.php");
return;
}
Интересный способ вывода оповещения о не верном пароле, в index.php обрабатывается cookie wrongpass, и если он есть выводится оповещение.
Lantos,
16 Октября 2017
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
#define PS *p++!=*s++ /* Body of inner unrolled matching loop. */
#define ITEMMAX 16 /* Maximum number of bytes in an expanded item. */
{const char *p_src=p_src_first;
char *p_dst=p_dst_first;
const char *p_src_post=p_src_first+src_len;
char *p_dst_post=p_dst_first+src_len;
const char *p_src_max1=p_src_post-ITEMMAX,*p_src_max16=p_src_post-16*ITEMMAX;
const char *hash[4096];
char *p_control; short int control=0,control_bits=0;
*p_dst=FLAG_COMPRESS; p_dst+=FLAG_BYTES; p_control=p_dst; p_dst+=2;
while (TRUE)
{const char *p,*s; short int unroll=16,len,index; int offset;
if (p_dst>p_dst_post) goto overrun;
if (p_src>p_src_max16)
{unroll=1;
if (p_src>p_src_max1)
{if (p_src==p_src_post) break; goto literal;}}
begin_unrolled_loop:
index=((40543*((((p_src[0]<<4)^p_src[1])<<4)^p_src[2]))>>4) & 0xFFF;
p=hash[index];
hash[index]=s=p_src;
offset=s-p;
if (offset>4095 || p<p_src_first || offset==0 || PS || PS || PS)
{literal: *p_dst++=*p_src++; control>>=1; control_bits++;}
else
{int dummyVal = PS || PS || PS || PS || PS || PS || PS ||
PS || PS || PS || PS || PS || PS || s++; len=s-p_src-1;
dummyVal = dummyVal;
*p_dst++=(char)(((offset&0xF00)>>4)+(len-1)); *p_dst++=(char)(offset&0xFF);
p_src+=len; control=(control>>1)|0x8000; control_bits++;}
/*end_unrolled_loop:*/ if (--unroll) goto begin_unrolled_loop;
if (control_bits==16)
{*p_control=control&0xFF; *(p_control+1)=control>>8;
p_control=p_dst; p_dst+=2; control=control_bits=0;}
}
control>>=16-control_bits;
*p_control++=control&0xFF; *p_control++=control>>8;
if (p_control==p_dst) p_dst-=2;
*p_dst_len=(p_dst-p_dst_first);
return;
overrun: fast_copy(p_src_first,p_dst_first+FLAG_BYTES,src_len);
*p_dst_first=FLAG_COPY; *p_dst_len=src_len+FLAG_BYTES;
Красота в одном из методов кода одной MMO игры)
Sigos,
16 Октября 2017
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
|| Bad Language.example
|| BL V2.0
U->systemVars
newVar->name('kek')->type('int32')->value(77)->reason('Hint')
U->out
This->out( systemVars->getVarInstance->byName('kek'))
U->Markers
SetMarkerHere->name('file end')->function('return 0')->handleEvalEvent( EVENTS->EVENTSLIST->GETEVENTBYNAME('JustExec')$GET)
|| Succesfull executed!
//
// PROGRAMM$Hint$14:23 -> 77,
//
Если бы я делал свой яп
Gameizeazy,
16 Октября 2017