Jump to content
php.lv forumi

ziedinjsh

Reģistrētie lietotāji
  • Posts

    789
  • Joined

  • Last visited

Everything posted by ziedinjsh

  1. query: $(function() { $("#addtopic").click(function() { var name = $("#name").val(); var title = $("#title").val(); var description = $("#description").val(); var content = $("#content").val(); var dataString = 'name='+ name + '&title='+ title + '&description'+ description + '&content'+ content; if(name=='' || title=='' || description=='' || content=='') { $('.success').fadeOut(500).hide(); $('.error').fadeOut(500).show(); } else { $.ajax({ type: "POST", url: "misc/addtopic.php", data: dataString, success: function(){ $('.success').fadeIn(500).show(); $('.error').fadeOut(500).hide(); $('#name').fadeOut(600).val(''); $('#title').fadeOut(600).val(''); $('#description').fadeOut(600).val(''); $('#content').fadeOut(600).val(''); $('.titles').fadeOut(600).val(''); $('.button').fadeOut(600).val(''); } }); } return false; }); }); formas:" <form method='post' name='form'> <p class='titles'>Tavs segvārds</p><p style='margin:0px;padding:0px;'><input type='text' name='name' id='name' class='inputs'></p> <p class='titles'>Tēmas nosukums</p><p style='margin:0px;padding:0px;'><input type='text' name='title' id='title' class='inputs'></p> <p class='titles'>Tēmas apraksts</p><p style='margin:0px;padding:0px;'><input type='text' name='description' id='description' class='inputs'></p> <p class='titles'>Tēmas saturs</p><p style='margin:0px;padding:0px;'><textarea name='content' id='content' class='inputs2'></textarea></p> <span class='error' style='display:none;color:red;text-align:center;'><h3>Kāds no lauciņiem ir palicis tukš.</h3></span> <span class='success' style='display:none;color:green;text-align:center;'><h3>Paldies, tēma ir pievienota!</h3></span> <p style='margin:0px;padding:0px;text-align:center;margin-bottom:10px;'><input type='submit' value='Pievienot' id='addtopic' class='button'></p> </form> addtopic.php: $name = mysql_real_escape_string($_POST['name']); $title = mysql_real_escape_string($_POST['title']); $description = mysql_real_escape_string($_POST['description']); $content = mysql_real_escape_string($_POST['content']); $date = date("Y-m-d H:i:s"); $add = mysql_query("INSERT INTO topics (name, title, description, content, date) VALUES ('$name', '$title', '$description', '$content', '$date')") or die(mysql_error()); iekš datubāzēs pievienot tikai name, title un date, bet description un content netiek pievienosts! kapēc tā!?
  2. tapēc, ka atradu kā to dabūt gatavu :p
  3. Sveiki! Kā pareizi ievadīt textus datubāzē UTF-8 formātā? mysql_query("INSERT INTO topics (name, title, description, content, date) VALUES ('$name', '$title', '$description', '$content', '$date')") or die(mysql_error()); tagad izkārtojums man iekš datubāzes ir utf8_unicode_ci bet skatoties uz ievadītajiem datiem iekš datubāzes tabulā, garumzīmes un pārējie tādi ir ķeburi! kā to mainīt?
  4. nu kā header.php atrodas: <script type="text/javascript"> $ = function($title) { return document.getElementById($title); } function showContent() { $('loading').style.display = 'none'; $('content').style.display = 'block'; } </script> iekš misc/func.php function opendiv($title){ echo "<div id='loading'><center><img src='misc/loader.gif'></center></div>"; echo "<div id='content'>"; } function closediv(){ echo "</div>"; } index.php ir includots gan header.php gan misc/func.php tālāk ir šādi: opendiv('top'); echo "Saturs ko ielādēt 1"; closediv(); opendiv('page'); echo "Saturs ko ielādēt 2"; closediv(); Tā tad, saturs 1 ielādējas, bet saturs 2 rāda tikai loader.gif un neielādējas.
  5. bet kā var salabot šo? nomainiju arī funkcijas nosaukumu, bet vienalga neiet..
  6. tapēc,ka uz jquery un tādiem esmu uz jūs un šis ir kods kurš man strādā! :D
  7. Labsvakars.. uzdūros problēmai kurai man liekas nevajadzētu būt.. ajax kods kas atrodas header: $ = function($name) { return document.getElementById($name); } function showContent() { $('loading').style.display = 'none'; $('content').style.display = 'block'; } funkciju failā: function start($name){ echo "<div id='loading'><center><img src='misc/loader.gif'></center></div>"; echo "<div id='content'>"; } function stop(){ echo "</div>"; } index failā: start('top'); echo "kkas"; stop(); start('page'); echo "kkas"; stop(); Vajadzētu taču strādāt tam ajax kodam.. jo nesanāk 2 vienādi id vienā lapā! Bet tagad sanāk vienā vietā divi un zemākais visu laiku rāda loading.gif bildi, bet aukšējais visu ielādē kā nākas!
  8. nū, laikam nesaprati manu domu, jeb arī es nesapratu tavu.. Man jau ir nic.lv domens.. man tagad ir arī izveidots subdomens kuram es gribu uzlikt citu domenu.. ārzemēs.. piem. man tagad ir p2.nosaukums.lv šim es velos uzlikt citu domēnu piemēram p2kkas.co.cc bet tajā www.co.cc prasa name serverus
  9. ir tāda lieta, kā var dabūt name serveri kurā ir iekļauts subdomens? man ir name serveri preks www.nosaukums.lv. es grib;etu uzlikt domenu prekš šadas adreses name.nosaukums.lv kādam būtu jāizskatās name serveriem?? ja tas vispār ir iespējams
  10. es pameiģināju iekš JW player: Task Queue filed at step: Playlist could not be loaded: Playlist file did not contain a vaild playlist
  11. uzliekot uz hosta servera viss straadaa, bet localhost (wamp 2) neiet!
  12. nū iekš action scripta man ir norādīts: xml.load("songs.php"); nesparotu kā debugot to flashu lai zinātu ka tiek ielādēts playlists
  13. nūū.. mjā.. playlist ģenerātors ir šāds. songs.php: <?php header("Content-type:text/xml"); include("misc/dbase.php"); $query = mysql_query('SELECT * FROM songs WHERE type="1" ORDER BY id DESC'); $xml = "<?xml version='1.0' encoding='UTF-8'?>"; $xml .= "<xml>"; while ( $data = mysql_fetch_array ( $query ) ){ $xml .= " <song> <artist>".$data['song']."</artist> <url>mp3/".$data['song']."</url> </song>"; } $xml .= "</xml>"; echo $xml; ?> atverot viņu browserī smuki izvadās it kā ārā: <xml> <song> <artist>D7 - Sleepwalker.mp3</artist> <url>mp3/D7 - Sleepwalker.mp3</url> </song> <song> <artist>D7 - Changes.mp3</artist> <url>mp3/D7 - Changes.mp3</url> </song> <song> <artist>D7 - Just a Test (Go! Orginal Mix).mp3</artist> <url>mp3/D7 - Just a Test (Go! Orginal Mix).mp3</url> </song> <song> <artist>D7 - They Need Space.mp3</artist> <url>mp3/D7 - They Need Space.mp3</url> </song> <song> <artist>D7 - Will Never Be The Same.mp3</artist> <url>mp3/D7 - Will Never Be The Same.mp3</url> </song> </xml> Bet palyerī vienalga neskan! kas pa vainu?
  14. acīm redzot jau nē, bet kā viņu pareizi izveidot?
  15. pēc pamācības uztaisīju flash playeri. šeit ir action scripts: // Setup sound object var s:Sound = new Sound(); s.onSoundComplete = playSong; s.setVolume(75); // Array of songs var sa:Array = new Array(); // Currently playing song var cps:Number = -1; // Position of music var pos:Number; // Load the songs XML var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function() { var nodes:Array = this.firstChild.childNodes; for(var i=0;i<nodes.length;i++) { sa.push(new Song(nodes[i].attributes.url, nodes[i].attributes.artist, nodes[i].attributes.track)); } playSong(); } xml.load("songs.xml"); // Play the MP3 File function playSong():Void { s = new Sound(); s.onSoundComplete = playSong; s.setVolume(75); mute.gotoAndStop("on"); if(cps == sa.length - 1) { cps = 0; s.loadSound(sa[cps].earl, true); } else { s.loadSound(sa[++cps].earl, true); } trackInfo.text = sa[cps].artist + " - " + sa[cps].track; playPause.gotoAndStop("pause"); textPos = 0; } // Pauses the music function pauseIt():Void { pos = s.position; s.stop(); } // Pauses the music function unPauseIt():Void { s.start(pos/1000); } // Music Controls // Play/Pause Toggle playPause.onRollOver = function() { if(this._currentframe == 1) this.gotoAndStop("pauseOver"); else this.gotoAndStop("playOver"); } playPause.onRollOut = playPause.onReleaseOutside = function() { if(this._currentframe == 10) this.gotoAndStop("pause"); else this.gotoAndStop("play"); } playPause.onRelease = function() { if(this._currentframe == 10) { this.gotoAndStop("playOver"); this._parent.pauseIt(); } else { this.gotoAndStop("pauseOver"); this._parent.unPauseIt(); } } // Next Button next.onRollOver = function() { this.gotoAndStop("nextOver"); } next.onRollOut = next.onReleaseOutside = function() { this.gotoAndStop("next"); } next.onRelease = function() { this._parent.playSong(); } // Mute Button mute.onRollOver = function() { if(this._currentframe == 1) this.gotoAndStop("onOver"); else this.gotoAndStop("offOver"); } mute.onRollOut = mute.onReleaseOutside = function() { if(this._currentframe == 10) this.gotoAndStop("on"); else this.gotoAndStop("off"); } mute.onRelease = function() { if(this._currentframe == 10) { this.gotoAndStop("offOver"); s.setVolume(0); } else { this.gotoAndStop("onOver"); s.setVolume(75); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Text scroller bonus code var size:Number = 21; var textPos:Number = 0; var intervalID:Number = setInterval(scroller, 1000); function scroller():Void { var t:String = (sa[cps].artist + " - " + sa[cps].track); if(textPos+size < t.length) { textPos++; trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, textPos+size); } else { clearInterval(intervalID); intervalID = setInterval(scroller2, 1000); } } function scroller2():Void { var t:String = (sa[cps].artist + " - " + sa[cps].track); if(textPos > 0) { textPos--; trackInfo.text = (sa[cps].artist + " - " + sa[cps].track).substring(textPos, size); } else { clearInterval(intervalID); intervalID = setInterval(scroller, 1000); } } šādi ievietoju viņu lapā echo "<object width='300' height='50'>"; echo "<param name='movie' value='misc/mp3Player.swf'>"; echo "<embed src='misc/mp3Player.swf' width='300' height='50'>"; echo "</embed></object>"; un šis ir php kas ģenerē playlist include("misc/dbase.php"); $query = mysql_query('SELECT * FROM songs'); $xml = ''; while ( $data = mysql_fetch_array ( $query ) ){ $xml .= "<song>\r\n"; $xml .= '<filename>' . $data['song'] . "</filename>\r\n"; $xml .= '<artist>' . $data['author'] . "</artist>\r\n"; $xml .= '<songname>' . $data['title'] . "</songname>\r\n"; $xml .= "</song>\r\n"; } $handle = fopen('songs.xml', 'w+'); fwrite($handle, $xml); Situācija sekojoša.. plejeris nenolasa neko.. rāda undefined tur kur būtu jārāda izpildītājs un dziesmas nosaukums
  16. audio/mp3 nomainīju uz audio/mpeg
  17. nu tā man ir sanācis šitā: if(isset($_POST['addmp3'])){ $folder = "mp3/"; $title = $_POST['title']; $type = $_POST['type']; $song = $_FILES['mp3']['name']; $size = $_FILES['mp3']['size']; $tmp = $_FILES['mp3']['tmp_name']; $date = date('y.m.d'); $mp3 = $folder.basename($_FILES['mp3']['name']); if($type == "audio/mp3" || $size >167772160) { die("this format is not allowed or file is to big"); } else { $query = mysql_query("INSERT INTO songs (song, size, title, type, date) VALUES ('$song', '$size', '$title', '$type', '$date') "); move_uploaded_file($_FILES['mp3']['tmp_name'], $mp3); echo "mp3 uploaded!"; } } echo "<form method='post' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'>"; echo "<input type='text' name='title'>"; echo "<select name='type'><option value='1'>Normal</option><option value='2'>Experimental</option></select>"; echo "<input type='file' name='mp3'>"; echo "<input type='submit' name='addmp3' value='Add'>"; echo "</form>"; Bet protams mp3 fails netiek augšupielādēts.. un datubāzē size arī rāda 0 es nevaru iebraukt kas pa vainu P.S. mp3 failu nevar augšupielādēt, bet bilžu faili augšupielādējas.. kapēc tā?
  18. kaut ko bišķ jau var, bet ar šo nenodarbojos regulāri
  19. tādu kodu es internetā atradu, jo pats es īsti nemāku izveidot!
  20. šo joku if (!($mp3_type=="audio/mpeg, audio/x-mpeg, audio/mp3, audio/x-mp3, audio/mpeg3, audio/x-mpeg3, audio/mpg, audio/x-mpg, audio/x-mpegaudio")) aizvācu. Briedis enctype="multipart/form-data" neko nemainīja Array ( [title] => [type] => 1 [mp3] => D7 - Cave.mp3 [addSong] => Add song )
  21. Sveiki! Ir tāda lieta, ka nesaprotu ka pēc nevar augšupielādēt failu. if(isset($_POST['addSong'])){ $target = "mp3/"; $target = $target . basename( $_FILES['mp3']['name']) ; $ok=1; //This is size condition if ($mp3_size > 167772160) { echo "Your file is too large.<br>"; $ok=0; } //This is limit file type condition if ($mp3_type =="text/php") { echo "No PHP files<br>"; $ok=0; } //File type alowed if (!($mp3_type=="audio/mpeg, audio/x-mpeg, audio/mp3, audio/x-mp3, audio/mpeg3, audio/x-mpeg3, audio/mpg, audio/x-mpg, audio/x-mpegaudio")) { echo "You may only upload MP3 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['mp3']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['mp3file']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } } echo "<form method='POST' action='".$_SERVER['PHP_SELF']."'>"; echo "Song title <input type='text' name='title' class=''>"; echo "Type <select name='type'>"; echo "<option value='1'>Standart</option>"; echo "<option value='2'>Experimental</option>"; echo "</select>"; echo "Song file <input type='file' name='mp3' class=''>"; echo "<input type='submit' name='addSong' value='Add song' class=''>"; echo "</form>"; Kad augšupielādēju fails nav folderā un rādās sekojoš teksts:You may only upload MP3 files. Sorry your file was not uploaded. Kapēc viņš neatpazīst mp3 failu? bez file type atpazīšanas rādās šāds teksts:Sorry, there was a problem uploading your file. php.ini nomainīju augšupielādes izmēra limitu uz 200mb, nesaprotu kapēc neiet Paldies jau iepriekš!
  22. tā saliku ko vajadzēja.. tagad izlec logs, bet ievadot datus parādās: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@amn.tavsdomens.lv and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
  23. kā uzstādīts? uz servera un folderā kur viņam jābūt ir!
  24. izveidoju šādi, bet nestrādā AuthUserFile http://moe.enixns.com/home/produc/public_html/www/amn/.htpasswd AuthName "Šis nav prekš Tevis" AuthType Basic Require valid-user nick:kodetaaparole
×
×
  • Create New...