problems with simple script

A

Anonymous

Guest
hi, i have this script, its not finished yet, but even this small piece doesnt work:

Code:
<?php
session_start();
?>
<html>
<head>
  <title>File upload</title>
</head>

<body>

<?php
  
  if($_SESSION['passwd'] != $_SESSION['r_pass']) {
   
  print("<b>Incorrect password</b>");
  } //end if
  else {
  
  $userfile = $_POST['file'];
  $dir1 = "C:\Program Files\Apache Group\Apache\htdocs\naquiken website"; //change $dir1 to the directory that this script is in
  $dir2 = $dir1 . $userfile;

  
  }

?>

</body>
</html>

if for example the file was "test.jpg" the output should have been "C:\Program Files\Apache Group\Apache\htdocs\naquiken website\test.jpg" right? but the output is allways "C:\Program Files\Apache Group\Apache\htdocs aquiken website" any ideas?
 
hey, thanks for replying, but i dont really know what the ['name'] part is?
 
Hi nick_k!
try do this:
Code:
  $dir1 = "C:\Program Files\Apache Group\Apache\htdocs\naquiken website\";
You forgot what you using Windows not Unix, if you in a future will use Unix this variant not worked.....
 
hmm if i do that i get this error:
"Parse error: parse error, unexpected $end in c:\program files\apache group\apache\htdocs\naquiken website\upload.php on line 29"
 
of your quotas set correctly that's all done
Code:
$dir1 = "C:\Program Files\Apache Group\Apache\htdocs\naquiken website\"; 
$dir2 = $dir1 . $userfile;

or try change at
Code:
$dir1 = "C:\\Program Files\\Apache Group\\Apache\\htdocs\\naquiken website\\"; 
$dir2 = $dir1 . $userfile;
 
ok heres my whole code, its really starting to piss me off now
Code:
<?php
session_start();
?>
<html>
<head>
  <title>File upload</title>
</head>

<body>

<?php 
 
  if($_SESSION['passwd'] != $_SESSION['r_pass']) {
   
  print("<b>Incorrect password</b>");
  } //end if
  else {
  
  $userfile = $_POST['file'];
  $dir1 = "C:\\Program Files\\Apache Group\\Apache\\htdocs\\naquiken website\\"; //change $dir1 to the directory that this script is in
  $dir2 = $dir1 . $userfile;
  copy($userfile, $dir2); 
  unlink($userfile);

  $fp = fopen("count.dat", "r+");
  $contents = fread($fp, filesize("count.dat"));
  
  $n_name = $countents . ".jpg";
 
  $dir3 = $dir1 . $n_name;
  rename($dir2, $dir3);
  print("file saved!");

?>

</body>
</html>

it doesnt work, plus the " if($_SESSION['passwd'] != $_SESSION['r_pass']) " doesnt work, the script will act as if the password is correct in all situations, maby all these problems are because on y server configuration (i re-installed it all not long ago)
 
Verish ya toje prikololsya dumal chto Nik burjuy a on kak ti govorish nash!
Nik ICQ vkluchay pobazarim! :^)
 
Back
Top