SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    12
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP page not displaying

    Hi, I am a newbie at php. I sort of inherited a php problem. This page: http://www.exoticyogaretreats.com/re...ions/admin.php was custom designed but is not displaying properly. Any help on why would be awesome. Thanks.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    Why do you think this is a PHP problem?

    If you're talking about the form not showing, try loading the page with javascript turned off.
    yoga.png

  3. #3
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    12
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I just assumed it was a php problem. This is supposed to be the admin page for a custom designed price section. The person cannot login to make changes to the other pages. Sorry I am kind of flying blind here. Thanks.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    So you mean
    yoga-login.png
    The view-source shows
    PHP Code:
    <!-- Login form here --><form name='formVlogin' id='formVlogin' method='post' action='processVlogin.php'>
    <
    input type='hidden' name='source' value='desktop' />
    <
    fieldset>
    <
    label>Username</label>
    <
    input name='username' id='username' class='input-large validate[required]' type='text'>

    <
    label style='margin-top:10px;'>Password</label>
    <
    input name='passcode' id='passcode' class='input-large validate[required]' type='password'>
    <
    div class='xbF00' style='padding-top:10px;'>
    <
    button type='submit' id='submitVlogin' class='btn pull-right'>Sign in</button>
    <
    label class='checkbox' style='padding-top:10px;'>
    <
    input type='checkbox' class='mT4' checkedRemember me
    </label>
    <
    br /></div>

    </
    fieldset>
    </
    form
    So if that form isn't working it could be a problem with the processVlogin.php file.

    Is processVlogin.php too big to post or attach here?

  5. #5
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    12
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hi, this is actually processVlogin.php. I hope this what you need.
    Thanks.
    Code PHP:
    <?php
    if(isset($_POST['username'])){
    // Page-specific includes
    include('includes/connection.php');
    // Variables(include Arrays,Objects,etc)
    // Tables
    include('includes/tblAdmin.php');
    //include('includes/tblClient.php');
     
    include('includes/global.php');
    $username=strtolower($_POST['username']);
    $passcode=$_POST['passcode'];
    $source=$_POST['source'];
     
    $q="SELECT * FROM admin WHERE username LIKE BINARY '$username' AND passcode LIKE BINARY '$passcode'";$rs=mysql_query($q);//echo $q;exit();
    //$qb="SELECT * FROM client WHERE username LIKE BINARY '$username' AND passcode LIKE BINARY '$passcode'";$rsb=mysql_query($qb);//echo $qb;exit();
       if($source=='desktop'){   $adminUrl="yogaretreats.php";    $clientUrl="";    $invalidUrl="admin.php?e0x=1";        }
    elseif($source=='mobile'){       }
    else{$invalidUrl="sign-in.php?e0x=1";}
     
        if($username==''||$passcode==''||$source==''){header("Location: $invalidUrl");}
    elseif(mysql_num_rows($rs)>0){
    // ____________________ SOF Part A _____________________
    $rw=mysql_fetch_array($rs);for($i=0;$i<count($tblAdminFld);$i++){$f_tblMmUserFld[$i]=$rw[$tblAdminFld[$i]];}
    if($username==$f_tblMmUserFld[1]&&$passcode==$f_tblMmUserFld[2]){
    setcookie(adminUsername,$f_tblMmUserFld[1],$cokieExp);setcookie(adminPasscode,$f_tblMmUserFld[2],$cokieExp);header("Location: $adminUrl");}
    else{header("Location: $invalidUrl");}
    // ____________________ EOF Part A _____________________
    }
    /*elseif(mysql_num_rows($rsb)>0){
    /* ____________________ SOF Part B _____________________ *
    $rwb=mysql_fetch_array($rsb);for($i=0;$i<count($tblClientFld);$i++){$f_tblClientFld[$i]=$rwb[$tblClientFld[$i]];}
    if($username==$f_tblClientFld[1]&&$passcode==$f_tblClientFld[2]){
    setcookie(clientUsername,$f_tblClientFld[1],$cokieExp);setcookie(clientPasscode,$f_tblClientFld[2],$cokieExp);header("Location: $clientUrl");}
    else{header("Location: $invalidUrl");}
    /* ____________________ EOF Part B _____________________ *
    }*/
    else{header("Location: $invalidUrl");}
     
    mysql_close($con);
    }
    ?>
    Last edited by Mittineague; Dec 9, 2013 at 17:42. Reason: reformatting bbcode tags

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,271
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    I can see a few potential problem causers.

    The code looks old because it's using deprecated mysql functions instead of mysqli or PDO
    The query has "LIKE BINARY" which depending on the schema might be causing a problem
    The include files might be messing things up.
    The $tblAdminFld looks to not be defined anywhere (in an include file?)
    - this might cause the code to not set the cookie and send users to admin.php?e0x=1 (or maybe sign-in.php?e0x=1)
    Likewise if the query fails
    - this might send users to admin.php?e0x=1 (or maybe sign-in.php?e0x=1)

    To narrow things down, try temporarily adding the var_dump lines
    Code PHP:
    // For Debugging ONLY
    var_dump($_POST['username']); 
    var_dump($_POST['passcode']); 
    var_dump($_POST['source']); 
    die;
    // End debugging lines
    if(isset($_POST['username'])){
    ........... //the rest of the file

    Don't post any real names or passwords, just whether or not you see what you're expecting to see.
    Once you find out, change it back ASAP


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
  •