Warning: fread(): supplied argument is not a valid stream resource in /home/f/c/5/817

Discussion in 'HTML & Website Design' started by coatse, May 15, 2011.

  1. #1
    Hi i have a problem in my php script i downloaded this member login script and i have set it up i go to http://www.village-education.com/extranet/login1/login.php and get the following errors

    Warning: fread(): supplied argument is not a valid stream resource in /home/f/c/5/8174/8174/public_html/extranet/login1/login.php on line 95

    Warning: fclose(): supplied argument is not a valid stream resource in /home/f/c/5/8174/8174/public_html/extranet/login1/login.php on line 98

    Fatal error: Call to undefined function encode_decode() in /home/f/c/5/8174/8174/public_html/extranet/login1/login.php on line 105

    below is my codeing for login.php

    <?php
    /************* Membership V2.0 *******************/
    /*
    Released by AwesomePHP.com, under the GPL License, a
    copy of it should be attached to the zip file, or
    you can view it on http://AwesomePHP.com/gpl.txt
    */
    /************* Membership V2.0 *******************/

    /*
    Login header - The following line MUST be included on TOPMOST of your website
    then put the form whereever you want. This is so, because we might need to redirect
    and PHP CAN NOT redirect after any output to the browser
    */

    /*
    The next line is to be placed on top-most of your site:
    */
    //require_once('extensions/login.php');


    require_once('languages/language.php');


    ?>
    <form name="login" id="login" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" style="display:inline;">
    <table width="100%" border="1" cellspacing="0" cellpadding="5">
    <tr bgcolor="#BEDEDE">
    <td colspan="2"><div align="center"><font color="#999999" size="4">User Login </font></div></td>
    </tr>
    <?php
    if($message != NULL){
    ?>
    <tr bgcolor="#FFDDDD">
    <td colspan="2"><strong><font color="#FF0000"><?php echo $message;?></font></strong></td>
    </tr>
    <?php } ?>
    <tr>
    <td>Select Membership: </td>
    <td width="50%"><font size="2">
    <select id="membership_id" name="membership_id" class="hiddenText">
    <?php
    foreach($membershipList as $em){
    if($_POST['membership_id'] == $em['membership_id']){ $sel= ' selected';}else{$sel=NULL;}
    echo '<option value="'.$em['membership_id'].'"'.$sel.'>'.$em['membership_title'].'</option>';
    }
    ?>
    </select>
    </font></td>
    </tr>
    <tr>
    <td width="50%">Please enter Email: </td>
    <td width="50%"><input name="user_email" type="text" id="user_email" value="<?php echo $_POST['user_email'];?>">
    </td>
    </tr>
    <tr>
    <td>Please enter Password: </td>
    <td width="50%"><input name="user_password" type="password" id="user_password"></td>
    </tr>
    <?php
    if($CF_CAPTHCA == 'IMAGE'){?>
    <tr>
    <td>Enter Verification Code: </td>
    <td><table border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td class="acont"><div align="center">
    <?php
    $referenceid = md5(mktime()*rand());
    //Generate the random string
    $chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J","k",
    "K","l","L","m","M","n","N","o","O","p","P","q","Q","r","R","s","S","t","T","u","U","v",
    "V","w","W","x","X","y","Y","z","Z","1","2","3","4","5","6","7","8","9");
    $length = $CF_LENGH;
    $textstr = "";
    for ($i=0; $i<$length; $i++) {
    $textstr .= $chars[rand(0, count($chars)-1)];
    }
    $new_string = encode_decode($textstr,$CF_ENCDEC);
    $image_link = bin2hex($new_string);
    ?>
    <img src="captcha.php?code=<?php echo $image_link;?>">
    <input name="registration_id" type="hidden" id="registration_id" value="<?php echo $image_link;?>">
    </div></td>
    </tr>
    <tr>
    <td class="acont"><div align="center">
    <input name="answer" type="text" id="answer">
    </div></td>
    </tr>
    </table></td>
    </tr>
    <?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));
    ?>
    <tr>
    <td>Answer this: <strong><?php echo $question;?></strong> </td>
    <td><input name="answer" type="text" id="answer" value="<?php echo $_POST['answer'];?>">
    <input name="registration_id" type="hidden" id="registration_id" value="<?php echo $registration_id;?>"></td>
    </tr>
    <tr>
    <td colspan="2"><div align="center">
    <input id="persistent" name="persistent" value="yes" checked="checked" type="checkbox">
    Keep me signed in<br>
    <font color="#999999" size="2">for
    <select name="persistentFor" id="persistentFor" style="border:0px;color:#999999;font-size:10px;">
    <?php
    if($_POST['persistentFor'] == NULL){$_POST['persistentFor'] = 2;}
    for($x=1;$x<=480;$x++){
    if($x == $_POST['persistentFor']){$sel= ' selected';}else{$sel=NULL;}
    echo '<option value="'.$x.'"'.$sel.'>'.$x.'</option>';
    }
    ?>
    </select> week unless I sign out.<br/>
    [Uncheck if on a shared computer] </font>
    </div></td>
    </tr>
    <?php } ?>
    <tr bgcolor="#BEDEDE">
    <td colspan="2"><div align="center">
    <input type="submit" name="Submit" id="Submit" value="Login">
    <input name="S_ID" type="hidden" id="S_ID" value="2">
    </div></td>
    </tr>
    <tr bgcolor="#CAFFCA">
    <td colspan="2"><div align="center">[<a href="forgotpass.php">Forgot Password </a> - <a href="register.php">Register</a>] </div></td>
    </tr>
    </table>
    </form>

    Thank you all help will be greatly appreciated

    James
     
    coatse, May 15, 2011 IP