- 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
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
<?php
$month_cols = array("january" => 31,
"february" => 28,
"march" => 31,
"april" => 30,
"may" => 31,
"june" => 30,
"july" => 31,
"august" => 31,
"september" => 30,
"october" => 31,
"november" => 30,
"december" => 31);
if($_POST["month_to_change"])
{
$month_to = $_POST["month_to_change"];
for($i = 1; $i <= $month_cols[$_POST["month_to_change"]]; $i++)
{
$description = mysql_real_escape_string($_POST["textar_".$i]);
mysql_query("UPDATE `calender` SET `description` = '$description' WHERE `day` = '$i' AND `month` = '$month_to' LIMIT 1");
}
}
echo "<h3>Лунный календарь</h3>";
if($_POST["month_change"])
{
if($_POST["month"] == "january") $jan_sel = "selected";
if($_POST["month"] == "february") $feb_sel = "selected";
if($_POST["month"] == "march") $mar_sel = "selected";
if($_POST["month"] == "april") $apr_sel = "selected";
if($_POST["month"] == "may") $may_sel = "selected";
if($_POST["month"] == "june") $jun_sel = "selected";
if($_POST["month"] == "july") $jul_sel = "selected";
if($_POST["month"] == "august") $aug_sel = "selected";
if($_POST["month"] == "september") $sep_sel = "selected";
if($_POST["month"] == "october") $oct_sel = "selected";
if($_POST["month"] == "november") $nov_sel = "selected";
if($_POST["month"] == "december") $dec_sel = "selected";
}
else
{
$jan_sel = "selected";
}
$changing_month = $_POST["month"];
if($changing_month == "") $changing_month = "january";
echo "<table>\n";
echo "<tr><td>\n";
echo "<form name=\"form_name\" id=\"form_id\" action=\"\" method=\"post\">\n";
echo "<select name=\"month\" onChange=\"this.form.submit()\">\n
<option value=\"january\" $jan_sel>Январь</option>\n
<option value=\"february\" $feb_sel>Февраль</option>\n
<option value=\"march\" $mar_sel>Март</option>\n
<option value=\"april\" $apr_sel>Апрель</option>\n
<option value=\"may\" $may_sel>Май</option>\n
<option value=\"june\" $jun_sel>Июнь</option>\n
<option value=\"july\" $jul_sel>Июль</option>\n
<option value=\"august\" $aug_sel>Август</option>\n
<option value=\"september\" $sep_sel>Сентябрь</option>\n
<option value=\"october\" $oct_sel>Октябрь</option>\n
<option value=\"november\" $nov_sel>Ноябрь</option>\n
<option value=\"december\" $dec_sel>Декабрь</option>\n
</select>\n";
echo "<input type=\"hidden\" name=\"month_change\" value=\"change\">\n";
echo "</td></tr>\n";
for($i = 1; $i <= $month_cols[$changing_month]; $i++)
{
$q_q2 = mysql_query("SELECT `description` FROM `calender` WHERE `day` = '$i' AND `month` = '$changing_month' LIMIT 1");
$descr = mysql_fetch_row($q_q2);
echo "<tr valign=\"top\" cols=\"5\">
<td><b>$i</b></td>
<td>
<textarea name=\"textar_$i\">".$descr[0]."</textarea>
</td>
</tr>\n";
}
echo "<tr>
<td colspan=\"2\" align=\"right\">
<input type=\"submit\" value=\"Сохранить\">
</td>
</tr>\n";
echo "<input type=\"hidden\" name=\"month_to_change\" value=\"$changing_month\">\n";
echo "</form>";
echo "</table>";
?>
dew2 22.01.2011 21:54 # +6
if($_POST["month"] == "january") $jan_sel = "selected";
...
- массивы? не, не слышал!
echo "<select name=\"month\" onChange=\"this.form.submit()\">\n
<option value=\"january\" $jan_sel>Январь</option>\n
-циклы? не, не слышал!
$month_to = $_POST["month_to_change"];
-sql-injection? не, не слышал!!!
wmmorgun 23.01.2011 02:21 # +1
varg242 23.01.2011 08:30 # 0
Lure Of Chaos 24.01.2011 14:04 # 0
guest 24.01.2011 17:56 # 0
guest 24.01.2011 17:56 # 0
varg242 23.01.2011 08:30 # −1
закрыто .htaccess, и если и не .htaccess, то по-любому пошлёт нахуй, если не залогинен. это часть кода.
Int 23.01.2011 14:14 # 0
Lure Of Chaos 24.01.2011 14:04 # 0
а еще не слышал, что через echo не нужно html выводить
bugmenot 23.01.2011 02:22 # +2
Lure Of Chaos 24.01.2011 14:05 # 0
RaZeR 28.01.2011 15:13 # 0