.


:




:

































 

 

 

 


ң




ұ ұ index.php, fns.php, show_cart.php, checkout.php, login.php, logout.php ә ғ қ ұ. phpMyAdmin ү MySQL ә ғ .

ө ң ғ қ-қ ұ ө.

 

2.9 ң ғ қ-қ

 

ң қ ә қ ө, ө ң ққ .

үң қ ғ ө html ғ ө ө:

2.4 Қғ ұққ

ү ү (Microsoft - Internet Explorer ver 5.0 ң ң ұ) ә Web- (Apache ұ) қ. Windows XP . Windows 95 , ү қ , Internet Explorer 3.0 .

ң қ ә ң . ү ғ қғ ң ө , 800x600/CDRom/ ұқ 100/ram32 Mb/video 1 Mb/ SVGA . ̳ ғқ қ ң . Internet Explorer 4.0 ө . ңғ css-ң қ қғ.

Web қ ү Web- Apache- қ қ. Web- (IE) қң ә ғ http://dip.kz ң.

2.5 ұққ

ү ү Apache Web- қ. қ, Apache Web-ң home dip.kz/www ө .

ө ғ database2 Z:\usr\local\mysql5\data ө, ұ қ phpMyAdmin MySQL ә ғ ғ қ қ ә қ . ұ қ ә ң қ құ ә қ.

ң ө , ө ү ө ө .

 

 


Қ

 

1. <table width=100% bgcolor=#660F0F>

2. <tr>

3. <td align="CENTER">

4. <a href="index.php"><font class=middle color=#CC9090>[|</font></a>

5. <a href="price.php"><font class=middle color=#CC9090>-|</font></a>

6. <a href="goost_form.php"><font class=middle color=#CC9090> |</font></a>

7. <a href="about.php"><font class=middle color=#CC9090> |</font></a>

8. <a href="help.php"><font class=middle color=#CC9090>]</font></a>

9. <center>

10. <font class=middle color=#CC9090>

11. <i>Copyright 2007, <a class=light href="mailto:[email protected]"><u><font class=middle color=#CC9090>B-SHOP.KZ</font></u></a>

All rights reserved.</i>

12. </font>

13. </center>

14. </td>

15. </tr>

16. </table>

 

үң ғ html ұ:

 

1. <html>

2. <head>

3. <title><?php echo "$title"?><title>

4. </head>

5. <body marginheight="0" marginwidth="0" leftmargin=0 topmargin=0>

6. <table width=100% border="0" cellspacing=0 cellpadding=0 bgcolor=#660F0F>

7. <tr>

8. <td width=1% valign="BOTTOM" colspan="6" align="CENTER">

9. <table cellpadding="0" cellspacing="0" border="0">

10. <tr>

11. <td align="Center"><h1 align="CENTER"><font color="#FFFFFF" face=""><?php echo "$title"?></font></h1></td>

12. </tr>

13. </table>

14. </td>

15. </tr>

16. <tr>

17. <td align="CENTER">

18. <table>

19. <tr>

20. <td><img src="images\home.gif"></td>

21. <td><a href="index.php"><font color="#FFFFFF"></font></a></td>

22. </tr>

23. </table>

24. </td>

25. <td>

26. <table>

27. <tr>

28. <td><img src="images\currency.gif"></td>

29. <td><a href="price.php"><font color="#FFFFFF">-</font></a></td>

30. </tr>

31. </table>

32. </td>

33. <td>

34. <table>

35. <tr>

36. <td><img src="images\register.gif"></td>

37. <td><a href="goost_form.php"><font color="#FFFFFF"> </font></a></td>

38. </tr>

39. </table>

40. </td>

41. <td>

42. <table>

43. <tr>

44. <td><img src="images\price.gif"></td>

45. <td><a href="about.php"><font color="#FFFFFF"> </font></a></td>

46. </tr>

47. </table>

48. </td>

49. <td>

50. <table>

51. <tr>

52. <td><img src="images\help.gif"></td>

53. <td><a href="help.php"><font color="#FFFFFF"></font></a></td>

54. </tr>

55. </table>

56. </td>

57. <td>

58. <table>

59. <tr>

60. <td><a href="login.html"><font color="#FFFFFF"></font></a></td>

61. </tr>

62. </table>

63. </td>

64. </tr>

65. <tr>

66. <td colspan="4" align="LEFT">

67. <table>

68. <form action="result.php" method="POST">

69. <font color="#FFFFFF">:</font><input type="TEXT" name="searchterm" maxlength="20" size="12">

70. <input type="IMAGE" src="images/search.gif"><br>

71. <input type="HIDDEN" name="searchtype" value="author">

72. </form>

73. <a href="search_form.php"><font color="#FFFFFF" size="-1"> </font></a>

74. </table>

75. </td>

76. <td align="RIGHT" colspan="4">

77. <table border="0">

78. <tr>

79. <td align="RIGHT" bgcolor="#000000"><img src="images/c.gif"><?php echo '<a href="show_cart.php"><font color="#FFFFFF"></font></a><br></td></tr>';

80. echo '<tr><td><font color="#FFFFFF"> = '.$HTTP_SESSION_VARS['items'].'</font><br>';

81. echo'<fontcolor="#FFFFFF">='.number_format($HTTP_SESSION_VARS['total_price'],2).'</font><br>';?></td><tr>

82. <td>

83. <a href="checkout.php"><font color="#FFFFFF"> </font></a>

84. </td>

85. </tr>

86. </tr>

87. </table>

88. </td>

89. </tr>

 

ң ғ:

 

1. <html>

2. <head>

3. <title><?php echo "$title"?><title>

4. </head>

5. <table border="1" cellspacing = 0 bgcolor=#660F0F width=100%>

6. <tr>

7. <td><h1 align="CENTER"><font color="#FFFFFF"><?php echo "$title"?></font></h1></td>

8. </tr>

9. </table>

 

ғң қ ғ ө :

 

1. <table width=100% bgcolor=#660F0F>

2. <tr>

3. <td align="CENTER">

4. <font class=middle color=#CC9090>

5. <i>Copyright 2007, <a class=light href="mailto:[email protected]"><u><font class=middle color=#CC9090>B-SHOP.KZ</font></u></a>.All rights reserved.</i>

6. </font>

7. </center>

8. </td>

9. </tr>

10. </table>

ң ғ қ, ү, ө show_cart.php (2.8 ). ө ң .

ө ң қң ғ қ, қғ қң , ө ө.

 

1 @ $new = $HTTP_GET_VARS['new'];

2 if($new){

3 if(!isset($HTTP_SESSION_VARS['cart'])){

4 $HTTP_SESSION_VARS['cart']=array();

5 $HTTP_SESSION_VARS['items']=0;

6 $HTTP_SESSION_VARS['total_price'] ='0.00';}

7 if(isset($HTTP_SESSION_VARS['cart'][$new]))

8 $HTTP_SESSION_VARS['cart'][$new]++;

9 else

10 $HTTP_SESSION_VARS['cart'][$new]=1;

11 $HTTP_SESSION_VARS['total_price']=calculate_price ($HTTP_ SESSION _VARS['cart']);

12 $HTTP_SESSION_VARS['items']=calculate_items($HTTP_SESSION_ VARS ['cart']);}

13 if(isset($HTTP_POST_VARS['save'])){

14 foreach ($HTTP_SESSION_VARS['cart'] as $isbn => $qty){

15 if($HTTP_POST_VARS[$isbn]=='0')

16 unset($HTTP_SESSION_VARS['cart'][$isbn]);

17 else

18 $HTTP_SESSION_VARS['cart'][$isbn] = $HTTP_POST_VARS[$isbn];}

19 $HTTP_SESSION_VARS['total_price'] =

20 calculate_price($HTTP_SESSION_VARS['cart']);

21 $HTTP_SESSION_VARS['items'] = calculate_items ($HTTP_ SESSION_ VARS['cart']);}

22 if($HTTP_SESSION_VARS['cart']&&array_count_values($HTTP_ SESSION_VARS['cart']))

23 display_cart($HTTP_SESSION_VARS['cart']);

ұ ң ң ө.

 

1 function display_cart($cart, $change = true, $images = 1){

2 global $HTTP_SESSION_VARS;

3 echo '<table border=0 width=100% cellspacing = 0>

4 <form action=show_cart.php method = post>

5 <tr><th colspan='. (1+$images).' bgcolor="#cccccc"></th>

6 <th bgcolor="#cccccc"></th><th bgcolor="#cccccc"></th>

7 <th bgcolor="#cccccc"></th></tr>';foreach ($cart as $isbn => $qty){

8 $link = mysql_connect("localhost", "root", "");

9 mysql_select_db ("dip");

10 $query = "select * from books where isbn='$isbn'";

11 $result = mysql_query($query);

12 echo '<td align = left>';

15 echo '<a href = "show_book.php?id='.$id.'">'.$name.'</a>';

16 echo '</td><td align = center>$'.number_format($price, 2);

17 echo '</td><td align = center>';

18 if ($change == true)

19 echo "<input type = text name = \"$isbn\" value = \"$qty\" size = 3>";

20 else

21 echo $qty;

22 echo '</td><td align=center>'.numberformat($price*$qty,2)."</td></tr>\n";}

23 echo '<tr>

24 <th colspan = '. (2+$images)." bgcolor=\"#cccccc\">&nbsp;</td>

25 <th align=center bgcolor=\"#cccccc\">".$HTTP_SESSION_VARS['items']."

26 </th>

27 <th align=center bgcolor=\"#cccccc\">.numberformat($HTTP_SESSION _VARS['total_price'], 2).

28 </th>

29 </tr>';

30 echo '</form></table>';}?>

 

, ғ ө ө.

 

1 function calculate_price($cart){

2 $price = 0.0;

3 if(is_array($cart)){

4 $link = mysql_connect("localhost", "root", "");

5 mysql_select_db ("dip");

6 foreach($cart as $isbn => $qty){

7 $query = "select price from books where isbn='$isbn'";

8 $result = mysql_query($query);

9 if ($result){

10 $item_price = mysql_result($result, 0, 'price');

11 $price +=$item_price*$qty;}}}

12 return $price;}

13 function calculate_items($cart){

14 $items = 0;

15 if(is_array($cart)){

16 foreach($cart as $isbn => $qty){

17 $items += $qty;}}

18 return $items;}

 

ң ғ checkout.php қ ә . ө ә ң . ұ ә : , , қ , , -. ө ң ғ . ң , .

 

1 <form action="order.php" method="POST">

2 <table border="1" align="CENTER" width="100%">

3 <tr>

4 <td colspan="2"><center><b> </b></center></td>

5 </tr>

6 <tr>

7 <td align="CENTER"></td>

8 <td><input type="TEXT" name="name"></td>

9 </tr>

10 <tr>

11 <td align="CENTER"></td>

12 <td><input type="TEXT" name="surname"></td>

13 </tr>

14 <tr>

15 <td align="CENTER">E-mail</td>

16 <td><input type="TEXT" name="email"></td>

17 </tr>

18 <tr>

19 <td align="CENTER"></td>

20 <td><input type="TEXT" name="phone"></td>

21 </tr>

22 <tr>

23 <td align="CENTER"></td>

24 <td><input type="TEXT" name="address"></td>

25 </tr>

26 <tr>

27 <td colspan="2"><center><input type="SUBMIT" value=" "></center></td>

28 </tr>

29 </table>

30 </form>

ә ғ ө ә , қ. ө ң ә қ ө.

 

1 $name=$HTTP_POST_VARS['name'];

2 $surname=$HTTP_POST_VARS['surname'];

3 $email=$HTTP_POST_VARS['email'];

4 $phone=$HTTP_POST_VARS['phone'];

5 $address=$HTTP_POST_VARS['address'];

6 if ($name=='' || $surname=='' || $email=='' || $phone=='' || $address==''){

7 echo '<font size=6 color=red><center><b> </b></center></font>';

8 $url='checkout.php';

9 echo "<b><center><a href=\"$url\"></a></center></b><br>";}

10 else{

11 echo "<font size=6 color=red><center><b> <br> <br> </b></center></font>";

12 $book=$HTTP_SESSION_VARS['items'];

13 $amount=$HTTP_SESSION_VARS['total_price'];

14 $date=date("Y-m-d");

15 $link = mysql_connect("localhost", "root", "") or die (" MySQL");

16 mysql_select_db ("dip") or die (" ");

17 $q="insert into orders values ('','$amount','$book', '$date')";

18 $result=mysql_query($q);

19 if (!$result) echo " ";

20 else {

21 echo " <br>";

22 $q="select id from orders";

23 $result=mysql_query($q);

24 $num=mysql_num_rows($result);

25 $q="insert into users values ('','$name','$surname','$email','$phone','$address','$num')";

26 $result=mysql_query($q);

27 if (!$result) echo " ";}

28 session_destroy();

 

қ өң ққ. ң :

1. ғ қ ү, ө ә ;

2. ққ ғ ұ ;

3. ;

4. ә .

ө ү ө.

 

1 <a href="work_cat.php"> </a><br>

2 <a href="work_users.php"> </a><br>

3 <a href="work_gb.php"> </a><br>

4 <a href="work_pass.php"> </a><br>

5 <a href="logout.php"> </a>

 

ұ қ өң ң ө

қ ө, ү, ң қ delete_cat.php, edit_cat.php, add_cat.php ғ. ө ң ө. ң қ ө ө.

 

1 $q="select * from categories where name='$name'";

2 $result=mysql_query($q);

3 if (mysql_num_rows($result)==0){

4 $q="insert into categories values ('','$name')";

5 $result=mysql_query($q);

6 if (!$result) echo " ";

7 else {echo " <br>";

8 echo "<a href=\"work_cat.php\"> </a>";}}

9 else echo " ";

 

Қ ә :

 

1 $q="select * from orders where id='$id'";

2 $result=mysql_query($q);

3 print "<table border=1>\n";

4 print "<tr>\n";

5 print "<th></th>\n";

6 print "<th></th>";

7 print "<th></th>";

8 print "</tr>\n\n";

9 while ($row=mysql_fetch_assoc($result)){

10 print "<tr>";

11 print "<td>".$row['date']."</td>";

12 print "<td>".$row['amount']."</td>";

13 print "<td>".$row['book']."</td>";}

14 print "</tabel>\n";

 

 





:


: 2016-10-23; !; : 430 |


:

:

,
==> ...

1725 - | 1494 -


© 2015-2024 lektsii.org - -

: 0.11 .