Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <link rel="icon"
- type="image/x-icon"
- href="img/favicon.ico">
- <title>Cart</title>
- <style>
- body {
- background-image: url(img/bg.jpg);
- background-attachment: fixed;
- font-family: sans-serif; color: White;
- }
- table {
- background: rgba(255,255,255,0.4);
- }
- a { color: white; }
- a:visited { color: white; }
- a:hover { color: #CCCCCC; }
- a:focus { outline: white; }
- hr {
- width: 100%;
- }
- </style>
- </head>
- <body>
- <?php
- $dbhost = 'localhost';
- $dbuser = 'root';
- $conn = mysql_connect($dbhost, $dbuser);
- mysql_select_db("userlogin");
- if(! $conn )
- {
- die('Could not connect: ' . mysql_error());
- }
- //this gets the current logged-in user
- $query = "SELECT * FROM `currentsession`";
- $result = mysql_query($query);
- while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
- $userN = $row['curUsr'];
- $userM = $row['money'];
- }
- echo "Currently logged-in as <b>",$userN,"</b> and your money is <img src=img/peso.png width=20 height=20 /><b>",$userM,"</b>";
- echo "<div align=center><hr /></div>";
- if(@$_REQUEST['prdname']!="")
- {
- $comp=mysql_real_escape_string($_REQUEST['comp']);
- $prdname=mysql_real_escape_string($_REQUEST['prdname']);
- $quant=mysql_real_escape_string($_REQUEST['quant']);
- $prc=mysql_real_escape_string($_REQUEST['prc']);
- if($quant=="")$quant="NULL";
- mysql_query("INSERT INTO cart (comp,prdname,quant,prc) VALUES('$comp','$prdname',$quant,$prc);");
- }
- if(@$_REQUEST['action']=="del")
- {
- mysql_query("DELETE FROM cart WHERE id=".round($_REQUEST['id']));
- }
- echo "<div align = center><font size='+12'>CART</font></div>";
- echo "<div align=center><hr /></div>";
- echo "<div align = 'center'><table border = '0'>";
- echo "<th border=1>Product Name</th><th>Compatible Board</th><th>Quantity</th><th>Price</th><th>Delete</th>";
- $usrCnt = 0;
- $query="SELECT id,comp,prdname,quant,prc FROM cart ORDER BY comp";
- $result=mysql_query($query,$conn);
- while( $row = mysql_fetch_array($result, MYSQL_ASSOC))
- {
- echo "<tr><td align = center>{$row['prdname']}</td>".
- "<td align = center>{$row['comp']}</td>".
- "<td align = center>{$row['quant']}</td>".
- "<td align = center>{$row['prc']}</td>".
- "<td align = center><a href=cds.php?action=del&id=".$row['id']."><span class=red>DELETE</span></a></td></tr>";
- $usrCnt++;
- }
- echo "<tr valign=bottom>";
- echo "<td bgcolor=#fb7922 colspan=7><img src=img/blank.gif width=1 height=8></td>";
- echo "</tr>";
- echo "<tr><td><a href=productpage.php>GO BACK</a></td> <td colspan=3></td> <td align=right><a href=logoutLogic.php>LOG-OUT</a></td></tr>";
- echo "</table></div><br />";
- mysql_close($conn);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement