Help with correcting warning message after instalation.

Discussion in 'PHP' started by ScottDB, Oct 1, 2011.

  1. #1
    Hi, I just uploaded a simple membership site called FP Membership V 1.0 from http://www.awesomephp.com/index.php?Membership. I upladed and configured it as instructed and chaged all the permissions. The installer went ok and I can edit from admin and stuff but when I went to the log in page I am getting the following error messges

    <script>
    Warning: fopen() [function.fopen]: Filename cannot be empty in /home/scott/public_html/3test/login.php on line 94

    Warning: fread(): supplied argument is not a valid stream resource in /home/scott/public_html/3test/login.php on line 95

    Warning: fclose(): supplied argument is not a valid stream resource in /home/scott/public_html/3test/login.php on line 98

    Fatal error: Call to undefined function encode_decode() in /home/scott/public_html/3test/login.php on line 105
    </script>

    I have this for the code mentioned
    <script>
    <?php
    } else {
    $f = fopen($CF_QUESTIONFILE,'r');
    while($t = fread($f,102465)){
    $content .= $t;
    }
    fclose($f);
    $content = trim(preg_replace('/\/\*.*\*\//ism', '', $content));

    $temp = explode("\n",$content);
    $random = rand(0,count($temp)-1);
    $rand = $temp[$random];
    list($question,$registration_id) = explode('\n\\',$rand);
    $registration_id = bin2hex(encode_decode($registration_id,$CF_ENCDEC));
    ?>
    </script>
    The first line being 92
    Can someone help me out here?
     
    ScottDB, Oct 1, 2011 IP
  2. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #2
    Looks like $CF_QUESTIONFILE is empty. You might want to have a look throughout the script as to where that's initialised and make sure everything is ok.
     
    Alex Roxon, Oct 1, 2011 IP
  3. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #3
    Use var_dump($variable_name_here) on the variable which isn't working and see what you get.
     
    HuggyEssex, Oct 2, 2011 IP
  4. gtk29

    gtk29 Member

    Messages:
    519
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    You are not able to open the file. Other errors are related to this.
    Check what is inside this variable $CF_QUESTIONFILE
    by doing echo $CF_QUESTIONFILE;
     
    gtk29, Oct 2, 2011 IP
  5. ScottDB

    ScottDB Greenhorn

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    Well now I feel stupid. I deleted the site and re uploaded it thinking I had a bad file upload or something. Hey it's happened before. During the upload I re read the instructions and found this.

    - If you are not implementing this script into your current application, then simply uncomment the :

    require_once('extensions/file.php');

    Slolved that problem.

    Now I've made sure that all the correct chmod settings are correct and with a fresh upload I am getting the following errrors. Was wondering if it is a script problem or hosting problem since it is an htaccess file.

    For the registration I am getting this error code when I sign up. I do however get signed up but no redirect after sign up.
    Warning: file_put_contents() [function.file-put-contents]: Filename cannot be empty in /home/scott/public_html/3test/headers/htpasswd.php on line 112

    When I go to the admin and try and delet a user I get this and the user is deleted though.

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/scott/public_html/3test/headers/htpasswd.php on line 109

    Warning: Invalid argument supplied for foreach() in /home/scott/public_html/3test/headers/htpasswd.php on line 109

    Warning: file_put_contents() [function.file-put-contents]: Filename cannot be empty in /home/scott/public_html/3test/headers/htpasswd.php on line 112

    This is what I have for the headers/htpasswd.php. First line is line 106
    function save($file=false){
    $fcontents = "";
    if($file == false) $file = $this->_path;
    foreach(array_keys($this->users) as $user){
    $fcontents .= $user.":".$this->users[$user]."\n";
    }
    if(file_put_contents($file, $fcontents)){
    $this->error = '';
    return true;
    }else{
    $this->error = 'Couln\'t save the file!';
    return false;
    }
    }
     
    ScottDB, Oct 2, 2011 IP
  6. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #6
    In line 112, $file is empty.

    In line 109, users isn't an array.

    Methinks the code you're using is very poorly written. No error trapping? It should error out neatly, not with raw PHP errors. (And the error in 109 is just blatant bad code.)
     
    Rukbat, Oct 7, 2011 IP
  7. ScottDB

    ScottDB Greenhorn

    Messages:
    95
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    Hey, thanks for the response. Was just about to repost. I figured the script might have a bug or two in it. Was hoping that it was something that is easily fixable. It is a very small open source script with just the basics. Link is on first post.

    This is the 4th script I have tried for this. I am trying to find the smallest membership script I can find to start with. I started out just using a membership log in script and starting from that. The one thing I need to do is easily edit the profiles. This script has that built in.

    Can someone tell me if the script is fixable or can someone suggest another script?
     
    ScottDB, Oct 8, 2011 IP
  8. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #8
    Membership in what? There are many CMS scripts that work (see Home - OpenSourceCMS ). Or you could use something like MyBB if you want a forum. What you use depends on what you want.
     
    Rukbat, Oct 8, 2011 IP