Jump to content

2php Scripti In 1.


DST
 Share

Recommended Posts

Te ir mans skripts kurs liek muuzikas uz db.

Bet man vjg vinam klaata pielikt veel klaat upload skriptu.

Skripts kas suuta datus uz db

if($_GET['go'] == 'add_music')
{
if($_POST['pievienot_muz'])
{
$nosaukums = quote_smart($_POST['nosaukums']);
$koments = quote_smart($_POST['koments']);
$title = quote_smart($_POST['title']);
$artist = quote_smart($_POST['artist']);
$quality = quote_smart($_POST['quality']);
$size = quote_smart($_POST['size']);
$duration = quote_smart($_POST['duration']);
$links = quote_smart($_POST['links']);
$nosaukums = quote_smart($_POST['nosaukums']);
$bilde = quote_smart($_POST['bilde']);

$pievienot_muz = mysql_query("INSERT INTO club (koments, size, links, artist, quality, duration, nosaukums, bilde) VALUES ($koments, $size, $links, $artist, $quality, $duration, $nosaukums, $bilde)") or die(mysql_error());
echo "Muzika pievienots!";
echo '<meta http-equiv=refresh content="1;url=?m=admins">';
}
else
{
?>
<a id="various3" href="http://google.ca">Iframe</a>
<?
echo '









<form method="post" class="clearvideo"><div id="titleNew">Pievienot Mūziku.</div><br /><br />
<table style="float:left">
<tr><td>Nosaukums:</td><td><input type="text" name="nosaukums" /></td></tr>
<tr><td>Links: (http://)</td><td><input type="text" name="links" /></td></tr>
<tr><td>Title:</td><td><input type="text" name="title" /></td></tr>
<tr><td>Artist:</td><td><input type="text" name="artist" /></td></tr>
<tr><td>Quality:</td><td><input type="text" name="quality" /></td></tr>
<tr><td>Size:</td><td><input type="text" name="size" /></td></tr>
<tr><td>Duration:</td><td><input type="text" name="duration" /></td></tr>
<tr><td>Bilde:</td><td><input type="text" name="bilde" /></td></tr>
<tr><td>Komentārs:</td><td><textarea name="koments"></textarea></td></tr>
<tr><td></td><td><input type="submit" name="pievienot_muz" /></td></tr>

</table>
</form><div id="musicAdd">     Isa pamāciba.

<br />  Veel tapsanas stadijaa. :)<br /><br /><br /><br />
</div>';
}
}

Upload skripts.

<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']);
$ok=1;

//This is our size condition
if ($uploaded_size > 350000)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

Vinu vajadzeetu ielikt tur kur ir links bet blakaam kad var izveleties failu un augsuplaadeet

aa un rekur forma veel.

<form enctype="multipart/form-data" action="upload.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...