Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Posts posted by DeanWhitehouse

  1. this is my code, does anyone no why it isn't working

    <?php
    require_once 'db_connect.php';
    require_once 'config_table.inc.php';
    
    $sql="SELECT * FROM $forum_quest ORDER BY id DESC";
    // OREDER BY id DESC is order result by descending
    $result=mysql_query($sql);
    ?>
    
    <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
    <td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
    <td width="53%" align="center" bgcolor="#E6E6E6"><strong>Topic</strong></td>
    <td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
    <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td>
    <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
    </tr>
    
    <?php
    while($rows=mysql_fetch_array($result)){ // Start looping table row
    ?>
    <tr>
    <td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
    <td bgcolor="#FFFFFF"><a href="view_topic.php?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
    <td align="center" bgcolor="#FFFFFF"><? echo $rows['view']; ?></td>
    <td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td>
    <td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td>
    </tr>
    
    <?php
    // Exit looping and close connection
    }
    mysql_close();
    ?>
    <tr>
    <td colspan="5" align="right" bgcolor="#E6E6E6"><a href="create_topic.php"><strong>Create New Topic</strong> </a></td>
    </tr>
    </table>

  2. this should send you in the right direction

    <?php
    $Search = mysql_query(
    "SELECT DISTINCT Courses.Course_Name, student_courses.Course_ID, student_courses.Student_ID, 
    students.Enrollment, students.First_Name, students.Last_Name FROM Courses INNER JOIN student_courses 
    ON Courses.Course_ID = student_courses.Course_ID INNER JOIN students ON student_courses.Student_ID = 
    students.Student_ID WHERE Courses.Course_ID='$Course'") or die(mysql_error());
    echo "<table border='0'>
    <tr align='center'>
    <td width='20%'><font color='#FFFFFF' face='Calibri'>
    <b>Enrollment No
    </td><td width='20%'><font color='#FFFFFF' face='Calibri'>
    <b>First Name
    </td><td width='20%'><font color='#FFFFFF' face='Calibri'><b>Last Name</td></tr>"
    
    while($row = mysql_fetch_assoc($Search))
    $sql = mysql_query(SELECT DISTINCT/*put where the attendance data is coming from here*/); or die(mysql_error());
    if ($sql == 1)/*this is the data from the database, 1 = present*/
    {
    echo "<tr align='center'>
    <td><font color ='White' face = 'calibri'> $row['Enrollment'];
    </td><td><font color ='White' face = 'calibri'> $row['First_Name'];
    </td><td><font color ='White' face = 'calibri'> $row['Last_Name'];
    </td></tr><tr><td><font color ='White' face = 'calibri'>Present </td></tr></table></font>";
    }
    elseif ($sql == 2))/*this is the data from the database, 2= not present*/
    {
    echo "<tr align='center'>
    <td><font color ='White' face = 'calibri'> $row['Enrollment'];
    </td><td><font color ='White' face = 'calibri'> $row['First_Name'];
    </td><td><font color ='White' face = 'calibri'> $row['Last_Name'];
    </td></tr><tr><td><font color ='White' face = 'calibri'>Absent </td></tr></table></font>";
    }
    
    ?>

  3. ok, thanks,

    this is now my working code

    <?php
    require_once 'includes/config_table.inc.php';
    require_once 'includes/db_connect.php';
    mysql_query("SELECT * from `$user` WHERE user_name='$user_name'");
    if ($_SESSION['is_valid'] == true){
    if ($_SESSION['user_level'] == 2){
    echo "<table class='logged_in'><tr><td>
    Welcome $user_name,<br>
    <a href=''>User Profile</a><br>
    <a href=''>Settings</a>
    <a href='logout.php'>Logout</a>
    </td></tr><tr><td><font color='white'>Logged In</font></td></tr></table>";
    }
    if ($_SESSION['user_level'] == 1){
    
    echo "<table class='logged_in'><tr><td>
    Welcome $user_name,<br>
    <a href=''>User Profile</a><br>
    <a href=''>Settings</a>
    <a href='logout.php'>Logout</a>
    </td></tr><tr><td><font color='white'>Logged In</font></td></tr></table>";
    }
    }
    else
    {
    include_once ('login.php');
    }
    ?>
    
    

    how can i display the user name of the user, i am using sessions and cookies

  4. when i remove the curly bracket i get this error

    Parse error: syntax error, unexpected $end in /home/www/deanwhitehouse.awardspace.co.uk/logged_in.php on line 26

    and you can write includes and requires without the brackets

  5. the table name is saved as a variable, so no to "SELECT * FROM users and i want to display the users username, but i can't think of a way to.

    Anyway back to the main problem, of the login page not displaying

  6. <?php
    if ($_SESSION['is_valid'] == true){
    if ($_SESSION['user_level'] == 2){
    mysql_query("SELECT * from `$user` WHERE user_name");
    echo "<table class='logged_in'><tr><td>
    Welcome $user_name,<br>
    <a href=''>User Profile</a><br>
    <a href=''>Settings</a>
    <a href='logout.php'>Logout</a>
    </td></tr><tr><td><font color='white'>Logged In</font></td></tr></table>";
    }
    if ($_SESSION['user_level'] == 1){
    mysql_query("SELECT * from `$user` WHERE user_name");
    echo "<table class='logged_in'><tr><td>
    Welcome $user_name,<br>
    <a href=''>User Profile</a><br>
    <a href=''>Settings</a>
    <a href='logout.php'>Logout</a>
    </td></tr><tr><td><font color='white'>Logged In</font></td></tr></table>";
    }
    else
    {
    include_once'login.php';
    }
    }
    ?>
    
    

     

    this code is ment to display a login form if the user is not logged in, but it doesn't, and i dunno why

  7. <?php
    if(isset($_POST['construction'])){
        $construction = $_POST['construction'];
        $handle = fopen('config.php', 'w+'); //open the file for writing
        $content = "<?php define('CONSTRUCTION', '{$construction}'); ?>"; //the content to be written
        fwrite($handle, $content); //write it
        fclose($handle);
    }
    ?>
    
    <form action="<?php $_SERVER['PHP_SELF']; ?>" method='POST'>
    <select name="construction">
    <option value="yes">yes</option>
    <option value="no">no</option>
    </select>
    <input type="hidden" name="construction" value="true"><input type="submit" value="Submit">
    </form>

  8. <?php
    echo'<div id="contact">
    	<h2>You have an error please check your message and try again!</h2>
      <form id="contact_form" name="contact_form" method="post" action="$_SERVER['PHP_SELF']">
      	<label>Name:<br />
    		<input name="name" type="text" class="form" id="name" />  
    	</label>
    	<br /><br />
      	<label>Email:<br />
    		<input name="email" type="text" class="form" id="email" />
     	</label>
      	<br /><br />
      		Message:<br />
      	<label>
      			<textarea name="message" cols="45" rows="5" class="form" id="message"></textarea>
      	</label>
      		<br /><br />
      	<label>
      			<input name="submit" type="submit" class="form_button" id="submit" value="Submit" />
      	</label>
      </form>
    </div>
    
    ';
    }
    elseif (isset($email)||isset($name)||isset($message)||!empty($message)||!empty($email)||!empty($name))
    {
    echo '   <div id="contact">
          <form enctype="multipart/form-data" name="contact_form" method="post" action="$_SERVER['PHP_SELF']">
    <br /><br /><Br /><br /><b> Thank You,<br /><br />  Vicious Vamp will review your message soon!<br /><br /></b>
      </form>
    </div>
    ';
    
    mail('viciousvamp@gmail.com','Mail for ViciousVamp',$message,$headers);
     }
    
    else
    {
    echo '
    
        <div id="contact">
          <form id="contact_form" name="contact_form" method="post" action="$_SERVER['PHP_SELF']">
            <label>Name:<br />
                <input name="name" type="text" class="form" id="name" />
            </label>
            <br /><br />
            <label>Email:<br />
                <input name="email" type="text" class="form" id="email" />
            </label>
            <br /><br />
            Message:<br />
            <label>
                <textarea name="message" cols="45" rows="5" class="form" id="message"></textarea>
            </label>
            <br /><br />
            <label>
                <input name="submit" type="submit" class="form_button" id="submit" value="Submit" />
            </label>
          </form>
        </div>';
    }
    
    include ("inc/footer.inc.php");
    
    ?>

  9. <?php
    else
    { //missing
    echo '<<<HTML
    
        <div id="contact">
          <form id="contact_form" name="contact_form" method="post" action="'$action'">
            <label>Name:<br />
                <input name="name" type="text" class="form" id="name" />
            </label>
            <br /><br />
            <label>Email:<br />
                <input name="email" type="text" class="form" id="email" />
            </label>
            <br /><br />
            Message:<br />
            <label>
                <textarea name="message" cols="45" rows="5" class="form" id="message"></textarea>
            </label>
            <br /><br />
            <label>
                <input name="submit" type="submit" class="form_button" id="submit" value="Submit" />
            </label>
          </form>
        </div>
    HTML';
    } //missing
    

    the last else.

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.