Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<script type="text/javascript">
function changeImg(str)
{
var e = document.getElementById('img');
e.src = str;
e.style.display = 'inline';
return true;
}
var f = '';
function set(s)
{
f = s;
}
function disableForm(s)
{
for ( var i = 0; i < s.length; i++)
{
var e = s[i];
if ( e.type == 'submit' && f != e.name)
{
e.disabled = true;
e.value = 'Изчакай...'
}
}
}
function doUpload(str)
{
if ( str.value != '' )
{
changeImg(str.value);
document.getElementById('form').submit();
}
}
</script>
<form action="<?php echo generate_url(); ?>" method="post" id="form" name="postnews" target="" enctype="multipart/form-data" onSubmit="disableForm(document.getElementById('form'));">
<input type="hidden" name="image_file" value="<?php echo $image_file; ?>">
<input type="hidden" name="post" value="1">
<table width="100%" align="left">
<tr valign="top">
<td>Заглавие:*</td>
<td><input type="text" name="title" size="35" value="<?php echo $title; ?>"><?php echo get_warning('title'); ?></td>
</tr>
<tr valign="top">
<td>Категория:*</td>
<td>
<select name="cat">
<option value="0">Избери</option>
<?php
foreach ( $cats as $k => $v)
{
$selected = ($k == $cat) ? ' selected="selected"' : '';
echo ' <option value="' . $k . '"' . $selected . '>' . $v . '</option>';
}
?>
</select><?php echo get_warning('cat'); ?>
</td>
</tr>
<tr valign="top">
<td>Информация:*</td>
<td><textarea cols="40" rows="10" name="text"><?php echo $text; ?></textarea><?php echo get_warning('information'); ?></td>
</tr>
<tr valign="top">
<td>База данни със снимки:</td>
<td>
<select name="image" size="10" style="width: 150px;" onChange="changeImg('<?php echo $images_path; ?>/' +this.options[this.selectedIndex].value);">
<?php
for ( $i = 0; $i < $total_images; ++$i)
{
$image_ = $images[$i];
$selected = ($image == $image_['image']) ? ' selected="selected"' : '';
echo ' <option value="' . $image_['image'] . '"' . $selected .'>' . $image_['title'] . '</option>' . "\n";
}
?>
</select>
<img src="<?php echo ($image_file) ? $images_path . '/' . $image_file : '#"; style="display: none;';?>" border="0" width="50px" alt="Преглед" title="Преглед" onerror="this.style.display = 'none';" height="50px" id="img">
</td>
</tr>
<tr valign="top">
<td>Прикачи снимка:</td>
<td>
<label>
<input type="file" name="message_image" onChange="JavaScript: doUpload(this);" size="40">
<br><?php echo ($upload_image_max_size > 0) ? sprintf('Снимка към новината максимален размер е %u', $upload_image_max_size) : '';echo get_warning('image');?>
</td>
</tr>
<tr valign="top">
<td>Източник:</td>
<td>
<label>
<input type="text" name="source" value="<?php echo $source; ?>" size="35">
<br>Ако новината е преписана от друг сайт моля въведете сайтът.<?php echo get_warning('source'); ?>
</label>
</td>
</tr>
<?php
if ( ($total = sizeof($files)) )
{
?>
<tr valign="top">
<td>Прикачени файлове:</td>
<td>
<?php
for ($i = 0; $i < $total; ++$i)
{
$info = $files[$i];
if (!isset($info['attach_id']))
{
continue;
}
?>
<input type="hidden" name="attachments[<?php echo $i; ?>][attach_id]" value="<?php echo $info['attach_id']; ?>">
<input type="hidden" name="attachments[<?php echo $i; ?>][filename]" value="<?php echo $info['filename']; ?>">
<div><?php echo $info['filename']; ?>
<input type="submit" name="remove_attach[<?php echo $i; ?>]" onClick="set(this.name);" value="Изтрий">
</div>
<div>
<label>
Коментар:<br>
<textarea name="attachments[<?php echo $i; ?>][attach_comment]" rows="3" cols="40"><?php echo $info['attach_comment']; ?></textarea>
</label>
</div>
<?php
}
unset($files, $info);
}
?>
</tr>
<tr valign="top">
<td valign="top">Прикачи файл:</td>
<td>
<label>
<input type="file" name="attachment" size="40">
<br><?php echo config('attachments_max_filesize') ? 'Прикачи файл към новината максимален размер е ' . format_size(config('attachments_max_filesize')) : ''; echo get_warning('attachment');?>
</label>
<div>
<label>
Коментар<br>
<textarea name="attach_comment" rows="3" cols="40"></textarea>
</label>
</div>
</td>
</tr>
<tr align="center">
<td>Опций</td>
<td>
<div align="left">
<label><input type="checkbox" name="allow_bbcode" <?php echo ($allow_bbcode) ? 'checked="checked"' : ''; ?> value="1">Включи BBCODE</label>
<br>
<label><input type="checkbox" name="allow_smilies" <?php echo ($allow_smilies) ? 'checked="checked"' : ''; ?> value="1">Включи осмивки</label>
<br>
<label><input type="checkbox" name="allow_autolinks" <?php echo ($allow_autolinks) ? 'checked="checked"' : ''; ?> value="1">Включи автоматични линкове</label>
<?php
if ( $image_file )
{
?>
<br>
<label><input type="checkbox" name="delete_image" value="1">Изтрий снимката</label>
<?php
}
?>
</div>
</td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" id="submita" name="submit" value="Запиши" size="35"></td>
</tr>
</table>
</form>
Въвеждаш в полето нещо, и то се извежда в сайта.<html>
<head>
<title></title>
<script type="text/javascript">
function doUpload(x)
{
var myField = document.getElementById(x);
var myForm = document.getElementById('form');
if(myField.value != "")
{
myForm.submit();
}
}
</script>
</head>
<body>
<?php
if(isset($_POST['name']))
{
$name = $_POST['name'];
echo "Your name is: ".$name;
}
else
{
?>
<form method="post" accept="" id="form">
<input type="text" name="name" onchange ="javascript:doUpload(this.id)" id="name" />
<input type="submit" name="send" value="Send" />
</form>
<?php
}
?>
</body>
</html>