-
+159
- 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
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
<?php
session_start();
DEFINE('trusteko', true);
@$l=$_GET['l'];
//echo md5('12345');
include_once "../admin/meta.php";
include_once ("../inc/setup.php");
include_once ("../inc/config.php");
$dbc=db_connect();
if(isset($_POST['reg']))
{
$query="SELECT * FROM `access` WHERE login='".$_POST['login']."' LIMIT 1";
$result = mysql_query($query,$dbc);
$row=mysql_fetch_array($result);
if (md5($_POST['passwd'])==$row['parol'] and $_POST['login']==$row['login'])
{
$_SESSION['passwd']=$_POST['passwd'];
$_SESSION['login']=$_POST['login'];
//////////////////
include "menu_text.php";
//////////////////
}
else
{
echo "<center><form action=\"\" method=\"post\" name=\"reg\">
<table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
<tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
<tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
<tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
<tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
</table>
</form></center>";
}
}
if (isset($_SESSION['login']) and !isset($_POST['reg']))
{
$query="SELECT * FROM `access` WHERE login='".$_SESSION['login']."' LIMIT 1";
$result = mysql_query($query,$dbc);
$row=mysql_fetch_array($result);
if (md5($_SESSION['passwd'])==$row['parol'] and $_SESSION['login']==$row['login'])
{
//////////////////
include "menu_text.php";
//////////////////
}
}
if (!isset($_SESSION['login']) and !isset($_POST['reg']))
{
echo "<center><form action=\"\" method=\"post\" name=\"reg\">
<table style=\"width:400px; height:50px;border:1px;\" align=\"center\">
<tr><td colspan=\"2\" style=\"text-align:center\">Авторизация</td></tr>
<tr><td>Login:</td><td><input type=\"text\" name=\"login\"></td></tr>
<tr><td>Password:</td><td><input type=\"password\" name=\"passwd\"></td></tr>
<tr><Td colspan=\"2\"><input type=\"submit\" name=\"reg\" value=\"Вход\"></td></tr>
</table>
</form></center>";
}
?>
Мое, этому коду 2 года )
Веселая система авторизации.
Разумеется я так уже не пишу ;)
topilnik,
12 Марта 2011
-
+134
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
$i=10000;
while(true)
{
$i--;
if ($i==0) break;
// Какойто код с $i
}
Выкопал в одном серьезном проекте. Так там что не цикл так while(true) c точками выхода по телу цикла..
Vasiliy,
12 Марта 2011
-
+166
- 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
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
<?php
if (!isset($_REQUEST['page'])&&!isset($_REQUEST['story']))
{
header('Location: index.php');
exit;
}
$page = $_REQUEST['page'];
$story = intval($_REQUEST['story']);
include_once('db_fns.php');
include_once('header.php');
$handle = db_connect();
if($story)
{
$query = "select * from stories
where id = '$story' and
published is not null";
}
else
{
$query = "select * from stories
where page = '$page' and
published is not null
order by published desc";
}
$result = $handle->query($query);
while ($story = $result->fetch_assoc())
{
// headline
echo "<h2>{$story['headline']}</h2>";
//picture
if ($story['picture'])
{
echo '<div style="float:right; margin:0px 0px 6px 6px;">';
echo '<img src="resize_image.php?image=';
echo urlencode($story[picture]);
echo '&max_width=200&max_height=120" align = right/></div>';
}
// byline
$w = get_writer_record($story['writer']);
echo '<br /><p class="byline">';
echo $w[full_name].', ';
echo date('M d, H:i', $story['modified']);
echo '</p>';
// main text
echo $story['story_text'];
}
include_once('footer.php');
?>
Там еще много такого говнеца
http://www.ibm.com/developerworks/ru/library/l-php_mysql_10/index.html?S_TACT=105AGX99&S_CMP=GR01
На ЛОРе обсуждают http://www.linux.org.ru/news/doc/6002642
rO_ot,
12 Марта 2011
-
−94
- 1
- 2
mCharInfoContent.x += ( hexTile.x + hexTile.parent.x + hexTile.parent.parent.x + hexTile.parent.parent.parent.x );
mCharInfoContent.y += ( hexTile.y + hexTile.parent.y + hexTile.parent.parent.y + hexTile.parent.parent.parent.y );
Красота неописуемая, метод научного тыка в действии
Werdn,
11 Марта 2011
-
+161
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
<?
$result = mysql_query("SELECT date, article, post_text FROM posts");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
echo "<div class=\"block\">\n\t<span class=\"da_ar\" id=\"left\">\n\t\t".$row[0]."\n\t</span>\n\t<span class=\"da_ar\" id=\"right\">\n\t\t".$row[1]."\n\t</span>\n\t<div class=\"block_text\"><pre>\n".$row[2]."</pre>\n\t</div>\n</div>";
}
mysql_free_result($result);
?>
Да - да - да, все это в одну строчку...
Не совсем, конечно, говно, но все же:)
AlexT,
11 Марта 2011
-
+175
- 1
- 2
- 3
// "Dedicated to the near-memory of Nev. Let's start remembering people while they're still alive."
// Nev's great contribution to dc++
while(1) break;
Вот такое можно увидеть в исходниках ядра DC++
https://github.com/negativ/eiskaltdcpp/blob/master/dcpp/DCPlusPlus.cpp#L60
gelraen,
11 Марта 2011
-
+165
- 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
function ChangePhoto(num, photo)
{
if (photo.className != 'photo_selected')
{
var image1 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image1");
var image2 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image2");
var image3 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image3");
var image4 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image4");
var image5 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image5");
var image6 = document.getElementById("ctl00_MainContent_ProductInfo1_ctl00_AlternativePictures_Image6");
if (image1 != null) image1.className = 'photo_notselected';
if (image2 != null) image2.className = 'photo_notselected';
if (image3 != null) image3.className = 'photo_notselected';
if (image4 != null) image4.className = 'photo_notselected';
if (image5 != null) image5.className = 'photo_notselected';
if (image6 != null) image6.className = 'photo_notselected';
photo.className = 'photo_selected';
Hide(0);
setTimeout("ChangeSrc("+num+")", 300);
setTimeout("ShowPhoto()", 400);
}
}
Чо мне ща сказал? Цыклы мне ща сказал? Какие тенна цыклы, ыдисюданна!
Строчки 22, 23 активируют какое-то хитрожопое многопоточное отображение фоток со взаимными блокировками и ожиданием друг друга по таймеру с интервалами в 10 мс.
telnet,
11 Марта 2011
-
+76
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
//skipped
b1 = new JButton("Disable middle button", leftButtonIcon);
b1.setVerticalTextPosition(AbstractButton.CENTER);
b1.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales
b1.setMnemonic(KeyEvent.VK_D);
b1.setActionCommand("disable");
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
if ("disable".equals(e.getActionCommand())) {
b2.setEnabled(false);
b1.setEnabled(false);
b3.setEnabled(true);
} else {
b2.setEnabled(true);
b1.setEnabled(true);
b3.setEnabled(false);
}
из мануала на oracle.com. Что действительно так нужно обрабатывать события?
KoirN,
11 Марта 2011
-
+154
- 1
- 2
- 3
- 4
if (request->status().is_success() &&
(request->GetResponseCode() / 100) == 2) {
/* блаблабла */
}
Было случайно откопано в исходниках хромиума (http://src.chromium.org/svn/trunk/src/webkit/appcache/appcache_update_job.cc). И первый вопрос который возникает это "Ну вот нахера???".
POPSuL,
11 Марта 2011
-
+169
паццтолом
paranoid,
11 Марта 2011