SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    failed to open stream error

    i have a page that includes 3 different files.

    newmember.php

    menu.php

    footer.php

    menu and footer include fine. but with newmember i get the error:

    Warning: include(E:\users\d003703a\webpages\newmember.php): failed to open stream: Permission denied in E:\users\d003703a\webpages\register1.php on line 2 Warning: include(): Failed opening 'newmember.php' for inclusion (include_path='.;C:\php5\pear') in E:\users\d003703a\webpages\register1.php on line 2

    newmember, menu and footer are all in the same directory, so why would this happen?

  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Is register1.php in newmembers or is it the page you are making now? Please post the code for newmember and register1.php in [ php ] tags.
    Ryan B | My Blog | Twitter

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    // register1.php ---------------------------
    PHP Code:
    <?php
    include('newmember.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="CSS/styleMain.css" rel="stylesheet" type="text/css" />
    <title>Untitled Document</title>
    </head>

    <body>
    <div id="mainWrap">
        <?php include('menu.php'); ?>
        <ul id="registerBar">
            <li>Stage 1</li>
            <li>Stage 2</li>
            <li>Stage 3</li>
        </ul>
        <div id="stage1">
            <form action="register2.php" method="post">
                <p>Name:</p>
                <input type="text" name="userName" size="10" />
                <p>Password:</p>
                <input type="password" name="pass1" />
                <p>Re-Enter Password:</p>
                <input type="password" name="pass2" />
                <p>
                <input type="submit" name="sub1" value="next" />
                </p>
            </form>
        </div>
    </div>
    <?php include('footer.html'); ?>
    </body>
    </html>

    // new member.php ------------------------

    <?php
    session_start
    ();
    ERROR_REPORTING(E_ALL);
    if(isset(
    $_POST['sub1']))
    {
        
    $_SESSION['username'] = $_REQUEST['userName'];
        
    $_SESSION['pass1'] = $_REQUEST['pass1'];
        
    $_SESSION['pass2'] = $_REQUEST['pass2'];
    }

    if(isset(
    $_POST['sub2']))
    {
        
    $_SESSION['fullname'] = $_REQUEST['full_name'];
        
    $_SESSION['email'] = $_REQUEST['email'];
        
    $_SESSION['day'] = $_REQUEST['days']; $_SESSION['month'] = $_REQUEST['months']; $_SESSION['year'] = $_REQUEST['years'];
        
    $_SESSION['address1'] = $_REQUEST['address1'];
        
    $_SESSION['address2'] = $_REQUEST['address2'];
        
    $_SESSION['address3'] = $_REQUEST['address3'];
        
    $_SESSION['address4'] = $_REQUEST['address4'];
    }

    $username $_SESSION['username'];
    $pass1 $_SESSION['pass1'];
    $fullname $_SESSION['fullname'];
    $email $_SESSION['email'];
    $day $_SESSION['day'];
    $address1 $_SESSION['address1'];
    $address2 $_SESSION['address2'];
    $address3 $_SESSION['address3'];
    $address4 $_SESSION['address4'];
    $emailcheck $_SESSION['emailcheck'];
    $termcheck $_SESSION['termcheck'];

    $host="localhost";
    $user="d003703a";
    $password="pass91";

    $link mysql_connect($host$user$password);

    if(!
    $link) {
      echo 
    "Unable to connect";
    }

    $result mysql_select_db("iwp_d003703a");
    if(!
    $result) {
      echo 
    "No database";
    }

    if(isset(
    $_POST['sub3']))
    {
        
    $emailcheck $_REQUEST['emailcheck'];
        
    $termcheck $_REQUEST['termcheck'];
        
    $SQL "INSERT INTO members (`username`, `password`, `fullname`, `email`, `dob`, `address`, `telephone`, `emailcheck`, `termcheck`) VALUES ('$username','$pass1','$fullname','$email','$day','$address1','$address2','$address3','$address4','$emailcheck','$termcheck')";
        
    $result mysql_query($SQL);
    }
    ?>
    Last edited by AnthonySterling; Mar 30, 2011 at 07:51. Reason: Added BBCode

  4. #4
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rguy84 View Post
    Please post the code for newmember and register1.php in [ php ] tags.
    Did you not read that? - If you don't help people to help you then you won't get much help.

    PHP Code:
    //This is why we ask for it in php tags
    function it()
       {
       print 
    $Var;
       }
    function 
    format()
       {
       
    $Var 'This is a string';
       
    it($Var);
       } 
    Additionally you've not answered rguys question either. You've just done the 'dump n run' thing.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i did post the code in php tags?

    and no register1 is what i am creating yes, newmember is the page with all the php code in it. register1 is the php. i am making a 3 page registration system

  6. #6
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you posted in <? and ?> tags. That is not the same as rguy showed you. The forum has a sticky topic about posting guidelines. You might want to look at number 9. The title clearly says "Please read this" in it so you've clearly ignored it choosing instead to 'dump n run'.

    Please just edit your post and use the tags.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah my bad...

  8. #8
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As rguy has also said, please can you also post newmember.php too?

    I can't see anything glaring out at me in the code you've posted so this could be an OS problem for some reason.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  9. #9
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a thought..

    Before each include statement try using print getcwd();

    Let us know the results.
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.

  10. #10
    SitePoint Enthusiast
    Join Date
    Jan 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i have sorted the problem now, i copied the code into a new .php file and included that. and it worked. seems that the newmember.php was just corrupt on creation

  11. #11
    SitePoint Guru
    Join Date
    Aug 2009
    Posts
    669
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Odd.. but I have known that to happen myself and it had me going round in circles for days..
    I'll do anything to avoid working on my own code

    Are you using: if (isset($_POST['submit'])) ?
    IE has a bug and does not always send the value.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •