phpSensei Posted April 12, 2009 Share Posted April 12, 2009 On line 6 this class has a parse error. I havnt used PHP in a long time, I trasnfered to VB.net, C++, and now its so funny trying to code. I put IF THEN, I missed semi colons if not totally not using them, so if you are kind enough to take a quick look I would be happy. <?php class upload{ // visibilities Private $checkpoints = 0; // how many check points has the software gone through Private $sitelink = "http://localhost/classes/upload.class.php"; // We Need This For Hack Attempts Private $referrer = $_SERVER['HTTP_REFERRER']; // Our Http Ref Private $domain = $sitelink; Private $file = array("filename" =>"","filetype" => "","filesize" => "","filetemp" => "");// Stack of allowed file types // our main function function uploader($filename,$filetype,$filesize,$filetemp){ // Assing the variables $file["filename"] = $filename; $file["filetype"] = $filetype; $file["filesize"] = $filesize; $file["filetemp"] = $filetemp; // Check the referrer if (checkHttp($sitelink,$referrer)==true){ print "You're Http Referrer is just fine"; } } // hack attemp 1 function checkHttp($sitelink,$htttpreferrer){ // check if there is any output if ($httpreferrer == ""){ $this->domain = $sitelink; return true; }else{ $this->domain = parse_url($httpreferrer); return true; } if($httpreferrer == $sitelink){ return true; }else{ return false; } } // this function can be further expanded, but the main reason I made it is to check for usual security issues function checkVars($var){ // check if variable is empty if (empty($var)){ // trigger error } } function checkFileSize(){ } function checkFileType(){ } function checkDuplicate(){ } function checkHash(){ } } // Testingggg!!! love this part $file = new upload; $file = $file->uploader(1,2,3,4); ?> Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 What's your error then? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 13, 2009 Author Share Posted April 13, 2009 What's your error then? line 6. parse error Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 13, 2009 Share Posted April 13, 2009 Default values (when you declare a variable) cannot be a variable. It must be a constant expression. Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 Just "parse error"? I get unexpected T_VARIABLE It appears as though it doesn't like you declaring variables as other variables. Not sure why tbh. Kind of odd :-\ Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 Oh, well that's probably why. I didn't know you couldn't do that... Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 You could achieve the same thing with a constructor though. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 13, 2009 Author Share Posted April 13, 2009 Ya solved, thanks everyone.... I got this solved by using a constructor. Quote Link to comment Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.