Current location: Hot Scripts Forums » Programming Languages » PHP » is this a Mac problem?


is this a Mac problem?

Reply
  #1 (permalink)  
Old 12-07-05, 08:27 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
is this a Mac problem?

Hi there,

I got myself a nice form with upload function...
there's only one problem.. it isn't working on a Mac.

is there something in the code that I need to change for this?..

this is my code:


<?php

$PostPage = "plaatsen.php";

$gbPage = "boten.php";



if (($naam == "") AND ($type == "") AND ($bouwjaar == "") AND ($afmeting == "") AND ($slaapplaats == "") AND ($materiaal == "") AND ($brandstof == "") AND ($vermogen == "") AND ($bouwjaarmotor == "") AND ($overige == "")) {



$error1 = "<font size='3' class='s4' color='red' face='Arial, Helvetica'><STRONG>It appears as if you've tried to submit a blank form:</STRONG></font><br>";

echo $error1;

include($PostPage);



} else {
if($userfile <> "") {
$bestandsnaam = $userfile_name;
if(preg_match('/\.(php|asp|pl|cgi|java|cfm)$/i',$bestandsnaam)){
echo 'serverside scripts zijn niet toegestaan';
// stop alle php-scripts
exit(-1);
}
$grootte = file_get_contents($userfile, 'rb');
$grootte = strlen($grootte);
if($grootte >= 160000) {
echo "De foto is te groot, de foto kan maximaal 150kb groot zijn. Probeer het opnieuw.";
exit(-1);
}
$test = 0;
if(file_exists("fotos/$bestandsnaam")) {
while ($test == 0):
if(file_exists("fotos/$bestandsnaam")) {
$bestandsnaam = "1$bestandsnaam";
} else {
$test = 1;
}
endwhile;
}
copy($userfile, "fotos/" . $bestandsnaam);
unlink($userfile);
} else {
$bestandsnaam = "geenfoto.jpg";
}

if($userfile2 <> "") {
$bestandsnaam2 = $userfile2_name;
if(preg_match('/\.(php|asp|pl|cgi|java|cfm)$/i',$bestandsnaam2)){
echo 'serverside scripts zijn niet toegestaan';
// stop alle php-scripts
exit(-1);
}
$grootte = file_get_contents($userfile2, 'rb');
$grootte = strlen($grootte);
if($grootte >= 160000) {
echo "De foto is te groot, de foto kan maximaal 150kb groot zijn. Probeer het opnieuw.";
exit(-1);
}
$test = 0;
if(file_exists("fotos/$bestandsnaam2")) {
while ($test == 0):
if(file_exists("fotos/$bestandsnaam2")) {
$bestandsnaam2 = "1$bestandsnaam2";
} else {
$test = 1;
}
endwhile;
}
copy($userfile2, "fotos/" . $bestandsnaam2);
unlink($userfile2);
} else {
$bestandsnaam2 = "geenfoto.jpg";
}

if($userfile3 <> "") {
$bestandsnaam3 = $userfile3_name;
if(preg_match('/\.(php|asp|pl|cgi|java|cfm)$/i',$bestandsnaam3)){
echo 'serverside scripts zijn niet toegestaan';
// stop alle php-scripts
exit(-1);
}
$grootte = file_get_contents($userfile3, 'rb');
$grootte = strlen($grootte);
if($grootte >= 160000) {
echo "De foto is te groot, de foto kan maximaal 150kb groot zijn. Probeer het opnieuw.";
exit(-1);
}
$test = 0;
if(file_exists("fotos/$bestandsnaam3")) {
while ($test == 0):
if(file_exists("fotos/$bestandsnaam3")) {
$bestandsnaam = "1$bestandsnaam3";
} else {
$test = 1;
}
endwhile;
}
copy($userfile3, "fotos/" . $bestandsnaam3);
unlink($userfile3);
} else {
$bestandsnaam3 = "geenfoto.jpg";
}

if($userfile4 <> "") {
$bestandsnaam4 = $userfile4_name;
if(preg_match('/\.(php|asp|pl|cgi|java|cfm)$/i',$bestandsnaam4)){
echo 'serverside scripts zijn niet toegestaan';
// stop alle php-scripts
exit(-1);
}
$grootte = file_get_contents($userfile4, 'rb');
$grootte = strlen($grootte);
if($grootte >= 160000) {
echo "De foto is te groot, de foto kan maximaal 150kb groot zijn. Probeer het opnieuw.";
exit(-1);
}
$test = 0;
if(file_exists("fotos/$bestandsnaam4")) {
while ($test == 0):
if(file_exists("fotos/$bestandsnaam4")) {
$bestandsnaam4 = "1$bestandsnaam4";
} else {
$test = 1;
}
endwhile;
}
copy($userfile4, "fotos/" . $bestandsnaam4);
unlink($userfile4);
} else {
$bestandsnaam4 = "geenfoto.jpg";
}

$gbFile = "boten.txt"; // Location of link database file

$gbPage = "boten.php"; // Link page file



$notify = 0; // Would you like to be notified when a link is added? 1 = yes, 0 = No

$my_email = "john@rem-reclame.nl"; // Enter your email address

$subject = "geen" ; // Enter the subject of the notification email



$page = $gbFile;



// $name = ereg_replace("<","&lt;",$name);

// $name = ereg_replace(">","&gt;",$name);

// $email = ereg_replace("<","&lt;",$email);

// $email = ereg_replace(">","&gt;",$email);

// $url = ereg_replace("<","&lt;",$url);

// $url = ereg_replace(">","&gt;",$url);

// $urltitle = ereg_replace("<","&lt;",$urltitle);

// $urltitle = ereg_replace(">","&gt;",$urltitle);

// $referral = ereg_replace("<","&lt;",$referral);

// $referral = ereg_replace(">","&gt;",$referral);

// $comments = ereg_replace("<","&lt;",$comments);

// $comments = ereg_replace(">","&gt;",$comments);





$overige = ereg_replace("\n","<BR>",$overige);

$fileMessage = "<p0>$naam<p0>$type<p0>$materiaal<p0>$afmeting<p0> $bouwjaar_motor<p0>$bouwjaar<p0>$slaapplaats<p0>$b randstof<p0>$vermogen<p0>$overige<p0>$bestandsnaam <p0>$bestandsnaam2<p0>$bestandsnaam3<p0>$bestandsn aam4<p0>\n";

$cartFile = fopen("$page","a+");

fputs($cartFile,$fileMessage);

fclose($cartFile);


// EMAIL THE NEW POST



if ($notify == 1) {



$comments = ereg_replace("<BR>","\n",$comments);

mail ("$my_email", "Nieuw Gastenboek Item", "Name : $name Email : $email Note: $comments\n", "From: $email\n");

}



//print ("<center>Testing also</center>");

//include($gbPage);

echo "<br>Uw invoer is geplaatst <br><br>";
echo "<a href=\"plaatsen.php\" target=\"edit\">Terug naar overzicht</a><br><br>";



}
?>
Reply With Quote
  #2 (permalink)  
Old 12-07-05, 08:31 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I don't think this is a OS problem since PHP is a server side application.
Reply With Quote
  #3 (permalink)  
Old 12-07-05, 08:49 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
That was also my opinion....

the strange thing is that it works on windows but not on mac..
Reply With Quote
  #4 (permalink)  
Old 12-07-05, 03:44 PM
ben.periton ben.periton is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
When you say 'it isn't working on a Mac', what exactly isnt working? The upload, or the selecting the file, or is the script running on a Mac?
__________________
Ben Periton
http://ben.periton.co.uk
Reply With Quote
  #5 (permalink)  
Old 12-08-05, 03:14 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
in the script there is an upload option.

If a file is uploaded "$bestandsnaam" is the name of the file.
If there is no uploading file "$bestandsnaam" schould be "geenfoto.jpg"

When I'm uploading a file now "$bestandsnaam" is always "geenfoto.jpg"
instead of the uploading filename
Reply With Quote
  #6 (permalink)  
Old 12-08-05, 07:10 AM
ben.periton ben.periton is offline
Wannabe Coder
 
Join Date: Oct 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
Does this script work on a pc?

Also, where do you define $userfile when you do?
PHP Code:

if($userfile <> "") { 

If $userfile is not defined, then how can you use it? Unless you have register_globals turned on, which is not a good idea anyway.
__________________
Ben Periton
http://ben.periton.co.uk
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
Problem with if statements filth PHP 1 08-04-05 09:18 PM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM
Getting MAC address using PHP - please help! mishmia PHP 1 06-04-04 07:38 PM


All times are GMT -5. The time now is 06:22 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.