Jump to content

bcraig

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Posts posted by bcraig

  1. Im using PHP and i want to select records from my database where the month within a date datatype field is equal to a set variable. I dont know if this is possible?

     

     

    I have this now

    $dateFormat = date('m');
    $monthNo = 10;
    
    $sql_month = sprintf("SELECT * FROM gigs WHERE '%s' = '%s'", $dateFormat, $monthNo);
    

     

    But that shows all records dated with all different months in the database :(

     

  2. Ive got a form for creating a record and it posts to a confirmation page. I want the confirmation page to echo all the POST data into another form which on submit will POST to a mysql INSERT query.

     

    Is this possible without having input fields on the confirmation page? or are there ways to set the input boxes to be invisable and only show the data and be non-editable??

     

    PHP version:5.2.5

  3. How do you POST data depending on the setting of check boxes and radio buttons?

     

    I want to post only one of the inputs where radio checked...

     

    <radio><input text>your location(checked by default)

    <radio><input text>or specify

     

    And post any of these if checked...

     

    [ ]<input>email

    [ ]<input>phone

    [ ]<input>mobile

     

    Im using:

    PHP 5.2.5

     

  4. Thanks for trying to help but i worked around it.

     

    Insted of trying to put all the updates all together i seperated them and it worked.

     

    Result:

    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "createAuction")) {
      $updateSQLa = sprintf("UPDATE categories SET sub_counter=%s WHERE cat_id=%s",
                           GetSQLValueString($_POST['sub_counter'], "int"),
                           GetSQLValueString($_POST['sub_cat'], "int"));
    
      mysql_select_db($database_jobsnz_conn, $jobsnz_conn);
      $Resulta = mysql_query($updateSQL, $jobsnz_conn) or die(mysql_error());
    }
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "createAuction")) {
      $updateSQLb = sprintf("UPDATE categories SET counter=%s WHERE cat_id=%s",
                           GetSQLValueString($_POST['counter'], "int"),
                           GetSQLValueString($_POST['main_cat'], "int"));
    
      mysql_select_db($database_jobsnz_conn, $jobsnz_conn);
      $Result1b = mysql_query($updateSQLb, $jobsnz_conn) or die(mysql_error());
    }

  5. Can anyone tell me why im getting this error

     

    Im using:

    PHP 5.2.5

    MySql 5.0.45

    Apache 2.2.6

    Windows XP localhost

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id=41' at line 1

     

    This is my code

    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    
    if ((isset($_POST["update"])) && ($_POST["update"] == "updateAuction")) {
      $updateSQL = sprintf("UPDATE auctions SET title=%s, current_price=%s, description=%s, quals=%s, refs=%s, materials=%s, deadline=%s, day=%s, location=%s, payment=%s, WHERE id=%s",
    				   GetSQLValueString($_POST['title'], "text"),
    				   GetSQLValueString($_POST['current_price'], "int"),
    				   GetSQLValueString($_POST['description'], "text"),
    				   GetSQLValueString($_POST['quals'], "text"),
    				   GetSQLValueString($_POST['refs'], "int"),
    				   GetSQLValueString($_POST['materials'], "text"),
    				   GetSQLValueString($_POST['deadline'], "date"),
    				   GetSQLValueString($_POST['day'], "text"),
    				   GetSQLValueString($_POST['location'], "text"),
    				   GetSQLValueString($_POST['payment'], "text"),
    				   GetSQLValueString($_POST['id'], "int"));
    				   
    				   
    
      mysql_select_db($database_jobsnz_conn, $jobsnz_conn);
      $Result1 = mysql_query($updateSQL, $jobsnz_conn) or die(mysql_error());
    
      $updateGoTo = "success.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    ?>

  6. I want to update two different fields on two different rows on submit

     

    I have a table called 'categories' and inside it has main categories and sub categories...

     

    categories

    cat_id      parent_id      cat_name      counter        sub_counter

        1              0            MainOne          2                    0

        2              0            MainTwo          2                    0

        3              0            MainThree        1                    0

        4              0            MainFour          0                    0

        5              1            subOneA          0                    1

        6              1            subOneB          0                    1

        7              2            subTwoA          0                    2

        8              2            subTwoB          0                    0

        9              3            subThreeA          0                    1

        10            3            subThreeB          0                    0

        11            4            subFourA          0                    0

        12            4            subFourB          0                    0

     

    And i have a table 'auctions'

    auctions

    id    title        category      parent_category

    1    title1            5                  1

    2    title2            6                  1

    3    title3            7                  2

    4    title4            7                  2

    5    title5            9                  3

     

    When i insert a new record into 'auctions' i also want to update the counters in 'categories' so sub_counter increases by 1 on the row that matches the sub category selected by the user. And counter increases by 1 on the row that matches the main category selceted by the user

     

     

    example:

    If the user wants to insert a record with the main category as MainOne and in the sub category as subOneA the categories table will update so that the row that has cat_id of "1" will add 1 to the allready existing number in the field 'counter'. Then upadate the row that has cat_if of "5" by adding 1 to the existing number in the field sub_counter.

     

    So on the browse categories page i can echo the main category names and sub category names with the 'counter' number next to the main category names and 'sub_counter' number next to the sub category names to show how many records listed in each category.

     

    haha hope that makes sense

     

     

    Vesions in using:

    MySQL 5.0.45

    PHP 5.2.5

    APACHE 2.2.6

  7. what are you talking about??

     

    At the moment i just want to know how to update 2 seperate fields on seperate rows at once from post data ill work out the increment later

     

    i want the inputs("counter" and "sub_counter" which equal 1) to post into the update query

    so my table will end up looking like this example....

     

     

     

    cat_id      parent_id      name      counter    subcounter

    1                  0            one          1                0

    2                  1            sub          0                1

     

     

    after ill change it so it will be like... UPDATE categories SET counter=counter+1(however itsdone)  instead of using post

     

     

     

    at the moment my code only doing this...

     

    cat_id      parent_id      name      counter    subcounter

    1                  0            one          0                0

    2                  1            sub          1                1

     

     

  8. Can anyone help me by looking at this code and telling me why it will only update one row. The fields im trying to update are sub_counter and counter but on seperate rows.

     

     

    I have a table 'categories' which has sub categoriges connected to main categories thru 'parent_id'

     

    When i insert a new record into 'auctions' i want the counter fields  in 'categories' to update by adding 1 to their existing number where cat_id equals $_POST['sub_cat'] and parent_id equals $_POST['main_cat']

     

    but its adding "1" to 'counter' and 'sub_counter' on the same row and only where cat_id equals $_POST['sub_cat']

     

    this is example of table 'categories'

     

    cat_id      |    parent_id      |    cat_name      |    counter    |    sub_counter

        1                  0                  MAINONE                0                    0

        2                  0                  MAINTWO                0                    0

        3                  0                  MAINTHREE              0                    0

        4                  0                  MAINFOUR                0                    0

        5                  1                  subOneA                  0                    0

        6                  1                  subOneB                  0                    0

        7                  2                  subTwoA                  0                    0

        8                  2                  subTwoB                  0                    0

        9                  3                  subThreeA                0                    0

        10                  3                  subThreeB              0                    0

        11                  4                  subFourA                0                    0

        12                  4                  subFourB                0                    0

     

    <?php require_once('Connections/jobsnz_conn.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
    
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }
    
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "createAuction")) {
      $insertSQL = sprintf("INSERT INTO auctions (`user`, title, description, pict_url, category, parent_category, duration, start_price, location, payment, required_qual, required_ref, supply_material, deadline, preffered_day) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                          GetSQLValueString($_POST['user'], "text"),
                          GetSQLValueString($_POST['title'], "text"),
                          GetSQLValueString($_POST['description'], "text"),
                          GetSQLValueString($_POST['image'], "text"),
                          GetSQLValueString($_POST['sub_cat'], "int"),
                          GetSQLValueString($_POST['main_cat'], "int"),
                          GetSQLValueString($_POST['duration'], "int"),
                          GetSQLValueString($_POST['startprice'], "double"),
                          GetSQLValueString($_POST['check_location'], "text"),
                          GetSQLValueString($_POST['payment'], "text"),
                          GetSQLValueString($_POST['quals'], "text"),
                          GetSQLValueString($_POST['refs'], "text"),
                          GetSQLValueString($_POST['materials'], "text"),
                          GetSQLValueString($_POST['deadline'], "date"),
                          GetSQLValueString($_POST['day'], "text"));
    
    $updateSQL = sprintf("UPDATE categories SET sub_counter=%s WHERE cat_id=%s",
                           GetSQLValueString($_POST['sub_counter'], "int"),
                           GetSQLValueString($_POST['sub_cat'], "int"));
    $updateSQL2 = sprintf("UPDATE categories SET counter=%s WHERE parent_id=%s",
                           GetSQLValueString($_POST['counter'], "int"),
                           GetSQLValueString($_POST['main_cat'], "int"));
    
    
      mysql_select_db($database_jobsnz_conn, $jobsnz_conn);
      $Result1 = mysql_query($insertSQL, $jobsnz_conn) or die(mysql_error());
      $Result2 = mysql_query($updateSQL, $jobsnz_conn) or die(mysql_error());
      $Result2 = mysql_query($updateSQL2, $jobsnz_conn) or die(mysql_error());
    }
    ?>

     

    <form action="<?php echo $editFormAction; ?>" method="POST" name="createAuction">
            <table width="100%"  border="0" cellspacing="0" cellpadding="0" bgcolor="#0099FF">
    	  <tr>
                <td><input name="counter" type="text" id="counter" value="1">
                <input name="sub_counter" type="text" id="sub_counter" value="1"></td>		
                <td><?php $main_cat = $_POST['category']; echo "<input name=\"main_cat\" type=\"text\" id=\"main_cat\" value=\"".$main_cat."\">" ?></td>
              </tr>		  
    	  <tr>
                <td> </td>		
                <td><?php $user = $_SESSION['web_user']; echo "<input name=\"user\" type=\"text\" id=\"user\" value=\"".$user."\">" ?></td>
              </tr>
              <tr>
                <td>Sub Category </td>
                <td>
    		<select name="sub_cat" id="sub_cat">
    <?php 
    $colname_rs_user = $_SESSION[ "web_user" ];
    $sql_subcat = sprintf("SELECT cat_name, cat_id FROM categories WHERE parent_id = %s", $colname_rs_catid);
    $res_subcat = mysqli_query($mysqli, $sql_subcat);
    $sql_location = sprintf("SELECT city FROM a_users WHERE username = '$colname_rs_user'");
    $res_location = mysqli_query($mysqli, $sql_location);
    
    	if ($res_subcat) {
    	while ($newArray = mysqli_fetch_array($res_subcat, MYSQLI_ASSOC)) {
    		$name = $newArray['cat_name'];
    		$id = $newArray['cat_id'];
    
    		echo "<option value=\"".$id."\">".$name."</option>";
       	}
    	mysqli_free_result($res_subcat);
    } else {
    	printf("Could not retrieve records: %s\n", mysqli_error($mysqli));
    } ?>
                </select>
    		</td>
              </tr>
              <tr>
                <td>Title</td>
                <td><input name="title" type="text" id="title"></td>
              </tr>
              <tr>
                <td>Description</td>
                <td><textarea name="description" cols="50" id="description"></textarea></td>
              </tr>
              <tr>
                <td>Image</td>
                <td><input name="image" type="text" id="image">
                <input type="submit" name="browse" value="Browse"></td>
              </tr>
              <tr>
                <td>Duration</td>
                <td>
    		<select name="duration">
    		<option>7 Days</option>
    		<option>14 Days</option>
    		<option>28 Days</option>
                </select></td>
              </tr>
              <tr>
                <td>Start Price </td>
                <td><input name="startprice" type="text" id="startprice"></td>
              </tr>
              <tr>
                <td>Your Location</td>
                <td>
    
    	<?php
    	if ($res_location) {
    		while ($newArray = mysqli_fetch_array($res_location, MYSQLI_ASSOC)) {
    			$location = $newArray['city'];
    
    		echo "<input name=\"check_location\" id=\"check_location\" type=\"radio\" value=\"".$location."\"  checked>".$location."<br />";
       	} 
    	}
    	?>
                
    		</td>
              </tr>
              <tr>
                <td>Specify Location</td>
                <td>
    <input name="check_specify_location" id="check_specify_location" type="radio" value="specify_location"><input name="specify_location" type="text">
    		</td>
              </tr>          
    	  <tr>
                <td>Required Quals </td>
                <td><input name="quals" type="text" id="quals"></td>
              </tr>
              <tr>
                <td>Required Refs</td>
                <td><input name="refs" type="text" id="refs"></td>
              </tr>
              <tr>
                <td>Materials</td>
                <td><input name="materials" type="text" id="materials"></td>
              </tr>
              <tr>
                <td>Payment Method </td>
                <td><input name="payment" type="text" id="materials"></td>
              </tr>
              <tr>
                <td>Deadline</td>
    
                <td>
    		<input name="deadline" type="text" id="deadline">
                </td>
              </tr>
              <tr>
                <td>Preffered Day </td>
                <td><select name="day" id="day">
    		<option>Anytime</option>
    		<option>Weekend</option>
    		<option>Mon - Fri</option>
                </select></td>
              </tr>
              <tr>
                <td> </td>
                <td>
    
    		</td>
              </tr>
              <tr>
                <td> </td>
                <td><input type="submit" name="Submit" value="Submit"></td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
            </table>
    	<input type="hidden" name="MM_insert" value="createAuction">
    	</form>

  9. How do i get a list/menu to display records form DB depending on the selection on a previous list/menu?

     

    The first list has main categories and  the second list has sub categories conected to the main

     

    Heres a small example of my db table:

    categoies

    cat_id    |  parent_id  |  cat_name

        1                0            MainOne

        2                0            MainTwo

        3                1            SubOneA

        4                1            SubOneB

        5                2            SubTwoA

        6                2            SubTwoB

     

     

    this is what i have for the first list

     

     

    <?php
    $mysqli = mysqli_connect("localhost", "root", "", "jobsnz");
    
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    } else {
    
    $sqlcat_drop = "SELECT cat_name FROM categories WHERE parent_id = 0";
    $rescat_drop = mysqli_query($mysqli, $sqlcat_drop);
    ?>
    <select name="categories">
    <?php
    if ($rescat_drop) {
    	while ($newArray = mysqli_fetch_array($rescat_drop, MYSQLI_ASSOC)) {
    		$catname  = $newArray['cat_name'];
    		echo "<option>".$catname."</option>";
       	}
    } else {
    	printf("Could not retrieve records: %s\n", mysqli_error($mysqli));
    }
    ?>	
    </select>
    

  10. [!--quoteo(post=370832:date=May 3 2006, 06:11 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 3 2006, 06:11 AM) [snapback]370832[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Take out any instances of session_register as it is not needed. Doing $_SESSION[['username'] = $username would be sufficient. To create a session variable.
    [/quote]


    Yea didnt orginally have that in there but that dosent make a difference anyway.
  11. [!--quoteo(post=370797:date=May 3 2006, 12:12 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 3 2006, 12:12 AM) [snapback]370797[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    try taking out the $ in session_register("[!--coloro:red--][span style=\"color:red\"][!--/coloro--]$[!--colorc--][/span][!--/colorc--]username");
    [/quote]

    Didn't work :(
  12. Im trying to get the username of the person who has just signed to appear at the top of my index page. I had it working getting the name from the form and printing it on my index page but as soon as i add the login script to the form the username wont come through. Can anyone help me please??

    index.php
    [code]<?php require_once('Connections/conn_testing.php'); ?>
    <?php
    session_start();
    header("Cache-control: private"); //IE 6 Fix
    session_register("$username");
    $username = $_POST['username'];
    $_SESSION['username'] = $username
    ?>
    <?php
    echo 'Welcome to my website '.$_SESSION['username'];
    ?>
    <?php
    mysql_select_db($database_conn_testing, $conn_testing);
    $query_rs_users = "SELECT id, username, password FROM users ORDER BY id ASC";
    $rs_users = mysql_query($query_rs_users, $conn_testing) or die(mysql_error());
    $row_rs_users = mysql_fetch_assoc($rs_users);
    $totalRows_rs_users = mysql_num_rows($rs_users);
    ?>



    <br />
    <a href="test.php">users</a><br>
    <a href="log.html">log</a>
    <br>
    <br>
    <?php if(($_SESSION['MM_Username']) =="") { ?>
    <a href="login.php">Login</a>
    <?php } ?>

    <?php if(($_SESSION['MM_Username']) !="") { ?>
    <a href="logout.php">Logout</a>
    <a href="add.php">add</a>
    <?php } ?>

    <!-- Repeat Region for Users -->
    <?php do { ?>
    <?php include('inc/users_tbl.php'); ?>
    <?php } while ($row_rs_users = mysql_fetch_assoc($rs_users)); ?>
    <?php
    mysql_free_result($rs_users);
    ?>[/code]

    login.php
    [code]<?php require_once('Connections/conn_testing.php'); ?>
    <?php
    // *** Validate request to login to this site.
    session_start();
    header("Cache-control: private"); //IE 6 Fix  
    ?>
    <?php
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($accesscheck)) {
      $GLOBALS['PrevUrl'] = $accesscheck;
      session_register('PrevUrl');
    }

    if (isset($_POST['username'])) {
      $loginUsername=$_POST['username'];
      $password=$_POST['password'];
      $MM_fldUserAuthorization = "";
      $MM_redirectLoginSuccess = "index.php";
      $MM_redirectLoginFailed = "login.php?badlogin=true";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_conn_testing, $conn_testing);
      
      $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
        get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
      
      $LoginRS = mysql_query($LoginRS__query, $conn_testing) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
         $loginStrGroup = "";
        
        //declare two session variables and assign them
        $GLOBALS['MM_Username'] = $loginUsername;
        $GLOBALS['MM_UserGroup'] = $loginStrGroup;          

        //register the session variables
        session_register("MM_Username");
        session_register("MM_UserGroup");

        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];    
        }
        header("Location: " . $MM_redirectLoginSuccess );
      }
      else {
        header("Location: ". $MM_redirectLoginFailed );
      }
    }
    ?>
    <?php if($_GET['badlogin']) { ?>
    Incorrect username or password please try again
    <?php } ?>


    Login
    <form action="<?php echo $loginFormAction; ?>" method="POST" name="login">
    Username:<input name="username" type="text">
    Password:<input name="password" type="password">
    <input name="submit" type="submit" value="Login">
    </form>[/code]
  13. I used Dreamweaver to make a "supplies.php" that has a login link. The link takes you to login.php that I made using DW's user auth. behaviors. When the correct login is enterd you are redirected back to "suppliers.php" and the "Login" link should be replaced with "Logout". This is not working. The login works and redirects, its just the "suppliers.php" page doesnt swap the "Login" with "Logout"

     

    Here the code for login.php and suppliers.php

     

    login.php

    <?php require_once('Connections/conn_features.php'); ?>
    <?php
    // *** Start the session
    if (!session_id()) session_start();
    // *** Validate request to log in to this site.
    $FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!="") $FF_LoginAction .= "?".htmlentities($HTTP_SERVER_VARS['QUERY_STRING']);
    if (isset($HTTP_POST_VARS['username'])) {
     $FF_valUsername=$HTTP_POST_VARS['username'];
     $FF_valPassword=$HTTP_POST_VARS['password'];
     $FF_fldUserAuthorization="";
     $FF_redirectLoginSuccess="suppliers.php";
     $FF_redirectLoginFailed="login.php?badlogin=true";
     $FF_rsUser_Source="SELECT username, password ";
     if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
     $FF_rsUser_Source .= " FROM users WHERE username='" . $FF_valUsername . "' AND password='" . $FF_valPassword . "'";
     mysql_select_db($database_conn_features, $conn_features);
     $FF_rsUser=mysql_query($FF_rsUser_Source, $conn_features) or die(mysql_error());
     $row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
     if(mysql_num_rows($FF_rsUser) > 0) {
       // username and password match - this is a valid user
       $MM_Username=$FF_valUsername;
       session_register("MM_Username");
       if ($FF_fldUserAuthorization != "") {
         $MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
       } else {
         $MM_UserAuthorization="";
       }
       session_register("MM_UserAuthorization");
       if (isset($accessdenied) && false) {
         $FF_redirectLoginSuccess = $accessdenied;
       }
       mysql_free_result($FF_rsUser);
       session_register("FF_login_failed");
    $FF_login_failed = false;
       header ("Location: $FF_redirectLoginSuccess");
       exit;
     }
     mysql_free_result($FF_rsUser);
     session_register("FF_login_failed");
     $FF_login_failed = true;
     header ("Location: $FF_redirectLoginFailed");
     exit;
    }
    ?>
    

     

     

    suppliers.php

    <?php require_once('Connections/conn_features.php'); ?>
    
    <?php
    
    $colname_suppliers = "1";
    if (isset($_GET['company'])) {
     $colname_suppliers = (get_magic_quotes_gpc()) ? $_GET['company'] : addslashes($_GET['company']);
    }
    mysql_select_db($database_conn_features, $conn_features);
    $query_suppliers = sprintf("SELECT * FROM suppliers WHERE company = '%s' ORDER BY id ASC", $colname_suppliers);
    $suppliers = mysql_query($query_suppliers, $conn_features) or die(mysql_error());
    $row_suppliers = mysql_fetch_assoc($suppliers);
    $totalRows_suppliers = mysql_num_rows($suppliers);
    ?>
    

     

    LOGIN AND LOGOUT LINKS 1(this code makes the supplers.php page come up blank)

    <?php 
    if(isset(($_SESSION['MM_Username'])) && isset(($_SESSION['MM_UserAuthorization']))) { 
     echo '<a href="logout.php" class="link-main" >logout</a>'; 
    } 
    else { 
     echo '<a href="login.php?page=' . $_SERVER['PHP_SELF'] . '" class="link-main" >Admin Login</a>'; 
    } 
    ?>
    

     

     

    LOGIN AND LOGOUT LINKS 2(Thisis the code ive had working before but it wont now)

    <?php if(($_SESSION['MM_Username']) !="") { ?>
       <a href="logout.php" class="adminlink" >logout</a> 
       <?php } ?>
    
    <?php if(($_SESSION['MM_Username']) =="") { ?>
       <a href="login.php?page=<?php echo $_SERVER['PHP_SELF']; ?>" class="adminlink" >Admin 
       Login</a> 
       <?php } ?>
    

×
×
  • 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.