vendredi 4 décembre 2015

!file_exists is not working in a if statement

Hello i recently made the first part of a system that need to make random link such a system like adf.ly but much different working, the problem is i'm trying to see if a map exist, if then try again if not, then make, but it seems !file_exist is not responding. Anyone that nows the problem in my script(it does not works on my own xampp server and my 000webhost server).

My php code:

<?php
error_reporting(0);
$long_url = $_POST['long_url'];
$custom_url = $_POST['custom_url'];
$password = random_generator(6);



function random_generator( $length = 6 ) { 
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; 
    $random = substr( str_shuffle( $chars ), 0, $length ); 
    return $random; 
} 

if (file_exists('/test/get/')) {
    echo "$random";
    echo "does";
} else {
    echo "does not";
}

?> 

Aucun commentaire:

Enregistrer un commentaire