Jump to content
php.lv forumi

ziedinjsh

Reģistrētie lietotāji
  • Posts

    789
  • Joined

  • Last visited

Posts posted by ziedinjsh

  1. tas laikam domāts ir šādi:

    
    $song = mysql_query("select * from songs order by id desc") or die(mysql_error());
    
    
    while($data = mysql_fetch_array($song)){
    $list = array(
    "mp3" => "mp3/".$data['song'],
    "title" => $data['title'],
    "artist" => $data['artist'],
    "rating" => "0",
    "duration" => $data['duration'],
    "cover" => "cover/".$data['cover']
    );
    }
    

    ??

    kāds tad izskatīšies jquery?

  2. sveiki!

    Kaut kā interesanti sanāca un nesaprotu kas pa vainu!

    lietoju html5 music player

     

    playlist viņš izmanto js failu

    myplaylist.js

    
    var myPlaylist = [
    
       {
           mp3:'mp3/1.mp3',
           title:'Sample',
           artist:'Sample',
           rating:5,
           duration:'0:30',
           cover:'mix/1.png'
       }
    ];
    

     

    tas man taka neder, jo sarakstu lasa no mysql. Izveidoju šādi

     

    playlist.js.php

    
    <?php
    include("misc/dbase.php");
    
    $songs = mysql_query("select * from songs order by id desc") or die(mysql_error());
    echo "var myPlaylist = [";
    while($data = mysql_fetch_array($songs)){
    echo "
    
       {
           mp3:'mp3/".$data['songs']."',
           title:'".$data['title']."',
           artist:'".$data['artist']."',
           rating:0,
           duration:'".$data['duration']."',
           cover:'cover/".$data['cover']."'
       },
    ";
    }
    echo "];";
    ?>
    

     

    it kā viss labi.. strādāja līdz šim brīdim kad viss vnk pazuda un viss! kapēc tā? pievienojot atpakaļ myplaylist.js tad rādās playeris, bet kad pievienoju playlist.js.php nerādās!

  3. Sveiki!

    Ir tāda lieta, ka iekš datubāzes viss saglabājas, bet song un cover netiek augšupielādēti!

    
    <?php
    include("../misc/dbase.php");
    if(isset($_POST['addsong'])){
    $mp3 = "../mp3/";
    $jpg = "../cover/";
    
    $mp3_error = mysql_real_escape_string($_FILES['song']['error']);
    $mp3_name = mysql_real_escape_string($_FILES['song']['name']);
    $mp3_tmp = mysql_real_escape_string($_FILES['song']['tmp_name']);
    
    $jpg_error = mysql_real_escape_string($_FILES['cover']['error']);
    $jpg_name = mysql_real_escape_string($_FILES['cover']['name']);
    $jpg_tmp = mysql_real_escape_string($_FILES['cover']['tmp_name']);
    
    $artist = mysql_real_escape_string($_POST['artist']);
    $title = mysql_real_escape_string($_POST['title']);
    $duration = mysql_real_escape_string($_POST['duration']);
    
    $song = $mp3.basename($mp3_name);
    $cover = $jpg.basename($jpg_name);
    
    if($mp3_error==0 || $jpg_error==0){
    move_uploaded_file($mp3_name, $song);
    move_uploaded_file($jpg_name, $cover);
    mysql_query("insert into songs (song, cover, artist, title, duration) values ('$mp3_name', '$jpg_name', '$artist', '$title', '$duration')") or die(mysql_error());
    echo "jeej";
    }else{
    echo "fuu";
    }
    }
    
    
    echo "
    <form method='post' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'>
    
    <p>Izpildītājs</p>
    <p><input type='text' name='artist'></p>
    
    <p>Nosaukums</p>
    <p><input type='text' name='title'></p>
    
    <p>Garums</p>
    <p><input type='text' name='duration'></p>
    
    <p>Bilde</p>
    <p><input type='file' name='cover'></p>
    
    <p>Dziesma</p>
    <p><input type='file' name='song'></p>
    
    <p><input type='submit' name='addsong' value='jou'></p>
    </form>
    ";
    ?>
    

     

    kapēc tā?

  4. 
    $('.video').mouseover(
      function () {
           $(this).children().fadeTo(150, 1)
      },
      function () {
           $(this).children().fadeTo(150, 0.25)
      }
    );
    

     

    
    while($data = mysql_fetch_array($video)){
    echo "
    <div id='".$data['id']."' class='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>
    <div>
    <a href='".url."video.php?do=play&id=".$data['id']."'>".$data['title']."</a>
    </div>
    </div>
    ";
    }
    }
    

     

    tagad man rādād uzreiz video nosaukums.. vajadzētu kad uzbracot ar peli uz div, tad lai rāda

  5. es laikam nesaprotu kā tās jāizdarta

    
    $(function(){
    $('#video'+ID).mouseover(function(){
    $('#videoi').fadeIn();
    });
    $('#video'+ID).mouseleave(function(){
    $('#videoi').fadeOut();
    });
    
    });  
    

     

    <div id='video".$data['id']."' class='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>
    

  6. tik tālu esmu ticis, bet netieku skaidrībā ar lietu sekojošu

    jquery

    
    $(function(){
    $('#video').mouseover(function(){
    $('#videoi').fadeIn();
    });
    $('#video').mouseleave(function(){
    $('#videoi').fadeOut();
    });
    
    });  
    

    php

    
    while($data = mysql_fetch_array($video)){
    $id = $data['id'];
    echo "
    <div id='video' style='background-image:url(http://img.youtube.com/vi/".$data['code']."/1.jpg);'>
    <div id='videoi'>
    ".$data['title']."
    </div>
    </div>
    ";
    }
    

    man viņš iefeidot tikai pirmo.. kā panākt lai viņš iefeidot katru uz kuru es uzbraucu ar pelīti!?!?

  7. kā tiek iekš header includod faces.php

    
    <?php
    function addSmilies($text) {
    
           $codesToConvert = array(
                   ':)'    =>  '<img src="'.url.'img/faces/smile.gif">',
                   ':('   =>  '<img src="'.url.'img/faces/sad.gif">',
    ';(' =>  '<img src="'.url.'img/faces/cry.gif">',
                   ':D'    =>  '<img src="'.url.'img/faces/lough.gif">',
                   ':d'    =>  '<img src="'.url.'img/faces/lough.gif">',
                   ';)'    =>  '<img src="'.url.'img/faces/blink.gif">',
                   ':P'    =>  '<img src="'.url.'img/faces/thongue.gif">',
    ':p'    =>  '<img src="'.url.'img/faces/thongue.gif">',
                   ':o'    =>  '<img src="'.url.'img/faces/scream.gif">',
                   ':O'    =>  '<img src="'.url.'img/faces/scream.gif">',
                   ':0'    =>  '<img src="'.url.'img/faces/scream.gif">',
                   ':@'    =>  '<img src="'.url.'img/faces/angry.gif">',
    ':8'    =>  '<img src="'.url.'img/faces/cool.gif">',
    ':*'    =>  '<img src="'.url.'img/faces/kiss.gif">',
                  );
    
    return (strtr($text, $codesToConvert));
    }
    ?> 
    

     

    atvert index.php viņš neredirekto uz loginu, bet kad vieņu izņem tad redirekto!, kapēc tā?

  8. logout.php ir update uz onlien='0'

     

    ja es datubāzē pie members saglabāšu last_activity = 'laiks'

     

    jāievada

    mysql_query("update mambers set last_activity='laiks' where table='sesija' ") or die(mysql_error());
    

     

    tad man online sadaļā kā jāizvada

    mysql_query("select * from members where last_activity > 'laiks' ") or die (mysql_error());
    

    ??

  9. ielogojoties lietotājam piešķir sesiju $_session['password']; ielogošanās, izlogošanās ir, kad bez aktivitātes kādu laiku tad iznīcina sesiju

    
    if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > 900)) {
      header("location:".url."logout.php");
    }
    $_SESSION['last_activity'] = time();
    

     

    tas taka strādātu, bet lieta sekojoša.. ielogojoties tiek ievadīts datubāzē pie lietotāju tabulas online='1' un izlogojoties online='0', bet tad kad last activity iznīcina sessiju tad netiek updeitota datubāze par to ka lietotājs vairāk nav online.

     

    Tad nu es domāju, vai ir kāda iespēja online saturu uztausīt tikai no sesijām? Piem. saskaita cik ir aktīvas password sesijas un tad atiecīgi izvelk no membera tabulas informāciju

     

    Paldies jau iepriekš.

  10. es te tā domāju, kā darbojās siena.. kā piemēram facebook. Rāda jaunākas aktivitātes.. viņš viņas atspoguļo pēc datuma un laika kad tiek kas veikts, bet kā viņš savāc informāciju no visām tabulām?

     

    hmm, jeb arī pie katras sql injekcijas ir vēlviena injekcija kas saglabā aktivitāti pie wall tabulas!?

  11. nu dažas rindiņas augšējās es pats ieliku

    include("misc/dbase.php");
    
    $id = isset($_GET['id'])?$_GET['id']:'';
    $data = mysql_fetch_array(mysql_query("select * from albums where id='$id'")) or die(mysql_error());
    
    $title = mysql_real_escape_string($data['title']);
    $album_id = mysql_real_escape_string($id);
    $album_dir = md5($data['title']);
    
    $targetDir = "albums/".$album_dir;
    

     

    tas es pats ieliku, bet parējais ir orģināls.. vien vienīga problēma ir pareizi ielikt šo rindiņu:

    mysql_query("insert into photos (album_id, photo) value ('$album_id', '$photo')")or die(mysql_error());
    

    es meiģināju dažās vietās.. vis sko viņš saglabā ir id un albuma id, bet bildes nosaukumu nesaglabā. vai arī $photo vieta ko citu, bet e sjau meiģināju $fileName bet nekā!

  12. nu tā.. uzstādīju to pupload.. it kā viss būtu jauki, bet ir viena sekojoša lieta.. es nesaprotu kur man ir jāieliek mysql_query("insert into photos ..."); lai man saglabātos filename

     

    
    <?php
    include("misc/dbase.php");
    
    @set_time_limit(5 * 60);
    
    
    $id = isset($_GET['id'])?$_GET['id']:'';
    $data = mysql_fetch_array(mysql_query("select * from albums where id='$id'")) or die(mysql_error());
    
    $title = mysql_real_escape_string($data['title']);
    $album_id = mysql_real_escape_string($id);
    $album_dir = md5($data['title']);
    
    $targetDir = "albums/".$album_dir;
    
    $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
    $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
    $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
    
    $fileName = preg_replace('/[^\w\._]+/', '', $fileName);
    
    if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) {
    $ext = strrpos($fileName, '.');
    $fileName_a = substr($fileName, 0, $ext);
    $fileName_b = substr($fileName, $ext);
    
    $count = 1;
    while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName_a . '_' . $count . $fileName_b))
    $count++;
    
    $fileName = $fileName_a . '_' . $count . $fileName_b;
    
    }
    
    if (!file_exists($targetDir))
    @mkdir($targetDir);
    
    // Look for the content type header
    if (isset($_SERVER["HTTP_CONTENT_TYPE"]))
    $contentType = $_SERVER["HTTP_CONTENT_TYPE"];
    
    if (isset($_SERVER["CONTENT_TYPE"]))
    $contentType = $_SERVER["CONTENT_TYPE"];
    
    // Handle non multipart uploads older WebKit versions didn't support multipart in HTML5
    if (strpos($contentType, "multipart") !== false) {
    if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) {
    // Open temp file
    $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
    if ($out) {
    // Read binary input stream and append it to temp file
    $in = fopen($_FILES['file']['tmp_name'], "rb");
    if ($in) {
    while ($buff = fread($in, 4096))
    fwrite($out, $buff);
    } else
    die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    fclose($in);
    fclose($out);
    @unlink($_FILES['file']['tmp_name']);
    } else
    die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    } else
    die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}');
    } else {
    // Open temp file
    $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab");
    if ($out) {
    // Read binary input stream and append it to temp file
    $in = fopen("php://input", "rb");
    
    if ($in) {
    while ($buff = fread($in, 4096))
    fwrite($out, $buff);
    } else
    die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
    
    fclose($in);
    fclose($out);
    } else
    die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    }
    
    // Return JSON-RPC response
    
    die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
    
    ?>
    

  13. Lejupielādēju un izķidāju swfupload. Vēlos augšupielādēt līdz 10 bildēm vienā laikā.

     

    tā tad head liekamais kods ir:

    
    var swfu;
    
    SWFUpload.onload = function () {
    var settings = {
    flash_url : "misc/swfupload.swf",
    upload_url: "upload_photo.php",
    file_size_limit : "10 MB",
    file_types : "*.jpg",
    file_types_description : "Bildes",
    file_upload_limit : 10,
    file_queue_limit : 0,
    custom_settings : {
    progressTarget : "fsUploadProgress",
    cancelButtonId : "btnCancel"
    },
    debug: false,
    
    // Button Settings
    button_placeholder_id : "spanButtonPlaceholder",
    button_width: 61,
    button_height: 22,
    button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
    button_cursor: SWFUpload.CURSOR.HAND,
    
    // The event handler functions are defined in handlers.js
    swfupload_loaded_handler : swfUploadLoaded,
    file_queued_handler : fileQueued,
    file_queue_error_handler : fileQueueError,
    file_dialog_complete_handler : fileDialogComplete,
    upload_start_handler : uploadStart,
    upload_progress_handler : uploadProgress,
    upload_error_handler : uploadError,
    upload_success_handler : uploadSuccess,
    upload_complete_handler : uploadComplete,
    queue_complete_handler : queueComplete, // Queue plugin event
    
    // SWFObject settings
    minimum_flash_version : "9.0.28",
    swfupload_pre_load_handler : swfUploadPreLoad,
    swfupload_load_failed_handler : swfUploadLoadFailed
    };
    
    swfu = new SWFUpload(settings);
    }
    

     

    un forma kur un kā izvēlas bildes ir:

    
    echo "<form id='form1' action='".self_post."' method='post' enctype='multipart/form-data'>
    
    <div id='divSWFUploadUI'>
    <div class='fieldset flash' id='fsUploadProgress'>
    </div>
    <p>
    <span id='spanButtonPlaceholder'></span>
    <input id='btnUpload' type='button' value='Select Files'>
    <input id='btnCancel' type='button' value='Cancel All Uploads' disabled='disabled'>
    </p>
    <br style='clear: both;' />
    </div>
    <noscript>
    We're sorry.  SWFUpload could not load.  You must have JavaScript enabled to enjoy SWFUpload.
    </noscript>
    <div id='divLoadingContent' class='content' style='background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;'>
    SWFUpload is loading. Please wait a moment...
    </div>
    <div id='divLongLoading' class='content' style='background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;'>
    SWFUpload is taking a long time to load or the load has failed.  Please make sure that the Flash Plugin is enabled and that a working version of the Adobe Flash Player is installed.
    </div>
    <div id='divAlternateContent' class='content' style='background-color: #FFFF66; border-top: solid 4px #FF9966; border-bottom: solid 4px #FF9966; margin: 10px 25px; padding: 10px 15px; display: none;'>
    We're sorry.  SWFUpload could not load.  You may need to install or upgrade Flash Player.
    Visit the <a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash'>Adobe website</a> to get the Flash Player.
    </div>
    </form>
    ";
    

     

    Lieta tāda, ka man nav ne jausmas kā uzkodēt upload scriptu, jo pirmkārt nekur netiek norādīts file name ka piem parastā formā <input type='file' name='bilde'>

    un kā augšupielādēt vairākas bildes uz reiz un katrais bildei piešķir jaunu id!

  14. Sveiki, man tāds jautājums kā darbojas bilžu galerija?

     

    Izveidojot Albuma nosaukumu un tad augšupielādētajām bildēm saglabājoties pievieno albūma id? un pēc tad pēc id viņs rāda tai albumā. Tā kaut kā?

  15. nu tā, meiģināju šādi, bet arī nesanāk! :@

    
    $(document).ready(function(){
         $('#showmessages').load('process/show.message.process.php', function() {
               $('.display').animate({scrollTop: $(document).height()}, 1000);
         });
    });
    

×
×
  • Create New...