![]() |
!file_exists help
Hi guys
im trying to have a file created if not exist, so far i have PHP Code:
PHP Code:
i know this is not 100% correct but need the variable corrected |
Quote:
|
Quote:
|
I think this should work:
Code:
$ourFileName = $vbulletin->options['thefile']; but you probably wouldn't want the "or die()" part because that would leave you with a white page with an error message. You could do something like this: Code:
$ourFileName = $vbulletin->options['thefile']; Also, using "w" in the fopen call will truncate the file (make it empty), so if you don't want that, use either "r" or "a". |
Quote:
this worked for the end user but not the admin what was happening was the following 1) user visited forum 2) if variable was true, it wrote to the $ourFileName 3) but some admins could not create this file automacially ( for me it worked ) for another website ( admin did not work ) i will use the above code to see how today goes with it |
Well, the ability to create a file will depend on how the server permissions are set of course. You may have your set up to allow creation of a file anywhere whereas someone else doesn't (really you probably shouldn't allow it in the same directories that your php scripts are in, but I'm not a server config expert or anything). Maybe what you want to do is have an option to specify a directory, then instruct the admin to enter a path that has create permission for whatever user the web server runs as.
|
Quote:
only, this is why the $variable is called to create a file somewhere plugin : global start $seeks this file upon a $true value, which allows the $event to be logged the problem i am having with it is sharing this script which will also create the log in the same manner and folder, but they get the error message upon file creation and i dont which i am trying to figure out if its and issue with fopen or if (!file_exists($ourFileName)) which would be a permission issue somewhere on their webserver |
All times are GMT. The time now is 10:21 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|