Jump to content

creativkook

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Posts posted by creativkook

  1. I did try that, and I tried making it a global variable.  It only pulls out one.  And in order for it to work with PayPal's thing, the name of each has to be item_name_1, item_name_2, in order, etc. 

  2. Well, the problem is I need PayPal to process the credit cards.  What I'm doing here is passing the information from my cart to PayPal so that they can process the credit card.  The customer wants each item to show up in the PayPal system so there's no confusion about which items are being purchased.

  3. Ok, I got the variables to work correctly.  But the problem I'm having now is I can't get the value of the hidden variable to reflect the product title.  Here's the code I have now, but it's creating two hidden inputs of each, one for each of the amount in the shopping cart.  Here's what it's doing:

     

    <tr>
    <td valign='top'>Wavy Fish</td>
    <td valign='top'>$20</td>
    <td valign='top'>1</td>
    </tr>
    
    <input type='hidden' name='item_name_1' value='Wavy Fish'>
    <input type='hidden' name='amount_1' value='20'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='shipping_1' value ='0.00' />
    <input type='hidden' name='item_name_2' value='Wavy Fish'>
    <input type='hidden' name='amount_2' value='20'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='shipping_2' value ='0.00' />
    
    <tr>
    <td valign='top'>Opal</td>
    <td valign='top'>$20</td>
    <td valign='top'>1</td>
    </tr>
    
    <input type='hidden' name='item_name_1' value='Opal'>
    <input type='hidden' name='amount_1' value='20'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='shipping_1' value ='0.00' />
    <input type='hidden' name='item_name_2' value='Opal'>
    <input type='hidden' name='amount_2' value='20'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='shipping_2' value ='0.00' />			
    

     

    But it should assign item_name_1 to the Wavy fish product and item_name_2 to Opal.  Here's the code behind:

     

    $count = mysql_num_rows($carts);
    
    				while($cart = mysql_fetch_array($carts))
    				{
    					$products = mysql_query("SELECT productsid, title, price FROM products WHERE productsid = $cart[productid]");
    
    					while($product = mysql_fetch_array($products))
    					{
    
    						echo("<tr>");
    						echo("<td valign='top'>$product[title]</td>");
    						echo("<td valign='top'>\$$product[price]</td>");
    						echo("<td valign='top'>$cart[quantity]</td>");
    						echo("</tr>");		
    
    						for($x = 1; $x <= $count; $x++)
    						{
    							$name = "item_name_" . $x;
    							$amount = "amount_" . $x;
    							$shipping = "shipping_" . $x;
    
    
    							echo("<input type='hidden' name='$name' value='$product[title]'>");
    							echo("<input type='hidden' name='$amount' value='$product[price]'>");
    							echo("<input type='hidden' name='quantity' value='1'>");
    							echo("<input type='hidden' name='$shipping' value ='0.00' />");
    						}
    
    					}
    				}
    		}
    

     

    Anyone have any ideas?  I keep moving the for() loop out of the while() loop, but I can't get the product title to come through and then the input has no value.

  4. Well, the question is I need to put this inside a while loop.  The Code:

     

    if(mysql_num_rows($carts) == 0)
    		{
    			echo("<tr><td rowspan='4'>You have not yet put anything in your cart.</td></tr>");
    		}
    		else
    		{
    			while($cart = mysql_fetch_array($carts))
    			{
    				$products = mysql_query("SELECT title, price FROM products WHERE productsid = $cart[productid]");
    
    				while($product = mysql_fetch_array($products))
    				{
    					echo("<tr>");
    					echo("<td valign='top'>$product[title]</td>");
    					echo("<td valign='top'>\$$product[price]</td>");
    					echo("<td valign='top'>$cart[quantity]</td>");
    					echo("</tr>");
    
    
     		         		[b]echo("<input type='hidden' name='item_name_1' value='$product[title]'>")[/b]
    
    
    				}
    			}
    		}

     

    So, I need the bolded line to have a different name for each product.  If there's more than one item, it needs to be able to change in the loop to create another hidden input with the name item_name_2, etc.  How do I make it do that?

  5. Ok, I know there's a way to have variables be created dynamically.  What I'm trying to do is to pass information about products to PayPal, but I don't know how many products are going to be in each cart.  It could be 1 or 100.  I need to create a variable who's ending number changes depending on how many products are in the cart.  How do you have those created dynamically?  I need the information to be passed through hidden variables via an HTML form as well.

  6. I have a question concerning my cart total.  I need to get the total  I have my products and cart in two separate tables:  products and cart.  In my cart table, I have stored the productid to tie it to the products table, userid from the session variable to tie the products in the cart together, and quantity.  In my products table I have the price for the product.  What would be a formula I could write to get the complete total dynamically? Because I could have one product up to 20.  If you need more info, let me know.  I thought about calculating the individual totals and then adding them, but I don't know how to do that.

  7. Yea, sorry about that.  It's:

     

    <?php
    
    $connection = mysql_connect("localhost", "****", "*****") or die("Error: " . mysql_error());
    mysql_select_db("mrmcclev_inventory") or die("Error: " . mysql_error());
    
    ?>

  8. I have a database set up on the localhost, but it's not connecting for some reason.  This is the error I'm getting.

     

    Warning: mysql_connect(): Access denied for user: 'login@localhost' (Using password: YES) in /home/mrmcclev/public_html/dbheader.php on line 3

    Error: Access denied for user: 'login@localhost' (Using password: YES)

     

    Is there anything that this could be?  I've checked my password and username and they look the same.

  9. Alright, i should know this, but I haven't worked with PHP in awhile, so I'm fuzzy.  I'm trying to go back and have a user recode something, so it updates the fields in the database.  Everything seems to be running fine, but my query isn't working for some reason.  could someone look at it and make sure the sql is correct?  Thanks!

     

    mysql_query("UPDATE plaiddata SET loanAmount = '$loanAmount', longDesc = '$longDescription', aidType2 = '$aidType', environAidType2 = '$environAidType', healthImpact2 = '$healthImpact', crs2Code1 = '$crsCode1', crs2Code2 = '$crsCode2', crs2Code3 = '$crsCode3', crs2Code4 = '$crsCode4', crs2Code5 = '$crsCode5', crs2Code6 = '$crsCode6', masterCRS1 = '$masterCRS1', masterCRS2 = '$masterCRS2', masterCRS3 = '$masterCRS3', masterCRS4 = '$masterCRS4', masterCRS5 = '$masterCRS5', masterAidType = '$masterAidType', masterEnvironAidType = '$masterEnvironAidType', masterHealthImpact = '$masterHealthImpact' WHERE plaidDataID = '$_POST[dataID]'");

  10. I've never had this problem before.  For some reason (I'm using version 4.1 of PHP I believe) I have some of my variables coming back to me.  Not all, just a few.  Here are the errors I'm getting:

     

    Notice: Undefined index: cofinancer1Amt in C:\Web\Plaid\addNew.php on line 39

     

    Notice: Undefined index: cofinancer2Amt in C:\Web\Plaid\addNew.php on line 40

     

    Notice: Undefined index: cofinancer3Amt in C:\Web\Plaid\addNew.php on line 41

     

    Notice: Undefined index: cofinancer4Amt in C:\Web\Plaid\addNew.php on line 42

     

    Notice: Undefined index: cofinancer5Amt in C:\Web\Plaid\addNew.php on line 43

     

    Notice: Undefined index: cofinancer6Amt in C:\Web\Plaid\addNew.php on line 44

     

    Notice: Undefined index: environAidType in C:\Web\Plaid\addNew.php on line 50

     

     

    Here's my code.  See if you can find anything wrong.  I don't know what I'm missing.

     

    <?php
    
    require("_sessionheader.php");
    require("dbheader.php");
    
    $donorNameQueries = mysql_query("SELECT * FROM donorname");
    $donorUmbrellaQueries = mysql_query("SELECT * FROM donorumbrella");
    $recipientQueries = mysql_query("SELECT * FROM recipient");
    $currencyQueries = mysql_query("SELECT * FROM currency");
    $aidTypeQueries = mysql_query("SELECT * FROM aidtype");
    $environAidTypeQueries = mysql_query("SELECT * FROM environaidtype");
    $healthImpactQueries = mysql_query("SELECT * FROM healthimpact");
    
    
    
    if(isset($_POST['submit']))
    {
    
    
    	$year = $_POST['year'];
    	$donorName = $_POST['donorName'];
    	$donorUmbrella = $_POST['donorUmbrella'];
    	$recipient = $_POST['recipient'];
    	$loanAmount = $_POST['loanAmount'];
    	$currency = $_POST['currency'];
    	$cofinancer1 = $_POST['cofinancer1'];
    	$cofinancer2 = $_POST['cofinancer2'];
    	$cofinancer3 = $_POST['cofinancer3'];
    	$cofinancer4 = $_POST['cofinancer4'];
    	$cofinancer5 = $_POST['cofinancer5'];
    	$cofinancer6 = $_POST['cofinancer6'];
    	$cofinancer1Amt = $_POST['cofinancer1Amt'];
    	$cofinancer2Amt = $_POST['cofinancer2Amt'];
    	$cofinancer3Amt = $_POST['cofinancer3Amt'];
    	$cofinancer4Amt = $_POST['cofinancer4Amt'];
    	$cofinancer5Amt = $_POST['cofinancer5Amt'];
    	$cofinancer6Amt = $_POST['cofinancer6Amt'];
    	$projectTitle = $_POST['projectTitle'];
    	$shortDescription = $_POST['shortDescription'];
    	$longDescription = $_POST['longDescription'];
    	$comment = $_POST['comment'];
    	$aidType = $_POST['aidType'];
    	$environAidType = $_POST['environAidType'];
    	$healthImpact = $_POST['healthImpact'];
    	$crsCode1 = $_POST['crsCode1'];
    	$crsCode2 = $_POST['crsCode2'];
    	$crsCode3 = $_POST['crsCode3'];
    	$crsCode4 = $_POST['crsCode4'];
    	$crsCode5 = $_POST['crsCode5'];
    	$crsCode6 = $_POST['crsCode6'];
    
    	if($longDescription == NULL)
    	{
    		$longDescExists = "no";
    	}
    	else
    	{
    		$longDescExists = "yes";
    	}
    
    	mysql_query("INSERT INTO plaiddata (year, donorName, donorUmbrella, recipientPlaidName, loanAmount, currency, cofinancer1, cofinancer2, cofinancer3, cofinancer4, cofinancer5, cofinancer6, cofinancer1Amt, cofinancer2Amt, cofinancer3Amt, cofinancer4Amt, cofinancer5Amt, cofinancer6Amt, projectTitle, shortDesc, longDescExists, longDesc, comment, aidType, environAidType, healthImpact, crs1Code1, crs1Code2, crs1Code3, crs1Code4, crs1Code5, crs1Code6) VALUES ('$year', '$donorName', '$donorUmbrella', '$recipient', '$loanAmount', '$currency', '$cofinancer1', '$cofinancer2', '$cofinancer3', '$cofinancer4', '$cofinancer5', '$cofinancer6', '$cofinancer1Amt', '$cofinancer2Amt', '$cofinancer3Amt', '$cofinancer4Amt', '$cofinancer5Amt', '$cofinancer6Amt', '$projectTitle', '$shortDescription', '$longDescExists', '$longDescription', '$comment', '$aidType', '$environAidType', '$healthImpact', '$crsCode1', '$crsCode2', '$crsCode3', '$crsCode4', '$crsCode5', '$crsCode6')");
    	echo(mysql_error());
    
    
    	//header("location: success.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=iso-8859-1" />
    <title>Insert Project Information</title>
    </head>
    
    <body>
    
    <form method="post" action="<? $_SERVER['PHP_SELF']; ?>">
    
    <p>Year: <input type="text" name="year" /></p>
      <p>Donor Name:  
        <select name="donorName">
            <?php
    
    		while($donorNameQuery = mysql_fetch_array($donorNameQueries))
    		{
    			echo("<option value='$donorNameQuery[donorName]'>$donorNameQuery[donorName]</option>");
    		}
    
    	?>
        </select>
      </p>
    <p>Donor Umbrella:  <select name="donorUmbrella">
    					<?php
    
    						while($donorUmbrellaQuery = mysql_fetch_array($donorUmbrellaQueries))
    						{
    							echo("<option value='$donorUmbrellaQuery[donorUmbrella]'>$donorUmbrellaQuery[donorUmbrella]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>Recipient:  <select name="recipient">
    					<?php
    
    						while($recipientQuery = mysql_fetch_array($recipientQueries))
    						{
    							echo("<option value='$recipientQuery[recipient]'>$recipientQuery[recipient]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>Loan Amount: <input type="text" name="loanAmount" /></p>
    
    <p>Currency:  <select name="currency">
    					<?php
    
    						while($currencyQuery = mysql_fetch_array($currencyQueries))
    						{
    							echo("<option value='$currencyQuery[currency]'>$currencyQuery[currency]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>Cofinancer 1: <input type="text" name="cofinancer1" />     
    Cofinancer 1 amount: <input type="text" name="cofinancer1amount" /></p>
    
    <p>Cofinancer 2: <input type="text" name="cofinancer2" />     
    Cofinancer 2 amount: <input type="text" name="cofinancer2amount" /></p>
    
    <p>Cofinancer 3: <input type="text" name="cofinancer3" />     
    Cofinancer 3 amount: <input type="text" name="cofinancer3amount" /></p>
    
    <p>Cofinancer 4: <input type="text" name="cofinancer4" />     
    Cofinancer 4 amount: <input type="text" name="cofinancer4amount" /></p>
    
    <p>Cofinancer 5: <input type="text" name="cofinancer5" />     
    Cofinancer 5 amount: <input type="text" name="cofinancer5amount" /></p>
    
    <p>Cofinancer 6: <input type="text" name="cofinancer6" />     
    Cofinancer 6 amount: <input type="text" name="cofinancer6amount" /></p>
    
    <p>Project title: <input type="text" name="projectTitle" /></p>
    
    <p>Short description: <textarea name="shortDescription" cols="45" rows="3"></textarea></p>
    
    <p>Long description: <textarea name="longDescription" cols="45" rows="5"></textarea></p>
    
    <p>Comment: <input type="text" name="comment" /></p>
    
    <p>Aid Type:  <select name="aidType">
    					<?php
    
    						while($aidTypeQuery = mysql_fetch_array($aidTypeQueries))
    						{
    							echo("<option value='$aidTypeQuery[aidType]'>$aidTypeQuery[aidType]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>Environmental Aid Type:  <select name="environmentalAidType">
    					<?php
    
    						while($environAidTypeQuery = mysql_fetch_array($environAidTypeQueries))
    						{
    							echo("<option value='$environAidTypeQuery[environAidType]'>$environAidTypeQuery[environAidType]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>Health Impact:  <select name="healthImpact">
    					<?php
    
    						while($healthImpactQuery = mysql_fetch_array($healthImpactQueries))
    						{
    							echo("<option value='$healthImpactQuery[healthImpact]'>$healthImpactQuery[healthImpact]</option>");
    						}
    
    					?>
    				</select></p>
    
    <p>CRS Code [1] <input name="crsCode1" maxlength="5" type="text" /></p>
    <p>CRS Code [2] <input name="crsCode2" maxlength="5" type="text" /></p>
    <p>CRS Code [3] <input name="crsCode3" maxlength="5" type="text" /></p>
    <p>CRS Code [4] <input name="crsCode4" type="text" maxlength="5" /></p>
    <p>CRS Code [5] <input name="crsCode5" type="text" maxlength="5" /></p>
    <p>CRS Code [6] <input name="crsCode6" type="text" maxlength="5" /></p>
    
    <p><input type="submit" name="submit" value="Sumbit" /></p>
    
    
    </form>
    
    </body>
    </html>
    

  11. Ok, I'm having problems with my session starting and recognizing it.  This is from the login page, and it's not letting it send to the next page.

     

    Here are the errors I'm getting:

     

    Warning: session_start(): open(C:\PHP\sessiondata\sess_ef565a18d6c2e623e74300375c5613d8, O_RDWR) failed: Permission denied (13) in C:\Web\Plaid\index.php on line 20

     

    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Web\Plaid\index.php:20) in C:\Web\Plaid\index.php on line 20

     

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Web\Plaid\index.php:20) in C:\Web\Plaid\index.php on line 20

     

    Warning: Cannot modify header information - headers already sent by (output started at C:\Web\Plaid\index.php:20) in C:\Web\Plaid\index.php on line 24

     

    Warning: Unknown(): open(C:\PHP\sessiondata\sess_ef565a18d6c2e623e74300375c5613d8, O_RDWR) failed: Permission denied (13) in Unknown on line 0

     

    Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\PHP\sessiondata) in Unknown on line 0

     

     

    Here's the session start code:

     

    if(isset($_POST['login']))
    {
    
    $user = $_POST['user'];
    $pass = $_POST['password'];
    
    require("dbheader.php");
    
    $person = mysql_query("SELECT userID FROM plaidusers WHERE username = '$user' AND password = MD5('$pass')");
    
    if(mysql_num_rows($person) > 0)
    {
    	$persons = mysql_fetch_array($person);
    
    	session_start();
    
    	$_SESSION['userID'] = $persons['userID'];
    
    	header("location: home.php?userid=$person[userID]");
    	exit;	
    }
    else
    {
    	$error = true;
    }
    
    }

     

  12. Ok, so here's the deal.  I'm writing a copy of a site that's supposed to communicate with the site that another group has set up just like it.  They want to have control over some of the columns in the database, but they want to share data easily by having it communicate with the host database.  The problem is that the host database is an Oracle database and the database we want to have it in is a SQL.  I know very little about sharing amongst databases and less about if this is even possible.  Can anyone point me in the right direction?
  13. Ok, this is my first time using a Microsoft SQL database instead of MySQL.  Can someone point me in the direction of some good tutorials on how to connect to the database and all that jazz?  I need to be able to have a login page, and then do simple updates to the database from a web page.
  14. Ok, so I didn't design this code.  I'm just trying to fix an error on it, and the guy that worked here before me used this open source code.  Here are the errors I get if I click on any of the pages to edit through the database.

    Warning: session_start(): open(C:\PHP\sessiondata\sess_7cb495eef5c712685f50cbe5087669cb, O_RDWR) failed: Permission denied (13) in c:\web\cc\groups\scripts\sb_login.php on line 30

    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\web\cc\groups\scripts\sb_login.php:30) in c:\web\cc\groups\scripts\sb_login.php on line 30

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\web\cc\groups\scripts\sb_login.php:30) in c:\web\cc\groups\scripts\sb_login.php on line 30


    The area of code it's referring to:

    [code]function logged_in ( $redirect_to_login, $redirect_to_setup ) {
    // Check if the user is logged in and has a session.
    //
    // Session data is stored in a client-side cookie.
    // Login flag is stored in the session cookie.

    // Support for PHP >= 4.1.0
    // Check if the user has a client-side cookie.
    if ( isset( $_COOKIE['my_id'] ) ) {
    $my_id = $_COOKIE['my_id'];

    // Turn off URL SIDs.
    // ini_set( 'session.use_trans_sid', '0' );

    // Init the session.
    session_set_cookie_params(time()+60*60*24*5);
    session_id($my_id);
    session_start ();

    // Check if they're logged in.
    if ( isset( $_SESSION['logged_in'] ) && $_SESSION['logged_in'] == 'yes' ) {
    if ( $_SESSION['site_path'] === dirname($_SERVER['PHP_SELF']) ) {
    return ( true );
    }
    }
    }[/code]

    These errors also came up at the bottom of the window.


    Warning: Unknown(): open(C:\PHP\sessiondata\sess_7cb495eef5c712685f50cbe5087669cb, O_RDWR) failed: Permission denied (13) in Unknown on line 0

    Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\PHP\sessiondata) in Unknown on line 0
  15. I'm trying to start an ecommerce site with credit card processing. Problem is, I have a lot of features on the site that run on PHP coding and I want to keep those. I'm having problems finding a reliable, php interface. I don't really care to use PayPal either. Does anyone here have any ideas?
  16. I'm having problems with this code, it's not updating at all, giving me an error telling me that I have an error in my mysql syntax. If anyone can see what I can't, that would be really appreciated.


    <?php

    require("_statusSessionHeader.php");
    require("dbheader.php");

    if(isset($_POST['update']))
    {
    $status = strip_tags($_POST['status']);
    $comments = strip_tags($_POST['comments']);



    mysql_query("UPDATE orderStatus SET status = '$status', comments = '$comments' WHERE orderid = $_GET[orderid]");

    header("location: statusSet.php");
    exit;

    }

    $order = mysql_fetch_array(mysql_query("SELECT * FROM orderStatus WHERE orderid = $_GET[orderid]"));

    echo(mysql_error());

    ?>

    <!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>
    <title>Update PC Repair Status</title>
    </head>
    <body>
    <h2>Update PC Repair Status</h2>

    <form method="post" action="<?=$_SERVER['PHP_SELF'];?>">

    <p>Status:</p>
    <p>
    <input type="radio" name="status" value="checkinshelf" /> Check-in shelf
    <input type="radio" name="status" value="onthebench" /> On the bench
    <input type="radio" name="status" value="ongoingdiag" /> Ongoing diagnostic
    <input type="radio" name="status" value="onholdpartsonorder" /> On hold - parts on order
    <input type="radio" name="status" value="waitingoncustomerresponse" /> Waiting on customer response
    <input type="radio" name="status" value="finished" /> Finished
    </p>
    <p>Comments:</p>
    <p><textarea name="comments" rows="5" cols="45" ></textarea></p>

    <p><input type="submit" name="update" value="Update Status" /></p>

    </form>


    </body>
    </html>
  17. I keep getting this error that my fetch arrays are not a valid resource for the two located near the bottom of my code, the ones hilighted. Can anyone see what I'm doing wrong? I'm trying to pull out entries for a simple forum, using three database tables that tie together. Thanks!

    <?php

    require("dbheader.php");

    $topic = mysql_fetch_array(mysql_query("SELECT topic FROM topics WHERE topicid = $_GET[topicid]"));
    echo(mysql_error());

    $title = $topic['topic'];

    $entries = mysql_query("SELECT *, UNIX_TIMESTAMP(eventTime) AS utime FROM entry WHERE topicid = $_GET[topicid]");

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title><?php echo($title); ?></title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>

    <body>

    <?php

    [b]$entry = mysql_fetch_array($entries);[/b]
    $userid = $entry['userid'];
    [b]$user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE userid = $userid"));[/b]
    $edate = date("l, F jS", $entry['utime']);
    $etime = date("g:i a", $entry['utime']);

    while($entry)
    {
    echo("<div class='display'");

    echo("<table cellpadding='3' cellspacing='3'>");
    echo("<tr>");
    echo("<td>");
    echo("<p>$user[username]</p>");
    echo("<p>$edate at $etime</p>");
    echo("</td>");
    echo("<td>");
    echo("<p>$entry[entry]</p>");
    echo("</td>");
    echo("</tr>");

    echo("</div>");
    }

    ?>

    </body>
    </html>
  18. [!--quoteo(post=351804:date=Mar 5 2006, 04:29 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Mar 5 2006, 04:29 AM) [snapback]351804[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Try changing this line:
    [code]$person = mysql_query("SELECT * FROM cafeusers WHERE username = '$username' AND password = MD5('$password')") or die(mysql_error());[/code]
    [/quote]

    I tried messing with that line before. Does anyone have any suggestions on how that line should be changed? It just doesn't let me log in.
  19. I have a script for a log in that works on another database and site, but doesn't seem to agree with the one I'm trying to get it set up on. Can anyone tell me what can be causing this problem and what I need to do to fix it? Here's the code:

    <?php

    $username = $_POST['username'];
    $password = $_POST['password'];

    if(isset($_POST['login']))
    {
    require("dbheader.php");

    $person = mysql_query("SELECT * FROM cafeusers WHERE username = $username AND password = MD5('$password')");

    if(mysql_num_rows($person) > 0)
    {
    session_start();

    $_SESSION['userid'] = $person['userid'];

    header("location: home.php");
    }
    else
    {
    $error = true;
    }
    }

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <link href="style2.css" rel="stylesheet" type="text/css" />
    <title>Login Page</title>
    </head>

    <body>

    <div class="login">

    <?php

    if($error == true)
    {
    echo("<p>Username or password invalid.</p>");
    }

    ?>

    <form method="post" action="<?=$_SERVER['PHP_SELF'];?>">

    <p>Username: <input type="text" name="username" value="<?=$_POST['username'];?>" /></p>
    <p>Password: <input type="password" name="password" /></p>

    <p><input type="submit" name="login" value="Login" /></p>

    </form>

    </div>

    </body>

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