Upload van fotos

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Falcon

Falcon

05/11/2005 17:59:00
Quote Anchor link
Ik heb een versie van Geodesic auction lopen en dat werkt best goed. Op 1 ding na. Foto's bij een object plaatsen met een externe url werkt goed, maar foto's uploaden tijden het plaatsen van een advertentie niet.
Zo langzaamaan krijg ik er een PHP gevormd hoofd van <grijns> Wie O wie vindt de fout?

Het deel waar dat moet gebeuren luidt:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
<? //auction_sell_class.php

 \**************************************************************************/


class Auction_sell {

    var
$seller_id;
    var
$auction_types= array (
            1 => "Standard auction",
                2 => "Dutch auction"
              );
    var
$auction_variables;
    var
$error_variables;
    var
$extra_category_questions = "";
    var
$terminal_category = 0;
            
    var
$auction_detail_collected = 0;
    var
$auction_approved = 0;
    
    var
$error=0;
    var
$auction_id;
        
    //number of days an auction can be displayer for
    //the numbers in this array represent the number of days the seller can
    //choose from for the length of their auction.  These values will appear in the dropdown
    //list the seller is given to list their auctions

    var $auction_duration = array(1,3,5,7,10,14,28); //number of days an auction can be
    
    //1 - to allow uploads of images to your auctions    
    //0 - to NOT allow uploads of images to your auctions
    //either way the seller can enter a url of an image to place in the ad

    var $allow_uploads = 1;
    var
$temp_auction_image = 0;
    var
$temp_auction_image_type = 0;
    
    //upload path for images uploaded within the selling process.
    //this is just a temporary location. If the ad is approved by the seller the image will
    //be moved to the permanent location.  

    var $temp_upload_path = "http://www.data-service.nl/geo";
    
    //final directory path the uploaded auction images will be placed in
    var $auction_images_path= "http://www.data-service.nl/geo/foto/";
    
    //name of the auction images directory relative to auctions.php
    var $auction_images_directory = "/foto";
    
    //maximum size in KB you will allow uploaded to your site
    var $max_uploaded_image_size = 1000000;
    
    //days to keep old uploaded tmp files on server
    var $days_to_keep_files = 1;
    
    //url path to auction images directory
    var $url_to_images_directory = "http://www.data-service.nl/geo/foto/";
    
    //url path to temporary auction images directory
    var $url_to_tmp_images_directory = "http://www.data-service.nl/geo";
        
    var
$auction_categories_table = "geodesic_auctions_categories";
    var
$auctions_table = "geodesic_auctions";
    var
$auction_login_table = "geodesic_auctions_logins";
    var
$auctions_states_table = "geodesic_auctions_states";
    
    //font tag information used throughout several parts of the site    
    var $font_title_tag = "<font face=arial,helvetica size=3 color=#003333>";
    var
$font_tag = "<font face=arial,helvetica size=2 color=#000000>";
    var
$font_tag_small = "<font face=arial,helvetica size=1 color=#000000>";
    
    var
$messages = array();

//#####################################################################

    function Auction_sell ($userid)
    {

         //constructor
         $this->seller_id = $userid;
        
         $this->messages[2000] = "Item categorie";
         $this->messages[2001] = "Item bescrijving";
         $this->messages[2002] = "verkoper";
         $this->messages[2003] = "veiling type";
         $this->messages[2004] = "aantal items";
         $this->messages[2005] = "veilingduur";
         $this->messages[2006] = "dagen";
         $this->messages[2007] = "Start bod";
         $this->messages[2008] = "Reserve prijs";
         $this->messages[2009] = "'Koop nu'prijs";
         $this->messages[2010] = "Item beschrijving";
         $this->messages[2011] = "Land";
         $this->messages[2012] = "Uw veiling is sucsesvol ingebracht";
         $this->messages[2013] = "Click hier om het resultaat te zien";
         $this->messages[2014] = "Kies hier de hoofdcategorie.";
         $this->messages[2015] = " categorie heeft ";
         $this->messages[2016] = " subcategories<br>als onderstaand. kies uw categorie.";
         $this->messages[2017] = "De ";
         $this->messages[2018] = "sub categorieen om uit te kiezen:";
         $this->messages[2019] = " categorie";
         $this->messages[2020] = "Of plaats uw veiling in de ";
         $this->messages[2021] = "Geef uw veiling een titel";
         $this->messages[2022] = "Kies het land waarin uw artikel is";
         $this->messages[2023] = "geef de postkode waar het artikel is";
         $this->messages[2024] = "Geef een geldige postkode";
         $this->messages[2025] = "Er moet mionimaal 1 artikel in een veiling zijn";
         $this->messages[2026] = "Geef een getal in bij aantal items";
         $this->messages[2027] = "Geef een korte beschrijving";
         $this->messages[2028] = "geef het afbeeldingsadres";
         $this->messages[2029] = "afbeelding";
         $this->messages[2030] = "url van de afbeelding";
         $this->messages[2031] = "url addresvan de afbeelding";
         $this->messages[2032] = "aantal of items";
         $this->messages[2033] = "aantal items in deze veiling";
         $this->messages[2034] = "reserve prijs";
         $this->messages[2035] = "het laagste bedrag waar u voor wilt verkopen";
         $this->messages[2036] = "opening";
         $this->messages[2037] = "het bedrag waar de veiling mee begint";
         $this->messages[2038] = "postkode";
         $this->messages[2039] = "postkode waar het artikel is";
         $this->messages[2040] = "veiling titel";
         $this->messages[2041] = "dit verrschijnt in iedere lijst van veilingen";
         $this->messages[2042] = "veilingduur";
         $this->messages[2043] = "lengte van uw veiling in dagen";
         $this->messages[2044] = "kies een land";
         $this->messages[2045] = "bevestig";
         $this->messages[2046] = "edit categorie";
         $this->messages[2047] = "edit afbeelding";
         $this->messages[2048] = "edit details";
         $this->messages[2049] = "Hoofd";
         $this->messages[2050] = "afbeeldingsadres";
         $this->messages[2051] = "Could not complete your request";
         $this->messages[2052] = "There was an internal error in trying to complete your request";
         $this->messages[2053] = "Er zijn geen hoofdcategorieen";
         $this->messages[2054] = "Vul de details van uw veiling in";
         $this->messages[2055] = "veilingtype";
         $this->messages[2056] = "Is dit een standaard of dutch auction";
         $this->messages[2057] = "afbeeldings url";
         $this->messages[2058] = "veilinglocatie";
         $this->messages[2059] = "Er zijn geen hoofdcategorieen";
         $this->messages[2060] = "hoeveelheid in de veiling";
         $this->messages[2061] = "Click hier om een nieuwe veiling te starten";
         $this->messages[2062] = "Click here om het verkoopproces te stoppen";
         $this->messages[2063] = " afbeelding uploaden werkt helaas (nog) niet";
         $this->messages[2064] = "geen afbeelding opgegeven of ingezonden";
        
         //need to delete old tmp images not deleted
         $this->delete_old_tmp_files();
    
    }
//end of function Auction_sell
    
//####################################################################


    function check_if_category($db,$category=0)
    {

        if ($category)
        {

            //check to see if this number is even a category
            $sql_query = "select * from ".$this->auction_categories_table." where category_id = ".$category;
            $result = &$db->Execute($sql_query);
            if (!$result)
            {

                //echo $sql_query." is the query<br>\n";
                $this->error_message = $this->messages[2052];
                return false;
            }

            else
            {
                if ($result->RecordCount() == 1)
                    return true;
                else
                {
                    //echo $sql_query." is the query<br>\n";
                    $this->error_message = $this->messages[2052];
                    return false;
                }
            }
        }

        else
        {
            $this->error_message = $this->messages[2052];
            return false;
        }
    }
//end of function check_if_category
    
//#####################################################################


    function get_sell_form_variables ($info)
    {

        //get the variables from the form and save them
        while (list($key,$value) = each($info))
        {

            $this->auction_variables[$key] = $value;
            //echo $key." is the key and this is the value - ".$value."<br>\n";
        }

    }
//end of function get_sell_form_variables ($info)
    
//#####################################################################


    function choose_category($db,$parent_category=0)
    {

        //echo "hello from choose category<br>\n";
        //echo $parent_category." is the parent category<br>\n";

        if ($parent_category)
        {

            //echo $terminal_category." is the terminal category in secondary<br>\n";
            $sql_query = "select category_name from ".$this->auction_categories_table." where category_id = ".$parent_category;
            $result = &$db->Execute($sql_query);
            if (!$result)
            {

                //echo $sql_query." is the query<br>\n";
                $this->error_message = $this->messages[2052];
                return false;
            }

            elseif ($result->RecordCount() == 1)
            {

                $show = $result->FetchNextObject();

                $sql_query = "select * from ".$this->auction_categories_table." where parent_id = ".$parent_category;
                $sub_result = &$db->Execute($sql_query);
                if (!$sub_result)
                {

                    //echo $sql_query." is the query<br>\n";
                    $this->error_message = $this->messages[2052];
                    return false;
                }

                elseif ($sub_result->RecordCount() > 0)
                {

                    echo "<table align=center cellpadding=5 cellspacing=0 border=0 align=center width=600>\n";
                    echo "<tr>\n\t<td align=center>\n\t".$this->font_tag.$this->messages[2017].$show->CATEGORY_NAME."</b>".$this->messages[2015].
                        $number_of_sub_cats.$this->messages[2016]." \n\t</td>\n</tr>\n";
                    echo "<tr>\n\t<td align=center>\n\t<table cellpadding=3 cellspacing=0 border=0>\n\t";
                    echo "<tr>\n\t\t<td>\n\t\t".$this->font_tag.$this->messages[2018]."\n\t\t</td>\n\t</tr>\n\t";
                     while ($show_sub_cats = $sub_result->FetchNextObject())
                     {

                        //display the subcategories of this parent_category
                        echo "<tr>\n\t\n\t\t<td align=center>\n\t<a href=auctions.php?a=1&b=".$show_sub_cats->CATEGORY_ID."&c=category>".$this->font_tag.$show_sub_cats->CATEGORY_NAME."</a>\n\t\t</td>\n\t</tr>\n\t";
                    }

                    //need to display this category as a choice here
                    echo "<tr>\n\t\t<td align=center>\n\t\t".$this->font_tag.$this->messages[2020]."<a href=auctions.php?a=1&b=".$parent_category."&c=terminal>".$show->CATEGORY_NAME."</a>".$this->messages[2019]."\n\t\t</td>\n\t</tr>\n\t";
                    echo "<tr>\n\t<td align=center>\n\t<br><br><a href=auctions.php?a=97>".$this->font_tag.$this->messages[2062]."</a>\n\t</td>\n</tr>\n";
                    echo "\n\t</table>\n\t</td>\n</tr>\n";
                    echo "</table>\n";
                }

                else
                {
                    //this is the terminal category
                    //there are no sub categories underneath it
                    //check this is really a category

                    if ($this->check_if_category($db,$parent_category))
                    {

                        //this is a true category id make it the terminal one
                        if (!$this->set_terminal_category($db,$parent_category))
                        {

                            $this->error_message = $this->messages[2052];    
                            return false;
                        }

                        else
                        {
                            $this->display_auction_detail_form($db);                    
                        }
                    }

                    else
                    {
                        $this->error_message = $this->messages[2052];
                        return false;
                    }
                }

                return true;
            }

            else
            {
                //echo $sql_query." is the query<br>\n";
                $this->error_message = $this->messages[2052];
                return false;        
            }
        }

        else
        {
            //choose the main category
            $sql_query = "select * from ".$this->auction_categories_table." where parent_id = 0";
            $result = &$db->Execute($sql_query);
            
            if (!$result)
            {

                //echo $sql_query." is the query<br>\n";
                $this->error_message = $this->messages[2052];
                return false;    
            }


            echo "<table cellpadding=5 cellspacing=0 border=0  align=center width=600 bgcolor=#ffffff>\n";
            echo "<tr>\n\t<td align=center>\n\t".$this->font_tag.$this->messages[2014]."\n\t</td>\n</tr>\n";
            if ($result->RecordCount() > 0)
            {

                while ($show = $result->FetchNextObject())
                {

                    //show all the categories in the option list
                    echo "<tr>\n\t<td align=center>\n\t<a href=auctions.php?a=1&b=".$show->CATEGORY_ID.">".$this->font_tag.$show->CATEGORY_NAME."</a>\n\t</td>\n</tr>\n";
                }
//end of while
            }
            else
            {
                echo "<tr>\n\t<td align=center>\n\t".$this->font_tag.$this->messages[2053]."\n\t</td>\n</tr>\n";
            }


            echo "\n\t</td>\n</tr>\n";
            echo "<tr>\n\t<td align=center>\n\t<br><br><a href=auctions.php?a=97>".$this->font_tag.$this->messages[2062]."</a>\n\t</td>\n</tr>\n";
            echo "</table>\n";
            return true;
        }
    }
//end of function choose_category

//#####################################################################


    function auction_detail_check()
    {

        $this->error = 0;

        if (strlen(trim($this->auction_variables["auction_title"])) ==0)
        {

            //error in auction_title - was not entered
            $this->error++;
            $this->error_variables["auction_title"] = $this->messages[2021];
        }


        if ($this->auction_variables["state"] == "none")
        {

            //no state chosen
            $this->error++;
            $this->error_variables["state"] = $this->messages[2022];
        }


        if (strlen(trim($this->auction_variables["zip_code"])) == 0)
        {

            //error in auction_zip - was not entered
            $this->error++;
            $this->error_variables["zip_code"] = $this->messages[2023];
        }

        else
        {
            //check that zip is regulation size
            if (strlen(trim($this->auction_variables["zip_code"])) < 5)
            {

                //zip not long enough
                $this->error++;
                $this->error_variables["zip_code"] = $this->messages[2024];
            }
        }



        if ($this->auction_variables["opening_bid"] == 0)  
        {

            //the opening bid will be set to the minimum of .01
            $this->auction_variables["opening_bid"] = .01;
        }


        if ((intval($this->auction_variables["number_of_items"])) != 0)
        {

            if ($this->auction_variables["number_of_items"] == 0)  
            {

                //The number of items in the auction must be greater than 0
                $this->error++;
                $this->error_variables["number_of_items"] = $this->messages[2025];
            }
        }

        else
        {
            //value is not an integer which it should
            $this->error++;
            $this->error_variables["number_of_items"] = $this->messages[2026];
        }
//end of else

        if (strlen(trim($this->auction_variables[description])) == 0)
        {

            $this->error++;
            $this->error_variables["description"] = $this->messages[2027];
        }

        
        //echo $this->error." is the error count<br>\n";
        
        if ($this->error == 0)
        {

            $this->auction_details_collected = 1;
            //echo "details checked ok<br>\n";
            return true;
        }

        else
            return false;
        
    }
//end of function auction_detail_check()
    
//#####################################################################################


    function insert_auction ($db) {
        $auction_starts = time();

        //set this to minutes by using the first line
        $auction_ends =  $this->DateAdd("d",$auction_starts,$this->auction_variables["auction_length"]);

        //echo gettype($auction_ends)." is the type of ends time<br>\n";
        //echo $auction_ends." is auction ends<br>\n";
        //echo $auction_starts." is auction starts<br>\n";

        
        if ($this->auction_variables["opening_bid"] == "")
            $opening_bid = .01;
        else
            $opening_bid = $this->auction_variables["opening_bid"];

        if ($this->auction_variables["reserve_price"] == "")
            $reserve_price = .01;
        else
            $reserve_price = $this->auction_variables["reserve_price"];

        $sql_query = "INSERT INTO ".$this->auctions_table."  
            (seller,title,date,description,category,minimum_bid,reserve_price,auction_type,
            duration,location_state,location_zip,ends,closed,quantity)
            VALUES  
            (\""
.$this->seller_id."\",
            \""
.$this->auction_variables["auction_title"]."\",
            \""
.$auction_starts."\",
            \""
.$this->auction_variables["description"]."\",
            "
.$this->terminal_category.",
            "
.$opening_bid.",
            "
.$reserve_price.",1,
            "
.$this->auction_variables["auction_length"].",
            \""
.$this->auction_variables["state"]."\",
            \""
.$this->auction_variables["zip_code"]."\",
            \""
.$auction_ends."\",
            0,
            "
.$this->auction_variables["number_of_items"]." )";
            
        $result = &$db->Execute($sql_query);

        if (!$result)
        {

            //echo $sql_query." is the query<br>\n";
            return false;
        }

        else
        {
            $this->auction_id = $db->Insert_ID();
            
            //echo $this->auction_id." is the auction id<bR>\n";

            if ($this->temp_auction_image)
            {

                //move the auction temp image into the images directory

                if (is_file($this->temp_upload_path.$this->temp_auction_image))
                {

                    //echo $this->temp_upload_path.$this->temp_auction_image." is the temp auction image path<br>\n";
                    //echo $this->auction_images_path.$this->auction_id.$this->temp_auction_image_type." is the final destination path<br>\n";
                    //echo "the uploaded file is there<br>\n";
                    //echo $this->temp_upload_path.$this->temp_auction_image." is the temp auction image path<br>\n";
                    //echo $this->auction_images_path.$this->auction_id.$this->temp_auction_image_type." is the final destination path<br>\n";

                    if (move_uploaded_file($this->temp_upload_path.$this->temp_auction_image,$this->auction_images_path.$this->auction_id.$this->temp_auction_image_type))
                    {

                        //echo $this->temp_upload_path.$this->temp_auction_image." is the temp auction image path<br>\n";
                        //echo $this->auction_images_path.$this->auction_id.$this->temp_auction_image_type." is the final destination path<br>\n";                    
                        //echo "move worked<Br>\n";

                        chmod($this->auction_images_path.$this->auction_id.$this->temp_auction_image_type, 0755);
                        $sql_query = "update    ".$this->auctions_table." set image_url = \"".$this->url_to_images_directory.$this->auction_id.$this->temp_auction_image_type."\"
                            where id = "
.$this->auction_id;
                        $result = &$db->Execute($sql_query);
                        if (!$result)
                        {

                            //echo $sql_query." is the query<br>\n";
                            $this->error_message = $this->messages[2052];
                            return false;
                        }
                    }

                    else
                    {
                        //echo "move did not work<br>\n";
                        
                    }
                }
            }

            else
            {
                $sql_query = "update    ".$this->auctions_table." set image_url = \"".$this->auction_variables["image_url"]."\"
                    where id = "
.$this->auction_id;
                $result = &$db->Execute($sql_query);
                if (!$result)
                {

                    echo $sql_query." is the query<br>\n";
                    $this->error_message = $this->messages[2052];
                    return false;
                }
            }

            
            return true;
        }
        
    }
//end of function insert_auction

//#####################################################################


    function check_user($db,$username)
    {

        if (strlen(trim($username)) > 0)
        {

            $username = htmlspecialchars($username);
            $sql_query = "select * from ".$this->auction_login_table." where username=\"".AddSlashes($username)."\"";
            $result = mysql_query($sql_query);
            if (mysql_num_rows($result) == 0)
            {

                return false;
            }

            else
            {
                $show = mysql_fetch_array($result);
                $this->seller_id = $show["id"];
                return true;
             }
          }

          else
          {
            return false;
          }
    }


//#####################################################################

    function display_auction_detail_form ($db)
    {

        echo "<form action=auctions.php?a=1 method=post enctype=multipart/form-data>\n";
        echo "<table cellpadding=5 cellspacing=0 border=0  align=center width=600>\n";
        echo "<tr>\n\t<td align=center colspan=2>".$this->font_title_tag.$this->messages[2054]."\n\t</td>\n</tr>\n";

        //auction type
        //echo "<tr>\n\t<td valign=top align=right>".$this->messages[2055]."<br>".$this->messages[2056]."\n\t</td>\n\t";
        //echo "<td><select name=b[auction_type]>\n\t";
        //echo "<option value=1";
        //if ($this->auction_variables["auction_type"] == "1")  {
        //    echo " selected ";
        //    }
        //echo ">standard\n\t";
        //echo "<option value=2";
        ///if ($this->auction_variables["auction_type"] == "2")
        //    echo " selected ";
        //echo ">dutch\n\t</select>\n\t</td>\n</tr>\n";

        //auction duration

        echo "<tr>\n\t<td valign=top align=right>".$this->font_tag.$this->messages[2042]."</font><br>".$this->font_tag_small.$this->messages[2043]."\n\t</td>\n\t";
        echo "<td>\n\t".$this->font_tag."<select name=b[auction_length]>\n\t\t";
        while (list($key,$value) = each($this->auction_duration))
        {

            //display the possible auction lengths to choose from
            echo "<option value=".$value;
            if ($this->auction_variables["auction_length"] == $value)
                   echo " selected";
            echo ">".$value;
            if ($value == 1)
                echo " day\n\t\t";
            else
                echo " days\n\t\t";
        }

        echo "</select>\n\t</td>\n</tr>\n";
        
        //auction title
        $this->basic_input_box($this->messages[2040],$this->messages[2041],"b[auction_title]",
            $this->auction_variables["auction_title"],$this->error_variables["auction_title"]);

        //state
        echo "<tr>\n\t<td align=right>".$this->font_tag.$this->messages[2044];
        if ($this->error_variables["state"])
            echo "<br>".$this->error_variables["state"];
        echo "</td>\n\t";
        echo "<td>\n\t";
        $this->show_state_dropdown($db,$this->auction_variables["state"],"b[state]");
        echo "</td>\n</tr>\n";

        //zip location
        $this->basic_input_box($this->messages[2038],$this->messages[2039],"b[zip_code]",
            $this->auction_variables["zip_code"],$this->error_variables["zip_code"]);

        //opening bid
        $this->basic_input_box($this->messages[2036],$this->messages[2037],"b[opening_bid]",
            $this->auction_variables["opening_bid"]);

        //reserve price
        $this->basic_input_box($this->messages[2034],$this->messages[2035],"b[reserve_price]",
            $this->auction_variables["reserve_price"]);

        //number of items
        $this->basic_input_box($this->messages[2032],$this->messages[2033],"b[number_of_items]",
            $this->auction_variables["number_of_items"],$this->error_variables["number_of_items"]);

        //image url
        $this->basic_input_box($this->messages[2030],$this->messages[2031],"b[image_url]");
            
        //or upload an image
        if ($this->allow_uploads)
        {

            echo "<tr>\n\t<td align=right>".$this->font_tag.$this->messages[2063]."</td>\n\t";
            echo "<td>\n\t<input type=file name=c>
                <input type=hidden name=MAX_FILE_SIZE value="
.$this->max_uploaded_image_size.">\n\t</td>\n</tr>\n";
        }


        echo "<tr>\n\t<td colspan=2>".$this->font_tag."beschrijving:<br>\n\t";
        if (strlen(trim($error_auction_description)) > 0)
        {

            echo $this->error_variable["description"]."<br>\n\t";
        }

        echo "</td>\n</tr>\n";
        echo "<tr>\n\t<td colspan=2><textarea name=b[description] cols=50 rows=15>";
        if (strlen(trim($this->auction_variables["description"])) > 0)
            echo $this->auction_variables["description"];
        echo "</textarea>\n\t</td>\n</tr>\n";

        echo "<tr>\n\t<td colspan=2 align=center><input type=submit name=submit value=\"bevestig veiling informatie\">\n\t</td>\n</tr>\n";
        echo "<tr>\n\t<td align=center colspan=2>\n\t<br><br><a href=auctions.php?a=97>".$this->font_tag.$this->messages[2062]."</a>\n\t</td>\n</tr>\n";
        echo "</table>\n</form>";
        
    }
//end of function display_auction_detail_form ()

//#####################################################################3


    function sell_success()
    {

        echo "<table  align=center width=600 BORDER=0>\n<tr>\n\t<td align=center>\n\t";
        echo $this->font_title_tag.$this->messages[2012]."</FONT>\n\t<BR><BR>\n\t";
        echo "<A HREF=\"auctions.php?a=2&b=".$this->auction_id."\">";
        echo $this->font_tag.$this->messages[2013]."</A></FONT><BR><BR>\n\t</td>\n</tr>\n</table>\n";
        session_unregister("sell");

    }
//end of function sell_success

//#####################################################################


    function show_state_dropdown ($db,$state,$name)
    {

        $sql_query = "select * from ".$this->auctions_states_table;
        $result = &$db->Execute($sql_query);
        if (!$result)
        {

            //echo $sql_query." is the query<br>\n";
            $this->error_message = $this->messages[2052];
            return false;
        }

        else
        {
            echo "<select name=".$name.">\n\t\t";
            echo "<option value=none>".$this->messages[2044]."\n\t\t";
            while ($show = $result->FetchNextObject()) {
                //spit out the state list
                echo "<option value=\"".$show->ABBREVIATION."\"";
                if ($state == $show->ABBREVIATION)
                echo "selected";
                echo ">".$show->NAME."\n\t\t";
            }

        
            echo "</select>\n\t";
        }

    }
//end of function show_state_dropdown

//########################################################################


    function basic_input_box($input_title,$explanation,$input_name,$input_value="",$error="")
    {

        echo "<tr>\n\t<td valign=top align=right>".$this->font_tag.$input_title."</font><br>";
          if (strlen(trim($error)) > 0) {
               //spit out the auction_title error
               echo $this->font_tag_small.$error."</font><br>\n\t";
        }

           echo $this->font_tag_small.$explanation."</font>\n\t</td>\n\t";
           echo "<td valign=top>\n\t".$this->font_tag."<input type=text name=".$input_name." length=30 ";
         if (strlen(trim($input_value)) > 0)
               echo "value=\"".$input_value."\"";
           echo " maxlength=100>\n\t";
        echo "</td>\n</tr>\n";
    }


//########################################################################

    function get_user_name($db)
    {

        $sql_query = "select username from ".$this->auction_login_table." where id = ".$this->seller_id;
        $result = &$db->Execute($sql_query);
        
        if (!$result)
        {

            //echo $sql_query." is the query<Br>\n";
            $this->error_message = $this->messages[2052];
            return false;        
        }

        
        $show = $result->FetchNextObject();
        
        return $show->USERNAME;
    }


//########################################################################

    function get_category_tree($db)
    {

        $i = 0;
        $category_next = $this->terminal_category;
        do
        {
            $sql_query = "select category_id,parent_id,category_name from ".$this->auction_categories_table."
                where category_id = "
.$category_next;
            $category_result =  &$db->Execute($sql_query);
            
            if (!$category_result)
            {

                //echo $sql_query." is the query<br>\n";
                $this->error_message = $this->messages[2052];
                return false;
            }

            $show_category = $category_result->FetchNextObject();
             $category[$i]["parent_id"]  = $show_category->PARENT_ID;
             $category[$i]["category_name"] = $show_category->CATEGORY_NAME;
             $category[$i]["category_id"]   = $show_category->CATEGORY_ID;
             $i++;
             $category_next = $show_category->PARENT_ID;

             }
while ( $show_category->PARENT_ID != 0 );
             
             return $category;

    }
// end of function get_category_tree($category)
    
//########################################################################


    function auction_approval_display($db)
    {

        echo "<table border=0 cellpadding=0 cellspacing=0 align=center width=600>\n";
        
        //category name
        echo "<tr>\n\t<td>\n\t<b>";
        echo $this->font_tag.$this->messages[2000]." : </b> ".$this->messages[2049]." >";
        
        $category_tree = $this->get_category_tree($db);
                
        if (is_array($category_tree))
        {

            $i = 0;
            $categories = array_reverse($category_tree);
            $num_categories = count($categories);
            while ($i < $num_categories)
            {

                //display all the categories
                if ($i == ($num_categories - 1))
                    echo "<b>".$categories[$i]["category_name"]."</b>";
                else
                    echo $categories[$i]["category_name"]." > ";
                $i++;
            }
        }

        else
            echo $category_tree;
        echo "\n\t</td>\n</tr>\n";
        
        //detail box
        echo "<tr>\n\t<td>\n\t";
        echo "<table cellpadding=2 cellspacing=1 border=0>\n\t";
        
        //auction title
        echo "<tr>\n\t\t<td>".$this->font_title_tag.$this->auction_variables["auction_title"]."</td>\n\t</tr>\n\t";
        
        //auction quantity
        echo "<tr>\n\t\t<td>".$this->font_tag.$this->messages[2060].": ".$this->auction_variables["number_of_items"]."</td>\n\t</tr>\n\t";
        
        //seller id
        $name = $this->get_user_name($db);        
        echo "<tr>\n\t\t<td>".$this->font_tag.$this->messages[2002].": ".$name."</td>\n\t</tr>\n\t";        

        //auction type
        //maybe later versions
        //echo "<tr>\n\t\t<td>".$this->messages[2003].": ".$this->auction_types[$this->auction_variables["auction_type"]]."</td>\n\t</tr>\n\t";        
    
        //number of items
        //if ($auction_info["auction_type"] == 1 )
        //{
        //    echo "<tr>\n\t\t<td>".$this->messages[2004].": ".$this->auction_variables["number_of_items"]."</td>\n\t</tr>\n\t";        
        //}
        
        //auction ends

        echo "<tr>\n\t\t<td>".$this->font_tag.$this->messages[2005].": ";
        echo intval($this->auction_variables["auction_length"]).$this->messages[2006]."</td>\n\t</tr>\n\t";        

        //starting bid
        echo "<tr>\n\t\t<td>".$this->font_tag.$this->messages[2007].": ".$this->auction_variables["opening_bid"]."</td>\n\t</tr>\n\t";        

        //reserve price
        echo "<tr>\n\t\t<td>".$this->font_tag.$this->messages[2008].": ".$this->auction_variables["reserve_price"]."</td>\n\t</tr>\n\t";        

        echo "</table>\n\t</td>\n</tr>\n";
        echo "<tr>\n\t<td colspan=2>\n\t<hr width=100% size=2 >\n\t</td>\n</tr>\n";
        
        //image
        if ($this->auction_variables["image_url"])
        {

            echo "<tr>\n\t<td colspan=2>\n\t".$this->messages[2057]."<br>".$this->auction_variables["image_url"]."<br>\n\t
            <img src="
.$this->auction_variables["image_url"]." border=0>\n\t</td>\n</tr>\n\t";
        }

        elseif (($this->temp_auction_image) && ($this->temp_auction_image_type) && ($this->temp_auction_image_type != "none"))
        {

            echo "<tr>\n\t<td colspan=2>\n\t".$this->font_tag.$this->messages[2057]."<br>uploaded image<br>\n\t
                <img src="
.$this->url_to_tmp_images_directory.$this->temp_auction_image." border=0>\n\t</td>\n</tr>\n\t";
        }

        else
        {
            echo "<tr>\n\t<td colspan=2>\n\t".$this->font_tag.$this->messages[2064]."\n\t</td>\n</tr>\n\t";
        }



        //description
        echo "<tr>\n\t<td colspan=2>\n\t".$this->font_tag.$this->messages[2010]."<br>".$this->auction_variables["description"]."\n\t</td>\n</tr>\n";
        
        echo "<tr>\n\t<td colspan=2>\n\t<hr width=100% size=2 >\n\t</td>\n</tr>\n";
        
        //location information
        echo "<tr>\n\t<td colspan=2>\n\t".$this->font_tag.$this->messages[2058].": ".
            $this->auction_variables["state"]." ".$this->auction_variables["zip_code"]."\n\t</td>\n</tr>\n";

        echo "<tr>\n\t<td colspan=2 align=center>\n\t";
        echo "<a href=auctions.php?a=1&b=accepted>".$this->font_tag.$this->messages[2045]."</a><br>\n\t";
        echo "<a href=auctions.php?a=1&b=edit_category>".$this->font_tag.$this->messages[2046]."</a><br>\n\t";
        echo "<a href=auctions.php?a=1&b=edit_details>".$this->font_tag.$this->messages[2048]."</a>\n\t";
        echo "</td>\n</tr>\n</table>\n";
            
        return true;
            
    }
//end of function auction_approval_display
    
//####################################################################################


    function DateAdd ($interval, $date,$quantity)
    {

        $difference =  $date2 - $date1;
        switch ($interval)
        {
            case
"w":
                $timevalue  = 604800;
                break;
            case
"d":
                $timevalue  = 86400;
                break;
            case
"h":
                $timevalue = 3600;
                break;        
            case
"m":
                $timevalue  = 60;
                break;    
        }

        
        $returnvalue = $date +($quantity * $timevalue);
            return $returnvalue;
    }
//end of function DateDifference        
    
//#########################################################################


    function sell_error()
    {

        echo "<table cellpadding=5 cellspacing=1 border=0 align=center width=600>\n";
        echo "<tr>\n\t<td>".$this->font_tag.$this->messages[2051]."</td>\n</tr>\n";
        if ($this->error_message)
            echo "<tr>\n\t<td>".$this->font_tag.$this->error_message."</td>\n</tr>\n";
        echo "</table>\n";
    
    }
//end of function sell_error
    
//#########################################################################


    function set_terminal_category($db,$category_id)
    {

        //set the category name and category variables
        $sql_query = "select category_name from ".$this->auction_categories_table." where category_id = ".$category_id;
        $result = &$db->Execute($sql_query);
        
        if (!$result)
        {

            //echo $sql_query." is the query<br>\n";
            $this->error_message = $this->messages[2052];
            return false;        
        }

        elseif ($result->RecordCount() == 1)
        {

            $show = $result->FetchNextObject();
            $this->terminal_category_name = $show->CATEGORY_NAME;
            $this->terminal_category = $category_id;
            return true;
        }

        else
        {
            $this->error_message = $this->messages[2052];
            return false;
        }
    }
//end of function set_terminal_category($category)

//#########################################################################


    function end_sell_process()
    {

        echo "<table  align=center width=600 BORDER=0>\n<tr>\n\t<td align=center><br><br>";
        echo $this->font_title_tag.$this->messages[2060]."\n\t<BR><BR>\n\t";
        echo "<A HREF=auctions.php?a=1>";
        echo $this->font_tag.$this->messages[2061]."</A><br><br>\n\t</td>\n</tr>\n</table>\n";    

    }
//end of function end_sell_process
    
//##########################################################################

    
    function upload_the_auction_image($auction_image_file=0,$type,$size)
    {

        if ($auction_image_file)
        {

            if ($size < $this->max_uploaded_image_size)
            {

                //get temporary image file name
                switch ($type)
                {
                    case
"image/gif":
                        $this->temp_auction_image_type = ".gif";            
                        break;
                    case
"image/pjpeg":
                        $this->temp_auction_image_type = ".jpg";            
                        break;
                    case
"image/jpg":
                        $this->temp_auction_image_type = ".jpg";            
                        break;
                    default:

                        $this->temp_auction_image_type = "none";    
                        return false;
                        break;
                }


                do {
                    srand((double)microtime()*1000000);
                    $pass = rand();
                    $pass = trim($pass);            
                }
while (is_file($this->temp_upload_path.$pass.$this->temp_auction_image_type));
                $this->temp_auction_image = $pass.$this->temp_auction_image_type;

                move_uploaded_file($auction_image_file,$this->temp_upload_path.$this->temp_auction_image);
                //echo $this->temp_upload_path.$this->temp_auction_image." is uploaded file temp destination<br>\n";
                return true;
            }

            else
            {
                return false;
            }
        }

        else
        {
            return false;
        }
    }
//end of upload_the_auction_image
    
//#########################################################################


    function delete_old_tmp_files()
    {

        if ($dir = @opendir($this->temp_upload_path))
        {

            $current_time = time();
            //echo $current_time." is the current time<br>\n";
            $time_limit = $this->days_to_keep_files * 60 * 60 * 24;  //length of time to keep files
            $delete_time = $current_time - $time_limit;
            //echo $delete_time." is the delete limit<br>\n";
            while (false !== ($file = readdir($dir))) {
                if ($file != "." && $file != "..") {
                    //echo $file."<br>\n";
                    if ($file_created = stat($this->temp_upload_path.$file))
                    {

                        //echo $file_created[9]." is the modified time<br>\n";
                        if ($file_created[9] < $delete_time)
                        {

                            //file needs to be deleted because older than time limit
                            unlink ($this->temp_upload_path.$file);
                        }
                    }
                }
            }

            closedir($dir);
        }

        else
        {
            //could not open tmp directory
        }

    }
//end of function delete_old_tmp_files
    
//################################################################################



} //end of Auction_sell
?>
 
PHP hulp

PHP hulp

23/04/2024 13:54:09
 
- SanThe -

- SanThe -

05/11/2005 18:50:00
Quote Anchor link
Als ik in de kerstvakantie niks te doen heb zal ik je boek doorlezen. Het is een beetje groot vind je zelf niet?

Edit: Het zijn 923 regels..........
Gewijzigd op 05/11/2005 18:51:00 door - SanThe -
 

05/11/2005 20:38:00
Quote Anchor link
waarom plaats je niet gewoon het enige wat je fout lijkt?
 
Falcon

Falcon

05/11/2005 21:03:00
Quote Anchor link
sorry, ik dacht dat jullie het het liefst in het totaal zagen.

volgens mij gaat het om dit stuk

//##########################################################################

function upload_the_auction_image($auction_image_file=0,$type,$size)
{
if ($auction_image_file)
{
if ($size < $this->max_uploaded_image_size)
{
//get temporary image file name
switch ($type)
{
case "image/gif":
$this->temp_auction_image_type = ".gif";
break;
case "image/pjpeg":
$this->temp_auction_image_type = ".jpg";
break;
case "image/jpg":
$this->temp_auction_image_type = ".jpg";
break;
default:
$this->temp_auction_image_type = "none";
return false;
break;
}

do {
srand((double)microtime()*1000000);
$pass = rand();
$pass = trim($pass);
} while (is_file($this->temp_upload_path.$pass.$this->temp_auction_image_type));
$this->temp_auction_image = $pass.$this->temp_auction_image_type;

move_uploaded_file($auction_image_file,$this->temp_upload_path.$this->temp_auction_image);
//echo $this->temp_upload_path.$this->temp_auction_image." is uploaded file temp destination<br>\n";
return true;
}
else
{
return false;
}
}
else
{
return false;
}
} //end of upload_the_auction_image

//#########################################################################

function delete_old_tmp_files()
{
if ($dir = @opendir($this->temp_upload_path))
{
$current_time = time();
//echo $current_time." is the current time<br>\n";
$time_limit = $this->days_to_keep_files * 60 * 60 * 24; //length of time to keep files
$delete_time = $current_time - $time_limit;
//echo $delete_time." is the delete limit<br>\n";
while (false !== ($file = readdir($dir))) {
if ($file != "." && $file != "..") {
//echo $file."<br>\n";
if ($file_created = stat($this->temp_upload_path.$file))
{
//echo $file_created[9]." is the modified time<br>\n";
if ($file_created[9] < $delete_time)
{
//file needs to be deleted because older than time limit
unlink ($this->temp_upload_path.$file);
}
}
}
}
closedir($dir);
}
else
{
//could not open tmp directory
}

} //end of function delete_old_tmp_files
 
- SanThe -

- SanThe -

05/11/2005 21:52:00
Quote Anchor link
En hoe roep je de functie upload_the_auction_image() aan?
 
Falcon

Falcon

06/11/2005 07:52:00
Quote Anchor link
ik zou het niet weten, dit is tot nu toe de enige plek waar die functie vernoemd staat
 

06/11/2005 11:25:00
Quote Anchor link
die functie gaat niets uitvoeren als jij hem niet aanroept dus dat moet je eerst maar eens zoeken
 
Falcon

Falcon

06/11/2005 20:08:00
Quote Anchor link
Ik wordt helemaal gestoord van dit verhaal, ik geef het op, ik droom intussen in php, dan maar geen foto's uploaden
 
Jan Koehoorn

Jan Koehoorn

06/11/2005 20:13:00
Quote Anchor link
Falcon,

PHP leren gaat in kleine stapjes en kost enorm veel tijd. Ik besteed er per dag uren aan, en ik weet zeker dat de andere forumleden met ervaring dat ook doen.

Geef het niet te snel op, maar begin klein. Begin met korte scripts, van een regel of tien, twintig. Met dit project heb je het jezelf waarschijnlijk veel te moeilijk gemaakt. Eerst fietsen, dan wielrennen.
 

06/11/2005 20:15:00
Quote Anchor link
@Jan: Dat is heel mooi gezegd. :) Het is wel de waarheid. :)
 
Falcon

Falcon

07/11/2005 06:54:00
Quote Anchor link
nou dit was een kant-en-klaar free script dat alleen enige aanpassing in de settings behoefde, vandaar dat ik er van uit ging dat het wel ok zou zijn. helaas niet dus. Ik heb meerdere van dit type scripts geprobeert (auction) maar allemaal met het zelfde probleem. Het nadeel van dit soort scripts is didelijk dat de handleiding erg beperkt is. In dat kader was ik al erg blij dat ik het op dat ene onderdeel na toch werkend kreeg, zeker voor een newbie als ik
 
Lissy Pixel

Lissy Pixel

07/11/2005 10:36:00
Quote Anchor link
Er is een fantastisch nieuw script hier neergezet voor fotos en wanneer dit niet lukt dan werkt dit voor de 100%

HIER KLIKKEN

Suc6 met alles!
Groet, lissy
 
Falcon

Falcon

07/11/2005 20:43:00
Quote Anchor link
ik ben iets verder gekomen. de foto komt vooralsnog eerst in de temp map, maar is daar niet te zien want heeft cmod 600 (die temp map zelf heeft cmod 777), iemand enig idee waar ik dat kan instellen of met welk commando?

Daarna moet de foto verhuizen naar de def. map, (foto) maar dat is volgende hoofdstuk
 

07/11/2005 21:04:00
Quote Anchor link
@lissy: Is ie echt zo fantastisch? ;)
 
Falcon

Falcon

07/11/2005 21:32:00
Quote Anchor link
Het script van lisse heb ik niet kunnen inbouwen dus dat weet ik niet. Heb zitten klooien en nu lijkt het te werken, met die kanttekening dat de voorlopige upload (voor de verkoper bevestigt) de cmod 600 heeft en een kruisje oplevert. Na bevestiging verschijnt de foto uiteindelijk wel goed in de definitieve map. We zijn er dus bijna
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.