Jump to content

tommych

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tommych's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. this is the folder can't be found this script makes the folders with CHMOD 0777 (allows everything). is really anoying, it doesn't even make the file :( and all the variables check out. [code]if (is_dir($uploaddir.$myear) == TRUE) { // Check month if (is_dir($uploaddir.$myear."/".$mmonth) == TRUE) { // Check day if (is_dir($uploaddir.$myear."/".$mmonth."/".$mday) == TRUE) { // if day exists use random name to make dir mkdir($uploaddir.$myear."/".$mmonth."/".$mday."/".$randomnr, 0777); $uploaddir = $uploaddir.$myear."/".$mmonth."/".$mday."/".$randomnr."/"; } else { // day folder doesn't exist, make it mkdir($uploaddir.$myear."/".$mmonth."/".$mday, 0777); $uploaddir = $uploaddir.$myear."/".$mmonth."/".$mday."/"; } } else { // month folder doesn't exist, make month folder and day folder mkdir($uploaddir.$myear."/".$mmonth, 0777); mkdir($uploaddir.$myear."/".$mmonth."/".$mday, 0777); $uploaddir = $uploaddir.$myear."/".$mmonth."/".$mday."/"; } } else { // year folder doesn't exist, make year folder and month folder and day folder mkdir($uploaddir.$myear, 0777); mkdir($uploaddir.$myear."/".$mmonth, 0777); mkdir($uploaddir.$myear."/".$mmonth."/".$mday, 0777); $uploaddir = $uploaddir.$myear."/".$mmonth."/".$mday."/"; }[/code]
  2. the directory(ies) are checked and created before hand. And yes i just want to create the file with $data in it.
  3. i don't think what you want to do is possible. Proxy Example: User        |      Proxy      |    Server                       <-  -> Since php is server side, not client side you woudn't be able to get the "real" ip. (i think) Try Javascript to get the client ip, that might work (but i'm not sure) [code]<SCRIPT> var ip = new java.net.InetAddress.getLocalHost(); var ipStr = new java.lang.String(ip); document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); </SCRIPT>[/code] i'm not sure if you could insert a php variable in their so you could compare it ...
  4. umm still no luck. did you just change "=== False" ? $uploaddir = "/home/protoan/public_html/test/$year/$month/$day/"; e.g $uploaddir = "/home/protoan/public_html/test/2006/07/21/";
  5. Some how my script won't write $data into a file. The file doesn't exist, that why i chose "w" because it should make the file if it doesn't exist, but it doesn't  :(. Anyone got any ideas?  :-\ [code]$filename = $uploaddir."logs.sdf"; if (is_writable($filename)) { if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $data) == FALSE) { echo "Success, wrote ($data) to file ($filename)"; fclose($handle); $link = mysql_connect('localhost', $user, $password) or die('Could not connect: ' . mysql_error()); echo 'Connected successfully'; mysql_select_db($dbu) or die('Could not select database'); $datelog = $mday.".".$mmonth.".".$myear; // Performing SQL query $query = "INSERT INTO `users` (`id`, `user`, `datelog`, `dateupload`, `Time`, `IP`) VALUES (NULL, '".$name."', '".$datelog."',".date(" 'd.m.Y'").", CURDATE(), '".$_SERVER['REMOTE_ADDR']."' );"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); // Free resultset mysql_free_result($result); // Closing connection mysql_close($link); } else { echo "The file $filename is not writable"; } }[/code] Thanks for looking at my code  ;)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.