File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <html>
2+ <head>
3+ <title>Payment information</title>
4+ </head>
5+ <body>
6+ <?php
7+ try {
8+ $ conn = new MongoClient ();
9+ $ db = $ conn ->customers ;
10+ $ collection = $ db ->paymentinfo ;
11+ $ search = $ _GET ['acctid ' ];
12+ // $criteria = array('id' => $search);
13+ // $fields = array('name','id','cc','cvv2');
14+
15+
16+ $ cursor = $ collection ->find (array ('id ' => $ search ));
17+
18+ // echo $search;
19+ echo $ cursor ->count () . ' document(s) found. <br/> ' ;
20+
21+ foreach ($ cursor as $ obj ) {
22+ echo 'Name: ' . $ obj ['name ' ] . '<br/> ' ;
23+ echo 'Customer ID: ' . $ obj ['id ' ] . '<br/> ' ;
24+ echo 'Card Number: ' . $ obj ['cc ' ] . '<br/> ' ;
25+ echo 'CVV2 Code: ' . $ obj ['cvv2 ' ] . '<br/> ' ;
26+ echo '<br/> ' ;
27+ }
28+
29+ $ conn ->close ();
30+ } catch (MongoConnectionException $ e ) {
31+ die ('Error connecting to MongoDB server : ' . $ e ->getMessage ());
32+ } catch (MongoException $ e ) {
33+ die ('Error: ' . $ e ->getMessage ());
34+ }
35+ ?>
36+
37+
38+ </body>
39+ </html>
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < title > Customer Info</ title >
4+ </ head >
5+
6+ < body >
7+ < h1 > Customer Information</ h1 >
8+ < h3 > Enter your customer ID to show your account information:</ h3 >
9+
10+ < form method = "get "
11+ action = "acct.php ">
12+ Customer ID:
13+ < input type = "text "
14+ name = "acctid "
15+ value ="">
16+ < br >
17+ < input type ="submit ">
18+ </ form >
19+
20+ </ body >
21+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+
3+ <html>
4+
5+ <head>
6+ <title>Order Lookup</title>
7+ </head>
8+
9+ <body>
10+ <?php
11+ if (isset ($ _GET ['ordersearch ' ]) && !empty ($ _GET ['ordersearch ' ])) {
12+ try {
13+ $ result = "" ;
14+ $ conn = new MongoClient ('mongodb://127.0.0.1 ' );
15+ $ db = $ conn ->shop ;
16+ $ collection = $ db ->orders ;
17+ $ search = $ _GET ['ordersearch ' ];
18+ $ js = "function () { var query = ' " . $ ordersearch . "'; return this.id == query;} " ;
19+ //print $js;
20+ print '<br/> ' ;
21+
22+ $ cursor = $ collection ->find (array ('$where ' => $ js ));
23+ echo $ cursor ->count () . ' order(s) found. <br/> ' ;
24+
25+ foreach ($ cursor as $ obj ) {
26+ echo 'Order ID: ' . $ obj ['id ' ] . '<br/> ' ;
27+ echo 'Name: ' . $ obj ['name ' ] . '<br/> ' ;
28+ echo 'Item: ' . $ obj ['item ' ] . '<br/> ' ;
29+ echo 'Quantity: ' . $ obj ['quantity ' ]. '<br/> ' ;
30+ echo '<br/> ' ;
31+ }
32+
33+ $ conn ->close ();
34+ } catch (MongoConnectionException $ e ) {
35+ die ('Error connecting to MongoDB server : ' . $ e ->getMessage ());
36+ } catch (MongoException $ e ) {
37+ die ('Error: ' . $ e ->getMessage ());
38+ }
39+ }
40+ ?>
41+
42+
43+ <b>Use the Order ID to locate your order:</b><br>
44+ <form method="get" id="usersearch">
45+ <p>Search <input type="text" name="ordersearch" id="ordersearch" /> <input type="submit" name="submitbutton" value="Submit" /></p>
46+ </form>
47+ <div id="results">
48+ <?php echo $ result ; ?>
49+ </div>
50+ </body>
51+ </html>
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+
3+ <html>
4+
5+ <head>
6+ <title>User Profile Lookup</title>
7+ </head>
8+
9+ <body>
10+ <?php
11+ if (isset ($ _GET ['usersearch ' ]) && !empty ($ _GET ['usersearch ' ])) {
12+ try {
13+ $ result = "" ;
14+ $ conn = new MongoClient ('mongodb://192.168.87.157 ' );
15+ $ db = $ conn ->appUserData ;
16+ $ collection = $ db ->users ;
17+ $ search = $ _GET ['usersearch ' ];
18+ $ js = "function () { var query = ' " . $ usersearch . "'; return this.username == query;} " ;
19+ print $ js ;
20+ print '<br/> ' ;
21+
22+ $ cursor = $ collection ->find (array ('$where ' => $ js ));
23+ echo $ cursor ->count () . ' user found. <br/> ' ;
24+
25+ foreach ($ cursor as $ obj ) {
26+ echo 'Name: ' . $ obj ['name ' ] . '<br/> ' ;
27+ echo 'Username: ' . $ obj ['username ' ] . '<br/> ' ;
28+ echo 'Email: ' . $ obj ['email ' ] . '<br/> ' ;
29+ echo '<br/> ' ;
30+ }
31+
32+ $ conn ->close ();
33+ } catch (MongoConnectionException $ e ) {
34+ die ('Error connecting to MongoDB server : ' . $ e ->getMessage ());
35+ } catch (MongoException $ e ) {
36+ die ('Error: ' . $ e ->getMessage ());
37+ }
38+ }
39+ ?>
40+
41+
42+ <b>Enter your username:</b><br>
43+ <form method="get" id="usersearch">
44+ <p>Search <input type="text" name="usersearch" id="usersearch" /> <input type="submit" name="submitbutton" value="Submit" /></p>
45+ </form>
46+ <div id="results">
47+ <?php echo $ result ; ?>
48+ </div>
49+ </body>
50+ </html>
You can’t perform that action at this time.
0 commit comments