Jump to content
php.lv forumi

ziedinjsh

Reģistrētie lietotāji
  • Content Count

    789
  • Joined

  • Last visited

Posts posted by ziedinjsh


  1. Vai kāds varētupateikt kas īsti viņam nepatīk:

    <?php
    include "misc/config.php";
    $status = (isset($_GET['status'])) ? $_GET['status'] : '';
    
    // savaac datus
    $submit = $_POST['register'];
    $username = strip_tags($_POST['username']);
    $email = strip_tags($_POST['email']);
    $password = strip_tags($_POST['passwords']);
    $password2 = strip_tags($_POST['passwords2']);
    $date = date("y-m-d");
    
    if ($submit){
    
    //paarbauda vai kkas nav tuksh
    if ($username&&$email&&$password&&$password2) 
    {
    
    // vai paroles ir pareizas
    if ($password == $password2)
    {
    
    // username un email garums
    if (strlen($username)>50||strlen($email)>50)
    {
    echo "In username and email faild max is 50 sybols";
    }
    else
    {
    
    //password garums
    if (strlen($password)>25||strlen($password)<6)
    {
    echo "Password most be between 6 and 25 characters";
    }
    else
    {
    //user register
    
    
    //paroli nokodee uz md5
    $password = md5($password);
    $password2 = md5($password2);
    
    $query = mysql_query ("INSERT INTO users VALUES ('','$username','$email','$password','$date')");
    
    die ("You are registed");
    
    }
    
    
    }
    
    else 
    echo "Youre password do not match!";
    
    
    
    
    }
    else echo "Please fill all feilds";
    
    
    echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
    echo "<table>";
    echo "<tr>";
    echo "<td>username</td><td><input type='text' name='username' value='$username'></td>";
    echo "</tr><tr>";
    echo "<td>email</td><td><input type='email' name='email' value='$email'></td>";
    echo "</tr><tr>";
    echo "<td>password</td><td><input type='password' name='password'></td>";
    echo "</tr><tr>";
    echo "<td>password2</td><td><input type='password' name='password2'></td>";
    echo "</tr><tr>";
    echo "<td></td><td><input type='submit' name='register' value='register'></td>";
    echo "</tr>";
    echo "</table>";
    
    ?>
    

     

    Parse error: syntax error, unexpected T_ELSE in /home/produc/public_html/mp3/1/register.php on line 54

     

    es nesaprotu kas ar to else man jādara.. acis jau nerāda kur ir kļūda rāda 54 rindiņu.. bet ko lai es ar viņu daru?


  2. kas man ir jādara ar ?

    $email = strip_tags($_POST['email']);
    $password = strip_tags($_POST['password']);
    

    ieliku query ar md5($password) kā ir augstāk norādīts.

    ielku šo:

    $result = mysql_query($query) or die(mysql_error);
    

    erroru neizmeta, bet es paskatījos caur phpmyadmin tabulās dati ir.

     

    es meiģināju šādi:

    $email = strip_tags($_POST['email']);
    $password = md5($_POST['password']);
    

    Vienalga izmet bed login..

    izņēmu ārā tās rindiņas, arī neiet.. tā kā viņš tur ir tagad tā arī niet! nesaprotu..

     

    tas viss tagad izskatās šādi:

    <?php
    session_start();
    include "misc/config.php";
    $status = (isset($_GET['status'])) ? $_GET['status'] : '';
    
    if(isset($_POST['login'])){
    
    $email = strip_tags($_POST['email']);
    $password = strip_tags($_POST['password']);
    
    $query = sprintf("SELECT ID FROM users WHERE email = '%s' AND password = '%s' LIMIT 1;", mysql_real_escape_string($email), md5($password));
    $result = mysql_query($query) or die(mysql_error);
    if(mysql_num_rows($result) != 1){ 
    
    header('Location: login.php?status=error');
    }else{
    $row = mysql_fetch_assoc($result);
    
    $_SESSION['user_ID'] = $row['ID'];
    header('Location: login.php?status=done');
    }
    }
    if ($status == 'error'){
    echo "<span style='color:#ff0000'>bad login</span>";
    }
    echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
    echo "<table><tr>";
    echo "<td>email</td><td><input type='text' name='email'></td>";
    echo "</tr><tr>";
    echo "<td>password</td><td><input type='password' name='password'></td>";
    echo "</tr><tr>";
    echo "<td></td><td><input type='submit' name='login' value='Login'>";
    echo "</tr></table>";
    
    
    if($status == 'done'){
    echo "Welcome to member eare";
    }
    ?>
    


  3. Kas šeit nav pareizi.. kad meiģinu ielogoties viņš rāda visu laiku bad login, bet kapēc? it kā jau visam vajadzētu būt, vai arī esmu kaut kur kļūdījies?

    <?php
    session_start();
    include "misc/config.php";
    $status = (isset($_GET['status'])) ? $_GET['status'] : '';
    
    if(isset($_POST['login'])){
    
    $email = strip_tags($_POST['email']);
    $password = strip_tags($_POST['password']);
    
    
    $query = sprintf("SELECT ID FROM users WHERE email = '%s' AND password = '%s' LIMIT 1;", mysql_real_escape_string($email), mysql_real_escape_string($password));
    $result = mysql_query($query);
    if(1 != mysql_num_rows($result)) {
    
    header('Location: login.php?status=error');
    }else{
    $row = mysql_fetch_assoc($result);
    
    $_SESSION['user_ID'] = $row['ID'];
    header('Location: login.php?status=done');
    }
    }
    if ($status == 'error'){
    echo "<span style='color:#ff0000'>bad login</span>";
    }
    echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
    echo "<table><tr>";
    echo "<td>email</td><td><input type='text' name='email'></td>";
    echo "</tr><tr>";
    echo "<td>password</td><td><input type='password' name='password'></td>";
    echo "</tr><tr>";
    echo "<td></td><td><input type='submit' name='login' value='Login'>";
    echo "</tr></table>";
    
    
    if($status == 'done'){
    echo "Wecome to member page";
    }
    ?>
    

     

    varbūt viņš nenolasa password pie:

    $password = strip_tags($_POST['password']);
    

    jo pie register man ir

    $password = md5($_POST[password]);
    


  4. uz servera.. folderis kur atrodas faili ir 0777 kur? ir problēma\

     

    .. tā.. tagad fails izdzēsās, bet parādījās:

    Warning: chmod() [function.chmod]: Operation not permitted in /home/produc/public_html/mp3/test/delete.php on line 3


  5. labi.. izdar;iju tā..

    playlist.php:

    <?php
    echo '<?xml version="1.0" encoding="UTF-8"?>
    <playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>';
    $dir  = opendir("upload/uploads");
    while (false !== ($file = readdir($dir))) {
       if($file!='.' && $file!='..' && $file!='index.php') {
       echo "<track>
    		<title>".$file."</title>
    		<location>upload/uploads/".$file."</location>
    </track>";
    }
      }
      echo '</tracklist>';
    closedir($dir);
    ?>
    

    atverot playlist.php rādās

    upload/uploads/iremember.mp3 upload/uploads/in wild.mp3 utt

    bet playeris turpina rādīt to pāsu kļudu


  6. paprovēju šādi.. vienlaga neiet:

    $dir = 'upload/uploads'; 
    chmod($dir.'/'.$_GET['file'], 0644);
    unlink($dir.'/'.$_GET['file']);
    

     

    Warning: chmod() [function.chmod]: Operation not permitted in /home/produc/public_html/mp3/test/delete.php on line 3

     

    Warning: unlink(/Bryan Adams -Please Forgive Me.mp3) [function.unlink]: No such file or directory in /home/produc/public_html/mp3/test/delete.php on line 4


  7. tajā php daļā ir gan kods kas lasa no foldera un rāda lapā un arī playlist generator.. tas viss atrodas index.php un playeris arī ir index.php

     

    playerī man ir norādīts flashvars="file=index.php?playlist

     

    Bet nu kā jau rakstīt.. playlist man rāda worning un playeris saka, ka nav xml fails


  8. Tātad php ir šāds:

    <?php
    $dir = "upload/uploads";
    $dh = opendir($dir);
    while (($file = readdir($dh)) !== false) {
    if($file != '.' && $file !='..'){
    $string = "$file";
    $new_string = preg_replace("/[^a-zA-Z0-9-.()\s]/", " ", $string);
    $new_string = str_replace(".mp3", " ", $new_string);
    
    if (isset($_GET['playlist'])) {
    echo '
    <?xml version="1.0" encoding="UTF-8"?>
    <playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>';
    while (false !== ($file = readdir($dir))) {
       if($file!='.' && $file!='..' && $file!='index.php') {
       echo "<track>";
       echo "<title>".$file."</title>";
       echo "<location>".$dir."/".$file."</location>";
       echo "</track>";
    }
      }
      echo '</tracklist>';
    
    
      exit();
    
    }
    
    

    playera kods:

    echo'<center>
    <embed 
    src="/misc/player.swf" 
    bgcolor="#FFFFFF" 
    type="application/x-shockwave-flash" 
    pluginspage="http://www.macromedia.com/go/getflashplayer" 
    allowfullscreen="false" 
    flashvars="file=index.php?playlist&
    showdigits=true& 
    playlistsize="20"
    width="510" 
    height="404"
    >
    </center>';
    

     

    playlist izvada:

    Warning: readdir(): supplied argument is not a valid Directory resource in /home/produc/public_html/mp3/index.php on line 51

    un playeris rāda:

    This playlist is not a vaild XML File


  9. Tā tad.. uztaisīju šādi:

    delete links ir:

    <a href='delete.php?file=$file'><img src='misc/delete.png'></a>
    

    delete.php ir šāds:

    <?php
    $dir = 'upload/uploads'; 
    unlink($dir.'/'.$_GET['file']);
    ?>
    

     

    uzspiežot uz linka man parāda worning:

    Warning: unlink(upload/uploads/Cary_Brothers_-_Ride__Blake_Jarrell_Remix_.mp3) [function.unlink]: Permission denied in /home/produc/public_html/mp3/test/delete.php on line 3

     

    Kas tur nav riktīgi un vai šo var ielikt vienā failā bez delete.php?


  10. Sveiki!

     

    Vai ir kaut kur dabonāms kaut kāds mp3 playeris ko ievietot iekš portāla kurš mp3 failus lasa no norādīta foldera?

     

    Maiģināju JW playeri ar to playlist ko ģenerē php, bet nekā neizdevās.. varb;ut ie kāds parasts playeris kur uzreiz lasa no kāda foldera parāda arī playlist?


  11. Vai kaut kur ir pieejams upload scripts kur ievada piem. dziesmas autoru, dziesmas nosaukumu.. izvēlas failu.. spiež pogu pievienot failu.. sākumā tiek ievadīti input informāciju un pēc tam tikai parādas progress bar ar 0-100% dziesmas augšupielādi.. protams ievadot datubāzē dziesmas id, un filesize

     

    man ir upload scripts kurš vienkārši augšupielādē folderī.. meiģin;aju pievienot pie mysql bet nu nesanāca.. tapēc iedomājos pajautāt te.. Varbūt kāds zin līdzīgu scriptu


  12. tad man jānorādā šadi kaut kā:

    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . 'http://domens.lv/mp3/';
    

     

    kaut kā tā?

     

    es tā paprovēju.. vienalga neparādās fails.. postify.php atrodas misc folderā un mp3 folders man atrodas vienu folderi uz atpakaļu.. tad es pameiģināju šādi:

    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder']  '../mp3';
    

    vienalga neiet


  13. Sveiki.. Lejupielādēju failu uploaderi no www.uploadify.com/

    Tur bija js, swf, php un css faili.. ieliku viņus misc mape un pēc tam index.php ieliku šādu kodu:

    <input id='fileInput' name='fileInput' type='file' />
    <script type='text/javascript'>
    $(document).ready(function() {
    $('#fileInput').uploadify({
    'uploader'  : 'misc/uploadify.swf',
    'script'    : 'misc/uploadify.php',
    'cancelImg' : 'misc/cancel.png',
    'auto'      : true,
    'folder'    : '/mp3'
    });
    });
    

    upload poga parādās.. izvēlos failu.. parāda ka 100% uzlādēts.. complete. Bet fails folderā nav!

     

    tur vēl bija šādi php:

    postify.php:

    <?php
    
    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
    $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
    
    // $fileTypes  = str_replace('*.mp3','',$_REQUEST['fileext']);
    // $fileTypes  = str_replace(';','|',$fileTypes);
    // $typesArray = split('\|',$fileTypes);
    // $fileParts  = pathinfo($_FILES['Filedata']['name']);
    
    // if (in_array($fileParts['extension'],$typesArray)) {
    	// Uncomment the following line if you want to make the directory if it doesn't exist
    	// mkdir(str_replace('//','/',$targetPath), 0755, true);
    
    	move_uploaded_file($tempFile,$targetFile);
    	echo "1";
    // } else {
    // 	echo 'Invalid file type.';
    // }
    }
    ?>
    

    un check.php

    <?php
    
    $fileArray = array();
    foreach ($_POST as $key => $value) {
    if ($key != 'folder') {
    	if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
    		$fileArray[$key] = $value;
    	}
    }
    }
    echo json_encode($fileArray);
    ?>
    

    skatījos js failos, tur nekur nebija jānorāda failu folderis.. kas varētu būt pa problēmu?


  14. div css man ir šāds:

    background-color:#211101;
    filter:alpha(opacity=70);
    -moz-opacity:0.7;
    -khtml-opacity: 0.7;
    opacity: 0.7;
    -moz-border-radius: 5px;
    margin:2px 2px 2px 2px;
    padding:0px 0px 0px 0px;
    width:400px;
    height:50px;
    float:left;
    postition:relative;
    

     

    Bet tas kas atrodas man iekšā arī ir caurspīdīs.. Bildes un teksts ka var panāk tolai div saturs nav caurspīdīgs?

×
×
  • Create New...