IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Code lent PHP


Sujet :

PHP & Base de données

  1. #1
    Membre habitué
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 8
    Par défaut Code lent PHP
    Bonjour,
    pourriez-vous m'aider ?
    Ce code est super long à charger :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    <?php
    $response_format="txt";
    if($ba == '' && $type == '1'){ $link ="http://www.allocine.fr/_video/iblogvision.aspx?cmedia=$url";}
    else{
            if  ($type == '1') {
    // Lecteur Allocine     
    $link="http://www.allocine.fr/_video/iblogvision.aspx?cmedia=$url";
    } 
    // Lecteur Youwatch     
    elseif  ($type == '2') {
    $link="http://youwatch.org/$url";
    } 
    //lecteur vk
    elseif  ($type == '9') {
    $link="$link";
    }
    //lecteur purvideo
    elseif ($type == '4') {
    $link= "http://www.purevid.com/v/";
    } 
    //lecteur firedrive
    elseif  ($type == '5') {
    $link="http://www.firedrive.com/file/$url";
    } 
    //lecteur uploadhero
    elseif  ($type == '6') {
    $link="http://uploadhero.co/dl/$url";
    }
    // lecteur Videomega
    elseif  ($type == '7') {        
    $link="http://videomega.tv/?ref=$url";
    }
    // lecteur Exashare
    else{   
    $link="http://exashare.com/$url";
    }
    }
        $url = 'http://api.urlchecker.net/';
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, "response_format=$response_format&link=$link");
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_NOBODY, 0);
        $response = curl_exec($ch);
        echo $response;
    if (stripos($response, 'working') !== FALSE) {
    // Set Mysql Connection info 
      $host ="localhost"; 
      $username="utilisateur"; 
      $password="pass"; 
      $db_name="bdd"; 
      $table_name="files";
    require('setting.php');
            $fileid = $_GET['filmid'] ;
    // Connect to server and select database. 
    mysql_connect("$host", "$username", "$password")or die("cannot connect");  
    mysql_select_db("$db_name")or die("cannot select DB"); 
    // update data in mysql database  
    $sql = sprintf (" UPDATE  $table_name SET status='1' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
    $result=mysql_query($sql); 
     if($result) { 
    echo "<div align='right'>Lien Valide !</div>";
    }
     else {  echo "ERROR"; 
      mysql_close();
     } 
     }
     else if (stripos($response, 'dead') !== FALSE) {
    // Set Mysql Connection info 
      $host ="localhost"; 
      $username="utilisateur"; 
      $password="pass"; 
      $db_name="bdd"; 
      $table_name="files";
    require('setting.php');
            $fileid = $_GET['filmid'] ;
    // Connect to server and select database. 
    mysql_connect("$host", "$username", "$password")or die("cannot connect");  
    mysql_select_db("$db_name")or die("cannot select DB"); 
    // update data in mysql database  
    $sql = sprintf (" UPDATE  $table_name SET status='0' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
    $result=mysql_query($sql); 
     // if successfull  
     if($result) { 
         echo "<div align='right'>Lien mort, vidéo déplacer!</div>"; 
     } 
     else {  echo "ERROR"; 
       mysql_close();   
     } 
    }
    else if (stripos($response, 'Error') !== FALSE) {
    // Set Mysql Connection info 
      $host ="localhost"; 
      $username="utilisateur"; 
      $password="pass"; 
      $db_name="bdd"; 
      $table_name="files";
    require('setting.php');
            $fileid = $_GET['filmid'] ;
    // Connect to server and select database. 
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB"); 
    // update data in mysql database  
     $sql = sprintf (" UPDATE  $table_name SET status='1' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
    $result=mysql_query($sql); 
     // if successfull  
     if($result) { 
         echo "<div align='right'>Non pris en charge!</div>"; 
     } 
     else {  echo "ERROR"; 
     mysql_close();     
     }
    }
    ?>
    Comment l'améliorer svp ?

  2. #2
    Expert confirmé
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Billets dans le blog
    12
    Par défaut
    Salut,

    il faut poser des timers pour profiler l'exécution du code et voir ce qui est le plus long.
    M'est d'avis que c'est l'utilisation de la lib curl et là tu vas être plus ou moins coincé dans la mesure où c'est directement lié à la vélocité des sites pointés par les URL...

    Tu peux grandement améliorer la lisibilité du code en remplaçant la liste des if () { } elseif() { } par un tableau et adapter le traitement en conséquence :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    $players = [
        1 => "http://www.allocine.fr/_video/iblogvision.aspx?cmedia={$url}",
        2 => "http://youwatch.org/{$url}",
        4 => "http://www.purevid.com/v/",
        5 => "http://www.firedrive.com/file/{$url}",
        6 => "http://uploadhero.co/dl/{$url}",
        7 => "http://exashare.com/{$url}"
    ];

  3. #3
    Membre habitué
    Homme Profil pro
    Étudiant
    Inscrit en
    Février 2014
    Messages
    8
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2014
    Messages : 8
    Par défaut re
    Merci pour votre aide, cependant, etant débutant, pourriez-vous m'aider à finir ce code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    <?php
     
     
     
        $response_format="txt";
     
     
     
    $players = [
        1 => "http://www.allocine.fr/_video/iblogvision.aspx?cmedia={$url}",
        2 => "http://youwatch.org/{$url}",
        4 => "http://www.purevid.com/v/",
        5 => "http://www.firedrive.com/file/{$url}",
        6 => "http://uploadhero.co/dl/{$url}",
        7 => "http://exashare.com/{$url}"
    ];
     
        $link = "$players";
     
        $url = 'http://api.urlchecker.net/';
     
        $ch = curl_init($url);
     
     
     
        curl_setopt($ch, CURLOPT_POST, true);
     
        curl_setopt($ch, CURLOPT_POSTFIELDS, "response_format=$response_format&link=$link");
     
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     
        curl_setopt($ch, CURLOPT_VERBOSE, 1);
     
        curl_setopt($ch, CURLOPT_NOBODY, 0);
     
     
     
        $response = curl_exec($ch);
     
        echo $response;
     
     
     
    if (stripos($response, 'working') !== FALSE) {
     
    // Set Mysql Connection info 
     
      $host ="localhost"; 
     
      $username="utilisateur"; 
     
      $password="pass"; 
     
      $db_name="bdd"; 
     
      $table_name="files";
     
     
     
    require('setting.php');
     
    	$fileid = $_GET['filmid'] ;
     
     
     
    // Connect to server and select database. 
     
    mysql_connect("$host", "$username", "$password")or die("cannot connect");  
     
    mysql_select_db("$db_name")or die("cannot select DB"); 
     
     
     
    // update data in mysql database  
     
    $sql = sprintf (" UPDATE  $table_name SET status='1' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
     
     
    $result=mysql_query($sql); 
     if($result) { 
    echo "<div align='right'>Lien Valide !</div>";
     
    }
     
     
     else {  echo "ERROR"; 
     
      mysql_close();    
     
     } 
     }
     
    else if (stripos($response, 'dead') !== FALSE) {
     
    // Set Mysql Connection info 
     
      $host ="localhost"; 
     
      $username="utilisateur"; 
     
      $password="pass"; 
     
      $db_name="bdd"; 
     
      $table_name="files";
     
     
     
    require('setting.php');
     
    	$fileid = $_GET['filmid'] ;
     
     
     
    // Connect to server and select database. 
     
    mysql_connect("$host", "$username", "$password")or die("cannot connect");  
     
    mysql_select_db("$db_name")or die("cannot select DB"); 
     
     
     
    // update data in mysql database  
     
    $sql = sprintf (" UPDATE  $table_name SET status='0' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
     
     
    $result=mysql_query($sql); 
     
     
     
     // if successfull  
     
     
     if($result) { 
     
         echo "<div align='right'>Lien mort, vidéo déplacer!</div>"; 
     
     } 
     
     else {  echo "ERROR"; 
     
       mysql_close();   
     
     } 
     
    }
     
    else if (stripos($response, 'Error') !== FALSE) {
     
    // Set Mysql Connection info 
     
      $host ="localhost"; 
     
      $username="utilisateur"; 
     
      $password="pass"; 
     
      $db_name="bdd"; 
     
      $table_name="files";
     
     
     
    require('setting.php');
     
    	$fileid = $_GET['filmid'] ;
     
     
     
    // Connect to server and select database. 
     
    mysql_connect("$host", "$username", "$password")or die("cannot connect");  
     
    mysql_select_db("$db_name")or die("cannot select DB"); 
     
     
     
    // update data in mysql database  
     
    $sql = sprintf (" UPDATE  $table_name SET status='1' WHERE fileid='$fileid'",
     mysql_real_escape_string($fileid));
     
     
    $result=mysql_query($sql); 
     
     
     
     // if successfull  
     
     
     if($result) { 
     
         echo "<div align='right'>Non pris en charge!</div>"; 
     
     } 
     
     else {  echo "ERROR"; 
     
     mysql_close();     
     
     } 
     
    }
     
     
        ?>

    le début du fichier :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    <?php 
     
    	require_once ('cnx.php');
     
    	require ('cfg.php');
     
    	require('setting.php');
     
    	require ('function.php');
     
    	require('auth.php');
     
    	$fileid = $_GET['filmid'] ;
     
    	if (is_numeric($fileid) && strlen($fileid)) {
     
    	$sql = mysql_query("SELECT * FROM files WHERE fileid = '$fileid' LIMIT 1");
     
    	if (mysql_num_rows($sql) > 0) {
     
    	$row = mysql_fetch_array($sql);
     
    	$fileid = $row['fileid'];
     
    	$filename = $row['file'];
     
    	$filetype = $row['filetype'];
     
    	$type = $row['filetype'];
     
    	$icon = $row['icon'];
     
    	$filelocation = $row['filelocation'];
     
    	$iconlocation = $row['iconlocation'];
     
    	$saison = $row['saison'];
     
    	$episode = $row['episode'];
     
    	$titre = stripslashes($row['title']);
     
    	$filetitle = $row['title'];
     
    	$filedescription = stripslashes($row['description']);
     
    	$filerealisateur = $row['realisateur'];
     
    	$fileacteurs = $row['acteurs'];
     
    	$filesortie = $row['sortie'];
     
    	$fileduree = $row['duree'];
     
    	$catname = $row['category'];
     
    	$filetitle = $row['title'];
     
    	$lang = $row['lang'];
     
    	$qualite = $row['qualite'];
     
    	$ba = $row['ba'];
     
     
     
    // Nettoyage de la variable $titre pour l'url
     
    	$titre = $row[title];
     
    	$titre = htmlentities($titre, ENT_NOQUOTES, 'UTF-8');
     
    	$titre = preg_replace('`&([a-z]{1,2})(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', '$1', $titre);
     
    	$titre = strip_tags($titre);
     
    	$titre = preg_replace("/[^A-Za-z0-9]+/", "-", $titre);
     
    	$titre = trim($titre, "-");
     
    	$titre = substr($titre, 0, 50);
     
    	$titre = strtolower($titre);
     
     
     
     
     
     
     
     
     
    require 'info_film.php';
     
     
     
    if ($catname == '25' || $catname == '26' ) { $numsaison = ' (Saison '.$saison.' - '; $numepisode ='Episode '.$episode.')';} else {$numsaison = ''; $numepisode ='';}
     
     
     
    if ($catname == '24' ) { 	$filmx = '<strong>(-18 ans)</strong>';}	
     
     
     
    $sql2 = mysql_query("SELECT * FROM categories WHERE catid = '$catname' LIMIT 1");
     
     
     
    if (mysql_num_rows($sql2) > 0) {
     
    $row2 = mysql_fetch_array($sql2);
     
    $catid = $row2['catid'];
     
    $categorie = stripslashes($row2['name']);
     
    $categoryname = stripslashes($row2['name']);
     
     
     
    		}
     
    	}
     
    }
     
    ?><?php
     
    if(isset($_POST['submit'])){
     
     
     
    	if(isset($_POST["captcha"]) && $_POST["captcha"]!="" && $_SESSION["code"] == $_POST["captcha"])
     
    		{
     
    	$ip = $_POST['ip'];
     
    	//Envoyer un mail pour recevoir le nouveau passe:
     
        $to = $compte_email;
     
        $sujet = 'Bug du film '.ucfirst(stripslashes($filetitle)).''.$numsaison.''.$numepisode.' ';
     
        $body = '
    
        Bonjour,<br> le film '.ucfirst(stripslashes($filetitle)).''.$numsaison.''.$numepisode.' a été signalé le '.$date.' provenant du site '.$domain.'.<br>
    
    	Voici le lien: <a href="'.$urlsite.'/'.$_SERVER["REQUEST_URI"].'">'.$urlsite.'/'.$_SERVER["REQUEST_URI"].'</a><br>
    
    	Ip qui a envoyé le rapport : '.$ip.' 
    
    	<br>---------------<br>
    
    	Le bot du site :)
    
    	
    
    	';
     
        $entete = "MIME-Version: 1.0 \n";
     
    	$entete .= "Content-type: text/html; charset=utf-8 \n";
     
    	$entete .= "From: From: ".$domain." <".$compte_email."> \n";
     
        $entete .="Content-Transfer-Encoding: 8bit \n";
     
       @mail($to,$sujet,$body,$entete);
     
     
     
        $error_mail ='
    
    	<div class="alert alert-success">
    
            <button type="button" class="close" data-dismiss="alert">×</button>
    
            <strong>Rapport envoyé à l\'administrateur du site.</strong> Nous vous remercions pour votre implication.
    
        </div>
    
    	
    
    	';
     
    		}else{ $error_mail ='
    
    	<div class="alert alert-error">
    
            <button type="button" class="close" data-dismiss="alert">×</button>
    
            <strong>Erreur:</strong> Le captcha est incorrect !
    
        </div>';}
     
    }
     
    ?><!DOCTYPE html>
     
    <html lang="fr">
     
      <head>
     
        <meta charset="utf-8">
     
        <title>Vous regardez <?= ucfirst(stripslashes($filetitle)); ?> en streaming <?= $filmx; ?> <?= $numsaison; ?><?= $numepisode; ?></title>
     
    <!--Facebook Meta Tags-->
     
    <meta property="fb:app_id" content="<?= $id_facebook; ?>" /> 
     
    <meta property="og:url" content="<?= $urlsite; ?>/video/<?= $fileid; ?>/<?= $titre; ?>.html" /> 
     
    <meta property="og:title" content="<?= $titre;?>" />
     
    <meta property="og:description" content="<?= $filedescription;?>" /> 
     
    <meta property="og:image" content="http://<?= $icon; ?>" /> 
     
    <!--End Facebook Meta Tags-->
     
    	<?php include 'head.php'; ?>
     
      <body class=""> 
     
     
     
    <div class="sidebar-nav" style="top:70px;">
     
    <form method="GET" action="search.html?requete=" class="search form-inline" style="width:215px;">
     
    <select name="choix" class="btn dropdown-toggle selectpicker btn-inverse" data-toggle="dropdown" style="width:100px;">
     
     
     
    <option value="all"<?php if($_GET['choix'] == 'all') echo 'selected="selected"'; ?>>Film</option>
     
    <option value="26"<?php if($_GET['choix'] == '26') echo 'selected="selected"'; ?>>Série</option>
     
    <option value="25"<?php if($_GET['choix'] == '25') echo 'selected="selected"'; ?>>Manga</option>
     
    </select> 
     
    <input type="text" name="requete" value="Recherche" onblur="if (this.value=='') { this.value='Recherche'; }" style="margin-top: 5px;" onfocus="if (this.value=='Recherche') { this.value=''; }" placeholder="Rechercher...">
     
     
     
    </form>
     
     
     
      <?php 
     
    if($catname == '26' || $catname =='25' ){  
     
      ?>
     
    <a href="#accounts-menu" class="nav-header collapsed" data-toggle="collapse"><i class="icon-film"></i>Saison disponible<i class="icon-chevron-up"></i></a>
     
    <ul id="accounts-menu" class="nav nav-list collapse">
     
    <?php
     
    $resultats=$cnx->query("SELECT * FROM files WHERE title = '".addslashes($filetitle)."' GROUP BY saison   ");
     
        $resultats->setFetchMode(PDO::FETCH_OBJ);
     
        while( $ligne = $resultats->fetch() ) 
     
        {
     
    	$Saison = $ligne->saison;	
     
    	$Episode = $ligne->episode;	
     
    	$Idfilm = $ligne->fileid;	
     
     
     
    	$icon_ok_green = '<span class="icon-ok " style="color:green;"></span>'; 
     
    	if($Saison == $saison){ $Ic = $icon_ok_green;}else{$Ic = '<span class="icon-ok "></span>' ;}
     
    	?>
     
        <li><a href="<?= $urlsite; ?>/video/<?= $Idfilm; ?>/<?= $titre; ?>.html"> <?= $Ic; ?>Saison <?= $Saison; ?></a></li>
     
    <? }
     
    	?> 
     
    </ul>
     
     
     
    <a href="#dashboard-menu" class="nav-header " data-toggle="collapse"><i class="icon-film"></i>Saison <?= $saison; ?><i class="icon-chevron-up"></i></a>
     
    <ul id="dashboard-menu" class="nav nav-list collapse in">
     
    <?php
     
    $resultats=$cnx->query("SELECT * FROM files WHERE saison = '".$saison."' && title = '".addslashes($filetitle)."'  order by cast(episode as signed) ");
     
        $resultats->setFetchMode(PDO::FETCH_OBJ);
     
        while( $ligne = $resultats->fetch() ) 
     
        {
     
    	$Episode = $ligne->episode;	
     
    	$Idfilm = $ligne->fileid;	
     
    	$Lang = $ligne->lang;
     
    	$Qualite = $ligne->qualite;
     
    	$Qual = $ligne->qualite;
     
    	$Filetype = $ligne->filetype;
     
     
     
    	// Qualité du film
     
    	if ($Qualite == ''){ $Qualite = '<span class="label btn-defaut">?</span>';} 
     
    	if ($Qualite == '1'){ $Qualite = '<span class="label btn-primary">HD</span>';} 
     
    	if ($Qualite == '2'){ $Qualite = '<span class="label btn-info" >DVDRIP</span>';} 
     
    	if ($Qualite == '3'){ $Qualite = '<span class="label btn-success">CAM</span>';} 
     
    	if ($Qualite == '4'){ $Qualite = '<span class="label btn-inverse" >TS</span>';} 
     
    	if ($Qualite == '5'){ $Qualite = '<span class="label btn-danger">R5</span>';} 
     
     
     
    	// Qualité du film
     
    	if ($Qual == ''){ $Qual = '<span style="margin-left: 3px;margin-top: -19px;" class="label btn-defaut">?</span>';} 
     
    	if ($Qual == '1'){ $Qual = '<span style="margin-left: 93px;margin-top: -19px;display: block;" class="label btn-primary">HD</span>';} 
     
    	if ($Qual == '2'){ $Qual = '<span style="margin-left: 93px;margin-top: -19px;display: block;" class="label btn-info" >DVDRIP</span>';} 
     
    	if ($Qual == '3'){ $Qual = '<span style="margin-left: 93px;margin-top: -19px;display: block;" class="label btn-success">CAM</span>';} 
     
    	if ($Qual == '4'){ $Qual = '<span style="margin-left: 93px;margin-top: -19px;display: block;" class="label btn-inverse" >TS</span>';} 
     
    	if ($Qual == '5'){ $Qual = '<span style="margin-left: 93px;margin-top: -19px;display: block;" class="label btn-danger">R5</span>';}
     
     
     
    	// Langage du film
     
    	if ($Lang == ''){ $Lang = '<span class="label btn-defaut" style="margin-left:3px;width:12px;height:10px;">?</span>';} 
     
    	if ($Lang == '1'){ $Lang = '<img src="'.$urlsite.'/images/fr.png" alt="VF" title="VF" align="absmiddle" style="margin-left:52px;width:12px;height:10px;border:none;cursor:pointer;">';} 
     
    	if ($Lang == '2'){ $Lang = '<img src="'.$urlsite.'/images/fr-en.png" alt="VOSTFR" title="VOSTFR" align="absmiddle" style="margin-left:52px;width:12px;height:10px;border:none;cursor:pointer;">';} 
     
    	if ($Lang == '3'){ $Lang = '<img src="'.$urlsite.'/images/en.png" alt="VO" title="VO" align="absmiddle" style="margin-left:52px;width:12px;height:10px;border:none;cursor:pointer;">';} 
     
     
     
    	// Icones plateforme
     
    	if ($Filetype == '1' ) { $Filetype = '<img src= "'.$urlsite.'/images/allocine.png" alt="Allocine" title="Allocine" align="absmiddle" style="border:none;cursor:pointer; width:12px;">';}
     
    	if ($Filetype == '2' ) { $Filetype = '<img src= "'.$urlsite.'/images/youwatch.png" alt="Youwatch" title="Youwatch" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}
     
    	if ($Filetype == '3' ) { $Filetype = '<img src= "'.$urlsite.'/images/exashare.png" alt="Exashare" title="Exashare" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}
     
    	if ($Filetype == '4' ) { $Filetype = '<img src= "'.$urlsite.'/images/purevid.png" alt="Purevid" title="Purevid" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}	
     
    	if ($Filetype == '5' ) { $Filetype = '<img src= "'.$urlsite.'/images/firedrive.png" alt="Firedrive" title="Firedrive" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}	
     
    	if ($Filetype == '6' ) { $Filetype = '<img src= "'.$urlsite.'/images/uploadhero.png" alt="UploadHero" title="UploadHero" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}
     
    	if ($Filetype == '7' ) { $Filetype = '<img src= "'.$urlsite.'/images/videomega.png" alt="Videomega" title="Videomega" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}	
     
    	if ($Filetype == '9' ) { $Filetype = '<img src= "'.$urlsite.'/images/vk.png" alt="Vk" title="Vk" align="absmiddle" style="border:none;cursor:pointer;width:12px;">';}	
     
     
     
    	$icon_ok_green = '<span class="icon-ok " style="color:green;"></span>'; 
     
    	if($Episode == $episode && $Idfilm == $fileid ){ $Ic = $icon_ok_green;}else{$Ic = '<span class="icon-ok "></span>' ;}
     
    	?>
     
        <li><a href="<?= $urlsite; ?>/video/<?= $Idfilm; ?>/<?= $titre; ?>.html"><?= $Ic; ?>Episode <?= $Episode; ?> <?= $Qual; ?> <?= $Lang;  ?> <?= $Filetype; ?> </a></li><? } 
     
    }else{}
     
    ?>
     
    </ul>
     
    </div>
     
     
     
      <!--<![endif]-->
     
    <?php include 'navbar.php'; ?>
     
    	<!-- Gauche-->
     
    <div id= "header"></div>
     
            <div class="row-fluid">
     
        <div class="dialog" style="width:940px;">
     
            <div align="center" class="block" style="margin-left: 80px;margin-top: -42px;width:940px;;">
     
                <p class="block-heading" style="font-size:18px;"><a href="<?= $urlsite; ?>"><i class="icon-home" style="float:left; margin-left:10px;"></i></a><em>Vous regardez <?= ucfirst(stripslashes($filetitle)); ?> en streaming <?= $filmx; ?> <?= $numsaison; ?><?= $numepisode; ?></em><?= $qualite;  ?><span style="float: right;margin-top: 7px;margin-right: -37px;"><?= $lang;  ?> <?= $filetype;  ?></span></p>
     
      <?php if(isset($error_mail)){ echo $error_mail; } ?>        
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
      <noindex>
     
    <script type="text/javascript">$(document).ready(function(){$('div.link a').click(function() {$(this).attr('target', '_blank'); $('#begun').show("drop", 2000);})})</script>
     
     
     
    <div class="link">
     
    <center> CLIQUER SUR UNE DES 2 PUB POUR VOIR LA VIDEO</center>
     
      <div id="link" style="border:1px solid green;"><?php include('pubs/468x601.htm'); ?>
     
      <br>
     
     <?php include('pubs/468x602.htm'); ?>
     
      <br><br></div>  
     
      </div>
     
     
     
    <div align="center" id="begun" style="display:none;">
     
     
     
    <?php
     
     
     
    if($ba == '' && $type == '1'){ $content = '<div style="width:500px;height:300px;margin-top:150px;font-size:24px;">Pas de bande annonce pour ce film !</div>';}
     
    else{
     
    if  ($type == '1') {
     
    // Lecteur Allocine	
     
    $content = '<iframe width="100%" height="530px" frameBorder="0" src="http://www.allocine.fr/_video/iblogvision.aspx?cmedia='.$ba.'"></iframe>';
     
    } 
     
     
     
    // Lecteur Youwatch	
     
    elseif  ($type == '2') {
     
    $url = str_replace("http://youwatch.org/", "", $filename);
     
    $content = '<iframe width="100%" height="530px" src="http://youwatch.org/embed-'. trim($url) .'-900x506.html" scrolling="no" frameborder="0" allowfullscreen></iframe>';
     
    } 
     
     
     
    //lecteur purvideo
     
    elseif ($type == '4') {
     
    $content = '<iframe width="100%" height="530px" frameBorder="0" src="'. substr(trim($filename),0,-1) .'"></iframe>';
     
    } 
     
    //lecteur firedrive
     
    elseif  ($type == '5') {
     
    $url = str_replace("https://www.firedrive.com/file/", "", $filename);
     
    $content = '<iframe width="100%" height="530px" src=\'https://www.firedrive.com/embed/'. trim($url) .'\' scrolling="no" frameborder="0" allowfullscreen></iframe>';
     
    } 
     
    //lecteur uploadhero
     
    elseif  ($type == '6') {
     
    $url = str_replace("http://uploadhero.co/dl/", "", $filename);
     
    $content = '<iframe src="http://uploadhero.co/embed/'. trim($url) .'_912-500" height="500" scrolling="no" frameborder="no" width="100%"></iframe>';
     
    }
     
     
     
     
     
    //lecteur vk
     
    elseif  ($type == '9') {
     
    $url = str_replace("http://vk.com/video_ext.php?oid=", "", $filename);
     
    $content = '<iframe src="http://vk.com/video_ext.php?oid='. trim($url) .'" height="500" scrolling="no" frameborder="no" width="100%"></iframe>';
     
    }
     
     
     
    // lecteur Videomega
     
    elseif  ($type == '7') {	
     
    $url = str_replace("http://videomega.tv/?ref=", "", $filename);
     
    $content = '<iframe width="100%" height="530px" src="http://videomega.tv/iframe.php?ref='. trim($url) .'&width=870&height=430" frameborder="0" allowfullscreen></iframe>';
     
    }
     
     
     
    // lecteur Exashare
     
    else{	
     
    $url = str_replace("http://www.exashare.com/", "", $filename);
     
    $content = '<iframe width="100%" height="530px" src="http://www.exashare.com/embed-'. trim($url) .'-900x506.html" frameborder="0" allowfullscreen></iframe>';
     
    }
     
     
     
    ?>
     
    </noindex>
     
     
     
     
     
      <div id="game" style="position: static; z-index: auto; height:520px;" class="block-body">
     
    <?php
     
    }
     
    if ($type > 0) { 
     
    echo '<span id="show_movie">'.$content.'</span>';
     
    echo '<span id="show_ba" style="display:none;"><iframe width="100%" height="530px" frameBorder="0" src="http://www.allocine.fr/_video/iblogvision.aspx?cmedia='.$ba.'"></iframe></span>';
     
     
     
    }else{ echo ' une erreur s\'est produite '; }
     
     
     
    ?>
     
     
     
    </div>
     
    <?= $share; ?>		
     
     </div>		
     
    <div style="float:right;margin-right:20px;margin-top: -30px;" class="btn-group" data-toggle="buttons-radio">
     
     
     
    <span id="game-div">
     
     
     
     
     
    <button id="game-button" type="button" class="btn">Cinema on</button>&nbsp;&nbsp;
     
    <button id="my-button" type="button" class="btn" style="z-index: 9999; position: relative; display:none;">Cinema off</button>
     
    <?php if($ba){ ?>
     
    <button id="ba_button" type="button" class="btn" style=" position: relative;">Bande Annonce</button>
     
     
     
    <button id="ba_button_2" type="button" class="btn" style=" display:none; position: relative;">Fermer BA</button>
     
    <?php }else{} ?>
     
    <a href="#myModal" class="btn btn-danger" style="margin-left: -62px;margin-top: -30px;width: 30px;display: block;position: absolute;" role="button" data-toggle="modal">Bug</a>
     
    <a href="#myModal2" class="btn btn-warning" style="margin-left: -150px;margin-top: -30px;width: 56px;display: block;position: absolute;" role="button" data-toggle="modal">Synopsis</a>
     
     
     
    </span>
     
     
     
     
     
    </div>
     
    <br>
     
     
     
    <?php if(isset($_SESSION['rang']) && $_SESSION['rang'] == '10'){?><th> <a href="<?= $urlsite; ?>/modify_adm.html?id=<?php echo $fileid; ?>&tokenid=<?php echo $_SESSION['tokenid']; ?>"><i class="icon-pencil"></i></a>
     
     
     
              </th>
     
    		  <?php }else{} ?>
     
              </tr>
     
     
     
     
     
     
     
    <center><div align="center" class="fb-comments" data-href="<?= $urlsite; ?>/video/<?= $fileid; ?>/<?= $titre; ?>.html" data-num-posts="6" data-width="700" style="margin-left: 115px;"></div></center>
     
    </div>
     
    </div>
     
     
     
    <div align="center" style="margin-left: 170px;"><?php include('pubs/728x90.htm'); ?></div>
     
    <div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
     
        <div class="modal-header">
     
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     
            <h3 id="myModalLabel" class="text-error"><?= ucfirst(stripslashes($filetitle)); ?> <?= $numsaison; ?><?= $numepisode; ?> bug ?</h3>
     
        </div>
     
     
     
        <form method="post" action="#"> 
     
        <div class="modal-body">
     
     
     
          <p class="error-text"><i class="icon-warning-sign modal-icon"></i  
     
     
     
            ></p><p class="text-error">Je certifie que ce film ne fonctionne plus !</p>
     
            <p>&nbsp;</p>
     
           <label>Recopiez ce code
     
    <img src="<?= $urlsite; ?>/captcha.php" id="captcha"  /><i class="icon-refresh" id="refresh_cap" title="Actualiser le captcha" style="margin-left:5px; margin-right:5px; cursor:pointer;"></i><input name="captcha" type="text" placeholder="Code" required class="span12" style="width: 60px;"></label>
     
        <div class="modal-footer">
     
     
     
            <button class="btn" data-dismiss="modal" aria-hidden="true">Annuler</button>
     
            <input type="hidden" name="ip" value="<?php echo $_SERVER['REMOTE_ADDR']; ?>">
     
            <button name="submit" type="submit" style="width:80px;" class="btn btn-primary" >Envoyer</button>
     
           </div> 
     
        </div>
     
        </form>
     
    </div>
     
    <!-- Syno -->
     
    <div style="height:350px;width: 530px;display: block;" class="modal big hide fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
     
        <div class="modal-header">
     
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
     
            <h3 id="myModalLabel" class="text-error">Synopsis: <?= ucfirst(stripslashes($filetitle)); ?> <?= $numsaison; ?><?= $numepisode; ?></h3>
     
        </div>
     
     
     
    <span style="height: 200px;
     
    width: 500px;
     
    margin-left: 20px;
     
    margin-top: 20px;
     
    display: block;">
     
    <img src="<?= $icon; ?>" style="height: 150px;float: left;margin-right: 10px;" ><span style=""><?= $filedescription; ?></span>
     
    </span>
     
     
     
    </div>
     
     
     
    <script src="<?= $urlsite; ?>/lib/bootstrap/js/cine.js"></script>
     
    <script src="<?= $urlsite; ?>/lib/bootstrap/js/bootstrap.js"></script>
     
     <script>        
     
    $('#game-button').click(function(){
     
        $('#game').cinema({
     
            'elements': [$('#my-button')],
     
        });
     
        $('#my-button').click(function(){
     
            $('#game').uncinema();
     
        });
     
    });     
     
     
     
    $(document).ready(function() {
     
    	    $('#ba_button').click(function(){
     
    		$('#show_movie').toggle();
     
    		$('#show_ba').toggle();
     
    		$('#show_ba').appendTo();
     
    		$('#ba_button').toggle();
     
    		$('#ba_button_2').toggle();
     
    		 });
     
    });  
     
    $(document).ready(function() {
     
    	    $('#ba_button_2').click(function(){
     
    		location.reload();
     
    		 });
     
    });  
     
    $(document).ready(function() {
     
    	    $('#game-button').click(function(){
     
    		$('#my-button').toggle();
     
    		$('#game-button').toggle();
     
    		 });
     
    });  
     
    $(document).ready(function() {
     
    	    $('#my-button').click(function(){
     
    		$('#my-button').toggle();
     
    		$('#game-button').toggle();
     
    		 });
     
    });
     
    </script>
     
     <script>
     
    $(document).ready(function() {
     
    $("#refresh_cap").click(function() {
     
        $("#captcha").attr("src", "<?= $urlsite; ?>/captcha.php?"+(new Date()).getTime());
     
    });
     
    }); 
     
    </script>
     
     
     
    </html>
    <?php
    require 'link.php';
    ?>

  4. #4
    Membre Expert Avatar de darkstar123456
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mars 2008
    Messages
    1 895
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mars 2008
    Messages : 1 895
    Par défaut
    Bonjour,

    Votre code est inutilisable de la sorte, et pas mal illisible (voilà probablement pourquoi personne ne répond :s)

    Le code donné par rawsrc devrait être utilisé de la sorte :

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    $players = [
        1 => "http://www.allocine.fr/_video/iblogvision.aspx?cmedia={$url}",
        2 => "http://youwatch.org/{$url}",
        4 => "http://www.purevid.com/v/",
        5 => "http://www.firedrive.com/file/{$url}",
        6 => "http://uploadhero.co/dl/{$url}",
        7 => "http://exashare.com/{$url}"
    ];
    $curl_url = $players[$type];
    $ch = curl_init($cul_url);
    //etc...

Discussions similaires

  1. Encoder le code source PHP
    Par berceker united dans le forum Langage
    Réponses: 18
    Dernier message: 31/07/2009, 20h57
  2. Code sensible PHP, secret à 100% ?
    Par Droïde Système7 dans le forum Langage
    Réponses: 2
    Dernier message: 13/07/2006, 15h30
  3. intégré une animation flash dans un code en PHP
    Par maroweb dans le forum Flash
    Réponses: 2
    Dernier message: 28/05/2006, 13h34
  4. [Sécurité] Afficher le code source PHP
    Par tigzirt dans le forum Langage
    Réponses: 2
    Dernier message: 12/05/2006, 08h42
  5. code lent ??
    Par difficiledetrouver1pseudo dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 12/02/2006, 11h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo