"PHP" / Говнокод #662 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
<?php
//Данные на базу
$lnk = mysql_connect('localhost', 'mysql_user', 'mysql_password')
       or die ('Not connected : ' . mysql_error());
mysql_select_db('primecms_db', $lnk) or die ('Can\'t primecms_db foo : ' . mysql_error());


class insert{
	var $pid, $alias, $text, $position, $status, $create_time, $modify_time;
}

function con_in($alias, $text_en, $text_ru, $text_descr){
	$res = new insert;
	$res->pid=1;
	$res->alias=addslashes($alias);
	$res->text='<p>'.addslashes($text_en).'</p>\r\n<p>'.addslashes($text_ru).'</p>\r\n<p>'.addslashes($text_descr).'</p>';
	$res->position=0;
	$res->status=1;
	$res->create_time=time();
	$res->modify_time=time();
	return $res;
}

if ($_POST['send']){
	$con =  con_in($_POST['alias'],$_POST['text_en'],$_POST['text_ru'],$_POST['text_descr']);
	mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `create_time`, `modify_time`) VALUES (".$con->pid.",'".$con->alias."','".$con->text."',".$con->position.",".$con->status.",".$con->create_time.",".$con->modify_time.")");
}
?>

<form name="" action="" method="post">
Alias<input name="alias" size=30  type="text" value=""><br />
text_en<input name="text_en" size=30 type="text" value=""><br />
text_ru<input name="text_ru" size=30  type="text" value=""><br />
text decr<textarea name="text_descr" rows=7 cols=50 wrap="off"></textarea><br />
<input type="submit" value="Send" name="send"><br />
</form>

не забываем править
//Данные на базу

Запостил: guest guest, (Updated )

Комментарии (1) RSS

  • easytobusy:
    прогллядел... вот это "`id`, " надо убрать из строчки
    "mysql_query("INSERT INTO e118_glossary_items (`id`, `pid`, `alias`, `text`, `position`, `status`, `crea......"
    Ответить

Добавить комментарий

Помни, guest, за тобой могут следить!

    А не использовать ли нам bbcode?


    8