أباتشي التعليمي المحتوى الديناميكي مع CGI. The سغي واجهة بوابة المشتركة يحدد وسيلة لخادم الويب للتفاعل مع برامج توليد المحتوى الخارجية، والتي غالبا ما يشار إليها باسم برامج سغي أو سغي البرامج النصية وهي أبسط، والأكثر شيوعا، وسيلة ل وضع محتوى ديناميكي على موقع الويب الخاص بك وسوف تكون هذه الوثيقة مقدمة لإعداد سغي على خادم الويب أباتشي الخاص بك، والبدء في كتابة برامج سغي. من أجل الحصول على برامج سغي الخاص بك للعمل بشكل صحيح، سوف تحتاج إلى أن يكون أباتشي تكوين للسماح تنفيذ سغي هناك العديد من الطرق للقيام بذلك. ملاحظة إذا تم بناء أباتشي مع دعم وحدة مشتركة تحتاج إلى التأكد من أن يتم تحميل وحدة في الخاص بك تحتاج إلى التأكد من لم يتم تعليق التوجيه لودمود خارج قد توجيه توجيه تكوين بشكل صحيح مثل هذا على ويندوز، أو باستخدام مم غير مترابطة مثل بريفورك، توجيهات تكوينها بشكل صحيح قد تبدو مثل هذا. يخبر التوجيه سكريبتالياس أباتشي أن يتم تعيين دليل معين جانبا ل سغ I البرامج سوف تفترض أباتشي أن كل ملف في هذا الدليل هو برنامج سغي، وسوف تحاول تنفيذ ذلك، عندما يطلب هذا المورد معين من قبل عميل. يبدو التوجيه سكريبتالياس مثل. سكريبتاس سغي-بن أسر المحلية apache2 سغي-بن. المثال الموضح هو من ملف التكوين الافتراضي الخاص بك، إذا قمت بتثبيت أباتشي في الموقع الافتراضي التوجيه سكريبتالياس يشبه إلى حد كبير توجيه الاسم المستعار، الذي يحدد بادئة عنوان ورل الذي يتم تعيينه إلى دليل معين الاسم المستعار و سكريبتالياس عادة ما تستخدم للدلائل التي هي خارج دليل دوكومنتروت الفرق بين الاسم المستعار و سكريبتالياس هو أن سكريبتالياس لديه معنى إضافي أن كل شيء تحت هذه البادئة ورل سيعتبر برنامج سغي لذلك، المثال أعلاه يقول أباتشي أن أي طلب لمورد يبدأ مع سغي بن يجب يتم تقديمها من الدليل أسر المحلي apache2 سغي-بن ويجب أن تعامل على أنها برنامج سغي. على سبيل المثال، إذا كان عنوان ورل مطلوب، سوف أباتشي محاولة t o تنفيذ الملف وإرجاع الإخراج بطبيعة الحال، فإن الملف يجب أن يكون موجودا، وتكون قابلة للتنفيذ، وإرجاع الناتج بطريقة معينة، أو أباتشي سيعود رسالة خطأ. كثيرا ما تقتصر برامج سغي إلى الدلائل سكريبتالياس إد لأسباب أمنية وبهذه الطريقة، يمكن للمسؤولين التحكم بشكل صارم الذي يسمح باستخدام برامج سغي ومع ذلك، إذا اتخذت الاحتياطات الأمنية المناسبة، لا يوجد سبب لماذا لا يمكن تشغيل برامج سغي من الدلائل التعسفية على سبيل المثال، قد ترغب في السماح للمستخدمين لديهم محتوى ويب في الدلائل الرئيسية الخاصة بهم مع توجيهات وسيردير إذا كانوا يريدون الحصول على برامج سغي الخاصة بهم، ولكن دون الحصول على الوصول إلى الدليل الرئيسي سغي بن، فإنها سوف تحتاج إلى أن تكون قادرة على تشغيل برامج سغي في مكان آخر. هناك خطوتين للسماح سغي التنفيذ في دليل تعسفي أولا، يجب تفعيل معالج سغي-سكريبت باستخدام توجيه أدهاندلر أو سيثاندلر ثانيا، يجب تحديد إكسيسجي في توجيهات الخيارات. يمكنك استخدام صراحة الخيار s داخل ملف تكوين الخادم الرئيسي الخاص بك لتحديد أن تنفيذ سغي كان مسموحا به في دليل معين. دليل أوسر المحلي apache2 هتدوسس سومدير خيارات إكسكجي الدليل. التوجيه أعلاه يقول أباتشي للسماح بتنفيذ ملفات سغي سوف تحتاج أيضا إلى أن أقول الملقم ما هي ملفات سغي التوجيه التالي أدهاندلر يخبر الملقم لمعالجة جميع الملفات مع سغي أو تمديد بل كما برامج سغي. أدهاندلر سغي-سكريبت. يظهر البرنامج التعليمي كيفية تفعيل برامج سغي إذا لم يكن لديك الوصول إلى. ل السماح بتنفيذ برنامج سغي لأي ملف تنتهي في أدلة المستخدمين، يمكنك استخدام التكوين التالي. ديركتوري هوم بوبليشتمل خيارات إكسكجي أدهاندلر سغي-سكريبت Directory. If كنت ترغب في تعيين دليل سغي بن دليل المستخدم s حيث سيتم التعامل مع كل شيء كبرنامج سغي، يمكنك استخدام الصفحة التالية. ديركتوري هوم بوبليشتمل سغي-بن خيارات إكسكجي سيثاندلر سغي-سكريبت Directory. There نوعان من الاختلافات الرئيسية بين r والبرمجة إغولار، والبرمجة سغي. أولا، يجب أن يسبقه كل الإخراج من برنامج سغي برأس مايم من نوع هذا هو الرأس الذي يخبر العميل أي نوع من المحتوى الذي يتلقاه معظم الوقت، وهذا سوف تبدو مثل. ثانيا، يجب أن يكون الإخراج في هتمل أو بعض التنسيقات الأخرى التي سيتمكن المتصفح من عرضها في معظم الأحيان، سيكون هذا هتمل، ولكن أحيانا قد تكتب برنامج سغي ينتج صورة جيف أو محتوى آخر غير هتمل . وبصرف النظر عن هذين الأمرين، كتابة برنامج سغي سوف تبدو كثيرا مثل أي برنامج آخر قد تكتب. وفيما يلي مثال على برنامج سغي الذي يطبع سطر واحد إلى المتصفح الخاص بك اكتب ما يلي، حفظه إلى ملف يسمى و وضعه في دليل سغي بن الخاص بك. أوسر بن بيرل برينت المحتوى نوع النص هتمل ن طباعة مرحبا، World. Even إذا كنت غير مألوف مع بيرل، يجب أن تكون قادرا على رؤية ما يحدث هنا السطر الأول يقول أباتشي أو أي قذيفة كنت يحدث أن تعمل تحت هذا يمكن تنفيذ البرنامج عن طريق تغذية الملف إلى مترجم موجود في موقع أسر بن بيرل السطر الثاني يطبع إعلان نوع المحتوى تحدثنا عنه، تليها اثنين من أزواج خط النقل إعادة العودة هذا يضع خط فارغ بعد رأس، للإشارة نهاية الرؤوس، وبداية الجسم السطر الثالث يطبع سلسلة مرحبا والعالم وهذا هو نهاية it. If قمت بفتح المتصفح المفضل لديك وتقول لها للحصول على العنوان. أينما كنت وضعت الملف الخاص بك، سترى سطر واحد مرحبا، العالم تظهر في نافذة المتصفح الخاص بك انها ليست مثيرة جدا، ولكن بمجرد الحصول على هذا العمل، سيكون لديك فرصة جيدة للحصول على مجرد أي شيء work. There هي أربعة الأشياء الأساسية التي قد تراها في المتصفح عند محاولة الوصول s برنامج سغي الخاص بك من web. The إخراج برنامج سغي الخاص بك عظيم وهذا يعني كل شيء يعمل بشكل جيد إذا كان الإخراج هو الصحيح، ولكن المتصفح لا يعالج بشكل صحيح، تأكد من أن لديك نوع المحتوى الصحيح المنصوص عليها في برنامج سغي الخاص بك و شفرة المصدر لبرنامج سغي الخاص بك أو أسلوب آخر غير مسموح الرسالة رسالة وهذا يعني أنك لم تكوين أباتشي بشكل صحيح لمعالجة برنامج سغي الخاص بك إعادة قراءة القسم على تكوين أباتشي ومحاولة العثور على ما فاتك رسالة تبدأ مع المحرمة وهذا يعني أن هناك مشكلة أذونات تحقق من سجل أخطاء أباتشي والقسم أدناه على أذونات الملف رسالة تقول خطأ في الخادم الداخلي إذا قمت بفحص سجل خطأ أباتشي سوف تجد على الأرجح أنه يقول نهاية مبكرة من رؤوس النصي، ربما جنبا إلى جنب مع رسالة خطأ تم إنشاؤها بواسطة الخاص بك سغي البرنامج في هذه الحالة، سوف تحتاج إلى التحقق من كل من الأقسام التالية لمعرفة ما قد يكون منع برنامج سغي الخاص بك من انبعاث الرؤوس المناسبة. تذكر أن s إرفر لا يعمل كما كنت وهذا هو، عند بدء تشغيل الخادم، يتم تشغيله مع أذونات المستخدم غير الممنوح - عادة لا أحد أو ووو - وهكذا سوف تحتاج أذونات إضافية لتنفيذ الملفات التي تملكها لك عادة، والطريقة لإعطاء ملف أذونات كافية ليتم تنفيذها من قبل أحد هو إعطاء الجميع تنفيذ إذن على الملف. أيضا، إذا كان البرنامج يقرأ من، أو يكتب إلى، أي ملفات أخرى، تلك الملفات سوف تحتاج إلى الأذونات الصحيحة للسماح بذلك. عند تشغيل برنامج من سطر الأوامر لديك بعض المعلومات التي يتم تمريرها إلى قذيفة دون تفكير في ذلك على سبيل المثال، لديك باث الذي يحكي قذيفة حيث يمكن أن تبحث عن الملفات التي مرجعها. عندما يتم تشغيل البرنامج من خلال خادم الويب كبرنامج سغي، فإنه قد لا يكون نفس باث أي برامج التي تستدعي في برنامج سغي الخاص بك مثل سيندمايل على سبيل المثال سوف تحتاج إلى أن تكون محددة من قبل مسار كامل، بحيث قذيفة يمكن العثور عليها عندما تحاول تنفيذ سغي الخاص بيأر ogram. A مظهر شائع من هذا هو المسار إلى مترجم البرنامج النصي في كثير من الأحيان بيرل المشار إليها في السطر الأول من برنامج سغي الخاص بك، والتي سوف تبدو شيء مثل. تأكد من أن هذا هو في الواقع الطريق إلى مترجم. عندما تحرير النصوص سغي على ويندوز، يمكن إلحاق أحرف نهاية الخط إلى مسار مترجم تأكد من نقل الملفات ثم إلى الملقم في وضع أسي فشل في القيام بذلك قد يؤدي إلى تحذيرات لم يتم العثور على الأوامر من نظام التشغيل، يتم تفسير حرف الخط كجزء من اسم الملف المترجم. إذا كان برنامج سغي الخاص بك يعتمد على متغيرات البيئة غير القياسية سوف تحتاج إلى التأكد من أن تلك المتغيرات يتم تمريرها من قبل أباتشي. عندما تفوت رؤوس من البيئة، تأكد من تنسيقها وفقا إلى رك 2616 سيكتيون 4 2 يجب أن تبدأ أسماء الرأس بحرف متبوع بحروف أو أرقام أو واصلة فقط أي رأس ينتهك هذه القاعدة سيتم إسقاطه بصمت. في معظم الأوقات التي يفشل فيها برنامج سغي، فا المشكلة مع البرنامج نفسه هذا صحيح بشكل خاص بمجرد الحصول على تعليق من هذه الأشياء سغي، ولم يعد جعل اثنين من الأخطاء أعلاه أول شيء يجب القيام به هو التأكد من أن البرنامج الخاص بك يعمل من سطر الأوامر قبل اختباره عبر خادم الويب على سبيل المثال، try. cd أسر apache2 سغي-بن المحلي. لا تستدعي مترجم بيرل يجب أن تجد شل و أباتشي المترجم باستخدام معلومات المسار على السطر الأول من البرنامج النصي. يجب أن يكون أول شيء تراه مكتوب من قبل البرنامج مجموعة من الرؤوس، بما في ذلك نوع المحتوى متبوعا ب خط فارغ إذا كنت ترى أي شيء آخر، سوف أباتشي إرجاع نهاية سابق لأخطاء الرؤوس النص البرمجي إذا حاولت تشغيله من خلال الملقم انظر كتابة برنامج سغي أعلاه لمزيد من التفاصيل. سجلات الخطأ هي صديقك أي شيء يذهب على نحو خاطئ يولد رسالة في سجل الأخطاء يجب أن ننظر دائما هناك أولا إذا كان المكان الذي تستضيف فيه موقع الويب الخاص بك لا يسمح لك بالوصول إلى سجل الأخطاء، يجب عليك على الأرجح استضافة موقعك في مكان آخر تعلم قراءة سجلات الأخطاء، وسوف تجد أن تقريبا يتم التعرف على جميع المشاكل الخاصة بك بسرعة، وسرعان ما حلها. برنامج دعم سويكسيك يسمح برامج سغي ليتم تشغيلها تحت أذونات المستخدم المختلفة، اعتمادا على المضيف الظاهري أو دليل المستخدم الرئيسي التي توجد في سويزيك لديه فحص إذن صارم جدا، وأي فشل في ذلك التدقيق يؤدي إلى فشل برامج سغي الخاص بك مع نهاية سابق لرؤوس النص. للتحقق ما إذا كنت تستخدم سويكسيك، تشغيل أباتشكتل - V والتحقق من موقع سويكسكبين إذا وجدت أباتشي وهو سويكسيك ثنائي هناك عند بدء التشغيل، سيتم تفعيلها سويكسيك. إلا إذا كنت تفهم تماما سويكسيك، يجب أن لا تستخدمه لتعطيل سويكسيك، ببساطة إزالة أو إعادة تسمية سويكسيك ثنائي أشار إلى سويكسيكبين ثم إعادة تشغيل الملقم إذا، بعد قراءة عن سويكسيك كنت لا تزال ترغب في استخدامه، ثم تشغيل سويكسيك - V للعثور على موقع ملف سجل سيويكسيك، واستخدام ملف السجل هذا للعثور على السياسة التي تنتهك. كما تصبح أكثر تقدما في البرمجة سغي، وسوف يصبح من المفيد أن نفهم المزيد عن ما يحدث وراء الكواليس على وجه التحديد، كيف المتصفح والخادم التواصل مع بعضها البعض لأنه على الرغم من أنه كل شيء جيد جدا لكتابة البرنامج الذي يطبع مرحبا، العالم، انها ليست مفيدة بشكل خاص. متغيرات هي القيم التي تطفو حولك كما يمكنك استخدام جهاز الكمبيوتر الخاص بك هي أشياء مفيدة مثل المسار الخاص بك حيث يبحث الكمبيوتر عن الملف الفعلي تنفيذ أمر عند كتابته واسم المستخدم ونوع المحطة الطرفية، وهلم جرا للحصول على قائمة كاملة من المتغيرات البيئة العادية، كل يوم، اكتب إنف في موجه الأوامر. خلال معاملة سغي، الخادم والمتصفح أيضا تعيين متغيرات البيئة، بحيث يمكن التواصل مع بعضها البعض هذه هي الأشياء مثل نوع المتصفح نيتسكيب، إي، الوشق، نوع الخادم أباتشي، إيس، الموقع الإلكتروني، اسم برنامج سغي التي يتم تشغيلها، وهلم جرا. هذه المتغيرات متاحة لمبرمج سغي، ونصف من قصة الاتصال العميل الخادم القائمة الكاملة من المتغيرات المطلوبة في واجهة بوابة المشتركة رك. هذا البرنامج بسيط بيرل سغي سيتم عرض كافة المتغيرات البيئة التي يتم تمريرها حول اثنين من برامج مماثلة مدرجة في دليل سغي بن من ديبات أباتشي إيبوتيون لاحظ أن هناك بعض المتغيرات المطلوبة، في حين أن البعض الآخر اختياري، لذلك قد ترى بعض المتغيرات المدرجة التي لم تكن في القائمة الرسمية وبالإضافة إلى ذلك، أباتشي يوفر العديد من الطرق المختلفة لتتمكن من إضافة متغيرات البيئة الخاصة بك إلى تلك الأساسية المقدمة افتراضيا . أوسر بن بيرل طباعة المحتوى من نوع النص هتمل ن فوريش مفتاح مفاتيح إنف مفتاح الطباعة - إنف br. Other الاتصالات بين الخادم والعميل يحدث على معيار الإدخال ستدين والإخراج القياسية ستدوت في السياق اليومي العادي، ستدين يعني لوحة المفاتيح، أو ملف أن يتم إعطاء برنامج للعمل على و ستدوت عادة ما يعني وحدة التحكم أو screen. When كنت بعد نموذج ويب إلى برنامج سغي، يتم تجميع البيانات في هذا النموذج حتى في شكل خاص ويحصل تسليمها إلى برنامج سغي الخاص بك أكثر ستين ثم البرنامج يمكن معالجة تلك البيانات كما لو كان قادم من لوحة المفاتيح، أو من ملف. تنسيق خاص بسيط جدا اسم الحقل وقيمته انضمت جنبا إلى جنب مع علامة يساوي، وتنضم أزواج من القيم معا مع علامة العطف يتم تحويل أحرف غير مريحة مثل المسافات وعلامات العطف وعلامات يساوي إلى مكافئها السداسي عشر بحيث لا تخدع الأعمال قد تبدو سلسلة البيانات بأكملها شيء من هذا القبيل. كما سترى أحيانا أيضا هذا النوع من التطبيق سلسلة ينتهي إلى ورل عند القيام بذلك، يضع الملقم تلك السلسلة في متغير البيئة يسمى كيريسترينغ أن يسمى طلب جيت يحدد نموذج هتمل ما إذا كان يتم استخدام جيت أو بوست لتسليم البيانات عن طريق تعيين السمة ميثود في فورم tag. Your البرنامج ثم هو المسؤول عن تقسيم تلك السلسلة تصل إلى معلومات مفيدة لحسن الحظ، وهناك مكتبات وحدات المتاحة لمساعدتك على معالجة هذه البيانات، وكذلك التعامل مع غيرها من جوانب برنامج سغي الخاص بك. عندما تكتب برامج سغي، يجب أن تنظر في استخدام مكتبة التعليمات البرمجية، أو وحدة نمطية، للقيام معظم العمل النخالة بالنسبة لك وهذا يؤدي إلى أخطاء أقل، وأسرع development. If كنت إعادة كتابة برامج سغي في بيرل، وحدات متوفرة على كبان وحدة الأكثر شعبية لهذا الغرض هو قد تنظر أيضا سغي لايت الذي ينفذ مجموعة الحد الأدنى من الوظائف، وهو كل ما تحتاجه في معظم البرامج. إذا كنت إعادة كتابة برامج سغي في C، وهناك مجموعة متنوعة من الخيارات واحد من هذه هي جيجيك ليبرار ذ، from. There عدد كبير من الموارد سغي على شبكة الإنترنت قائمة من نقابة الكتاب هتمل هو مصدر كبير من الإجابات على أسئلتك يمكنك معرفة المزيد at. The مواصفات سغي الحالي هو متاح في واجهة بوابة المشتركة رك. عندما تقوم بنشر سؤال حول مشكلة سغي التي تقوم بإعادة وجودها سواء كانت قائمة بريدية أو مجموعة أخبار، تأكد من تقديم معلومات كافية حول ما حدث، وما كنت تتوقع حدوثه، وكيف حدث ما حدث بالفعل، ما الخادم الذي تقوم بتشغيله، وما هي اللغة التي كان برنامج سغي فيها، وإذا كان ذلك ممكنا، رمز المخالف سيجعل هذا إيجاد مشكلتك أبسط من ذلك بكثير. ملاحظة أن الأسئلة حول مشاكل سغي يجب أبدا أن يتم نشرها إلى قاعدة بيانات علة أباتشي إلا إذا كنت متأكدا من كنت قد وجدت مشكلة في شفرة المصدر أباتشي. نوتيس هذا ليس قسم كا يجب أن توضع تعليقات وضعت هنا نحو اقتراحات بشأن تحسين الوثائق أو الخادم، ويمكن إزالتها مرة أخرى من قبل المشرفين لدينا إذا كانت ه إيثر تنفيذ أو تعتبر غير صالحة خارج الموضوع أسئلة حول كيفية إدارة خادم أباتشي يجب أن توجه إما على قناة إيرك لدينا، على فرينود، أو إرسالها إلى القوائم البريدية لدينا. كوبيرايت 2017 مؤسسة برمجيات أباتشي مرخصة تحت رخصة أباتشي، الإصدار 2 0.Allows تنفيذ فب شملت مباشرة على سطر الأوامر و فب بداية ونهاية العلامات فب وليس هناك حاجة وسوف يسبب خطأ تحليل إذا كان الحالي. يجب اتخاذها عند استخدام هذا النموذج من فب لا تصطدم مع استبدال سطر الأوامر المتغير القيام به بواسطة القذيفة. المثال 2 الحصول على خطأ في بناء الجملة عند استخدام علامات الاقتباس المزدوجة. المشكلة هنا هي أن ش باش يؤدي استبدال متغير حتى عند استخدام علامات الاقتباس المزدوجة لأنه من غير المرجح أن يتم تعريف المتغير فو، فإنه يتوسع إلى أي شيء مما يؤدي إلى رمز مرت إلى فب لتنفيذ القراءة في الواقع. الطريقة الصحيحة ستكون استخدام يقتبس واحد المتغيرات في سلاسل واحدة ونقلت لا يتم توسيعها بواسطة ش bash. Example 3 استخدام يقتبس واحدة لمنعها إذا كان ذلك مناسبا، يجب فتح تقرير الأخطاء في أنه لا يزال من السهل أن تواجه مشكلة عند محاولة استخدام المتغيرات قذيفة أو فب في كومناد سطر أو استخدام الرموش المائلة للهروب، حتى تأخذ عناية كبيرة عند القيام بذلك تم تحذيرك.- R هو متاح في سابي كلي ولكن ليس في سغي SAPI. This الخيار هو المقصود فقط لرمز أساسي جدا، لذلك بعض التوجيهات توجيه مثل كما يتم تجاهل أوتوبريبندفيل و أوتوابندفيل في هذا التمديد mode. Load زيند إذا تم إعطاء اسم ملف فقط، فب يحاول تحميل هذا التمديد من مسار المكتبة الافتراضي الحالي على النظام الخاص بك عادة على أنظمة لينكس، على سبيل المثال تمرير اسم ملف مع مسار مطلق سوف لا تستخدم نظام البحث عن مسار مكتبة s اسم الملف النسبي بما في ذلك معلومات الدليل سوف اقول فب لمحاولة تحميل ملحق بالنسبة إلى الدليل الحالي. عرض أسماء ملفات التكوين والأدلة الممسوحة ضوئيا متاح اعتبارا من فب 5 2 3.Show معلومات حول وظيفة معينة أو طريقة الطبقة على سبيل المثال عدد واسم المعلمات المتاحة اعتبارا من فب 5 1 2.This الخيار متاح فقط إذا تم تجميع فب مع دعم انعكاس. عرض المعلومات حول فئة معينة قائمة الثوابت والخصائص والأساليب المتاحة اعتبارا من فب 5 1 2. هذا الخيار متاح فقط إذا تم تجميع فب مع دعم انعكاس. عرض المعلومات حول قائمة تمديد معين من الخيارات، وظائف محددة، والثوابت والطبقات المتاحة اعتبارا من فب 5 1 2. هذا الخيار هو متاح فقط إذا كان فب تم تجميعها مع دعم انعكاس. إذا بدأنا فب s بنيت في خادم الويب فب v5 4 فصاعدا مع فب - S لوكالهوست 8000 - t هتدوكس ويكون ملف صورة في ذلك والمرجع في أتش تي أم أل صفحة مع إمغ الصفحة المقدمة لن تظهر الصورة ورمز هتمل وراء الصورة is. If ومع ذلك، فإن رمز هتمل في الصفحة هو إمغ تعرض الصورة بشكل صحيح. يتم كسر معالجة النسبية النسبية في فب 5 4 33 Win32 VC9 بناء. تثبيت كما سغي ب inary. suEXEC تتطلب وضع سغي، وإبطاء البرامج النصية فعلت لهم مثل هذا 1 تثبيت فب كما وضع دسو لسرعة قصوى وآمنة منخفضة 2 جعل سغي تثبيت منفصلة مع --enable-فورس-سغي-ريديريكت، مكان فب إلى سغي - bin 3 لمزيد من الأمان مع سويكسيك، اختر أحد الطرق التالية 3-1 ضع ملفا يحتوي على هذا لتجاوز التكوين الرئيسي أدتيب فب الإجراء سغي-بن فب سيتم حماية جميع ملفات فب في الدليل الفرعي 3-2 إضافة التالي في أدتيب سفب العمل سغي-بن فب ثم يجب إعادة تسمية كل ملف فب الحساسة to. Add فبفالو دوكروت المستخدم هتملدوس المنزل إلى كل توجيه المضيف الظاهري in. A تلميح ل ويندوز للمستخدمين. مجرد تلميح بالنسبة لك حتى لا تفعل نفس الخطأ كما فعلت لقد اكتشفت للتو أن فب أولا يبدو أن ننظر في دليل فب ل وإذا كان هذا الملف غير موجود، يبدو في دليل ويندوز إعادة تسمية الملف إلى ونسخه إلى دليل ويندوز الخاص بي، ثم قمت بتعديل سيئة السمعة 0 في الملف الموجود في دليل ويندوز، لجعله يعمل ولكن لم يفعل ذلك لأنه يقرأ من الأصل - لذلك عندما حذفت هذه الأشياء بدأت العمل مرة أخرى. الآن تشغيل فب كبرنامج سغي سيغير قيمة سيرفر سكريبثنام عند تشغيل عن طريق آلية مودفب العادية، سيتم تعيينه إلى اسم في الواقع، مسار إلى فب النصي الذي ق تشغيل عند تشغيل عبر سغي، فإنه بدلا من ذلك يشير إلى مسار سغي binary. PHP يعمل مع أباتشي و سويكسيك مثل هذا على افتراض أن سويكسيك إست ألريدي تثبيت والعمل. تحديث فب كما سغي ثنائي على سبيل المثال في أسر المحلي بن فب ترجمة - enable-فورس-سغي-ريديركت. إنشاء رابط داخل سغي بن الدليل لجعل فب-سغي الوصول سد مؤتمر نزع السلاح المحلي أباتشي سغي بن ل أسر المحلي بن فب php. Edit ملف أدهاندلر php4-سكريبت عمل php4- سكريبت سغي-بن php. VirtualHost 123 456 789 0 80 وسر exampleuser Group examplegroup. PHP-سكريبتس تسمى الآن تحت معرف المستخدم من إكسامبلوسر و غروب-إد من examplegroup.7 الخيارات الثنائية.7 الخيارات الثنائية. كيفية كسب المال على الانترنت مع تداول الخيارات الثنائية. منذ 2008، الاستثمار و م أكينغ المال على الانترنت مع الخيارات الثنائية أصبحت جذابة على نحو متزايد للمستثمرين والأفراد الذين يستثمرون في أسهم الأسهم والعملات والسلع هناك خياران فقط في التداول ثنائي وبالتالي استخدام مصطلح ثنائي يكاد يكون مثل وضع الرهان، في أن كنت هي الرهان أن الأصول سوف تزيد أو تنقص في القيمة على مدى فترة محددة من الزمن يوفر التداول ثنائي خيارات للسوق للتنظيم الذاتي، ويوفر فرصة لكبح في الأسهم المبالغة من خلال التكهن بأن الشركة سوف تشهد انخفاضا في قيمتها. في تداول الخيارات الثنائية كنت تراهن على أن سعر أصل معين إما زيادة أو نقصان خلال فترة محددة لديك الفخامة من معرفة المخاطر الخاصة بك والعودة إلى الأمام، قبل أن يتم التداول من أي وقت مضى التداول ثنائي هو وسيلة ممتازة للحصول على في السوق دون انفاق كبير من رأس المال أو احتياطي رأس المال المطلوب الاستفادة من المعلومات المقدمة على الحصول على فهم أفضل للخيارات الثنائية و فو ريكس التداول لكسب المال online. Get بدأت مع 3 خطوات سهلة. اختر وسيط من القائمة أدناه. تسجيل وسيط account. I شخصيا استخدام ستة وسطاء مختلفة للتداول وتوصي جميع التجار خطيرة لفتح عدد قليل من الحسابات مع وسطاء مختلفة في من أجل بناء مجموعة جيدة ومتنوعة من الأصول. بدء التداول مع أربع خطوات سهلة. كيف يمكنني بدء التداول لكسب الدخل. التجارة الثنائية سهلة يمكنك أن تفعل ذلك من أي مكان، حتى في المنزل لا تحتاج إلى أي خبرة سابقة في أقرب وقت كنت قد اخترت وسيط يمكنك البدء في التداول فورا عن طريق تسجيل وإيداع المال، وجعل التنبؤ الخاص بك يمكن أن يتم التداول في أي يوم وفي أي وقت من اليوم، على الأسهم والمؤشرات والعملات والسلع يمكنك إما اختيار للتجارة على الخيارات على المدى الطويل أو الخيارات على المدى القصير. أوصى القراءة. لماذا يمكنني الاستثمار في لهم. أنها توفر عوائد عالية جدا للمستثمر سوف تعرف ما هو العائد قبل اتخاذ الاستثمار يمكنك الحصول على عوائد للاستثمار الخاص بك s عالية مثل 91 أو أعلى، مع أدنى يجري 65 وهذا يوفر فرصة جيدة للحصول على عوائد عالية في فترة قصيرة من الوقت كما 60 ثانية. عندما التداول، لا تملك الأصول بدلا من ذلك، يمكنك ببساطة التنبؤ الاتجاه الذي فإن الأصول سوف تتحرك في السوق لفترة معينة من الوقت قيمة الأصول قد ترتفع أو تنخفض وسوف تعتمد عوائد الخاص بك على التنبؤ الذي أجريته القيمة التي تغير قيمة الأصول ليست مهمة منذ عوائد لا تتأثر من حجم التغيير في القيمة يمكنك التجارة في أي وقت لا توجد رسوم إضافية أو اللجان. أنا اكتسبت الكثير من الحرية من خلال تداول الخيارات الثنائية بما في ذلك الحرية المالية، فضلا عن الحرية والثقة أنا بحاجة إلى سن بعض إيجابية جدا التغييرات في حياتي عائلتي وأنا الاستفادة بشكل جيد من فرص إضافية لدينا ويأخذون رحلة إلى آسيا لقضاء عطلة هذا العام هذا شيء لم نكن قادرين على القيام به قبل أن اكتشفت تداول الخيارات الثنائية جيني، 4 3، ربة منزل. عندما كنت تأخذ بعين الاعتبار جميع الصفقات السيئة التي أدليت بها في حين كنت لا تزال تعلم الحبال، انها حقا حقا إنجازا مذهلا حتى أكثر من المدهش هو أنه بعد أربعة أشهر إضافية، كنت قد بارلايد المبلغ الأصلي أقل من 150 إلى أكثر من 15،000 أخذت هذا المال وأعاد تشكيل المطبخ والحمام، ولكن تركت قليلا للحصول على المال البذور في الصفقات الجديدة وأنا أعلم أنني يمكن أن أكرر نجاحي وبدأت بالفعل التداول مرة أخرى أماندا، 39، مدير المبيعات. كان غير متأكد قليلا في البداية، ولكن كما بدأت التعلم وجعل بعض الصفقات جيدة أصبحت مهووسا تعلم كل ما أستطيع و كسب العيش كخيارات الخيارات الثنائية اليوم، وأنا جعل دخل مريح من الخيارات الثنائية التداول جون، 47، الخيارات الثنائية تاجر. اقرأ الشهادات الكاملة هنا. اختر حق وسيط. سيفك في تداول الخيارات سيكون أكثر نجاحا إذا اخترت منصة التداول المناسبة أو وسيط الخيارات الثنائية تأكد من أن لديك منصة التداول الصحيح أو وسيط ينطوي على قراءة الاستعراضات وإجراء البحوث للتأكد من أنك اخترت واحدة موثوق بها مع هذا العمل هو بالفعل القيام به بالنسبة لك قائمة شاملة من أفضل السماسرة ومنصات التداول هو متاح لك عند التداول مع جنبا إلى جنب مع تلميحات مفيدة على أفضل طريقة للاختيار منصة الصحيحة لاحتياجاتك. في الوقت الحالي، نحن نقوم بإضافة أفضل وسطاء الخيارات الثنائية، قبول سكان الولايات المتحدة، على موقعنا على الانترنت إذا كنت مقيم في الولايات المتحدة، يجب عليك تحديد أي من الوسطاء تحت علم الولايات المتحدة الأمريكية. قراءة read. Make المال على الانترنت مع خيار ثنائي Robot. You إعادة الدخول في الاستثمار لأنك تريد أن تكسب أفضل عوائد ممكنة على الاستثمارات الخاصة بك مع برامج الروبوت التداول المتاحة في كل تجارة سيتم تنفيذها تلقائيا على الانترنت عوائد عالية ومن المفهوم أن هدفك، وجود الروبوت التداول المختصة سوف تسمح لك لتحقيق الاستفادة القصوى من الاستثمارات الخاصة بك برنامج الروبوت التداول لديها نسبة فوز عالية جدا، حوالي 83، وذلك باستخدامه للتداول وزيادة كبيرة الخاص بك س دس من استكمال الصفقات الناجحة على أساس منتظم عندما كنت التجارة باستخدام الروبوت، لا تحتاج إلى أي معرفة سابقة من منصة أو تداول الخيارات الثنائية. أوصت القراءة. خدمات عامة تساعدك على كسب more. When سوف تتداول، يجب أن تأخذ الاستفادة من خدمات الإشارة هذه الخدمات سوف ترسل إشارات التداول عبر رسالة نصية سمز إلى هاتفك أو في رسالة إلكترونية هذه الإشارات تتيح لك معرفة ما إذا كان من المتوقع أن تتحرك أسعار الأصول وفي أي اتجاه على مدى ثلاث ساعات التالية إشارات مفيدة للغاية في التداول و هي أداة أساسية لأي شخص يتطلع إلى تداول الخيارات الثنائية بنجاح سواء كنت متداولا متقدما أو كنت قد بدأت للتو، إشارات الخيارات الثنائية تعطيك الأدوات اللازمة لاتخاذ قرارات مستنيرة قبل الاستثمار. في حين لا يوجد نظام التداول هو مضمون، إشارات لدينا خدمات تظهر أعلى معدلات الفوز مع دقة 70 أو أكثر إشارات مفيدة للغاية في الحالات التي لا يمكن أن يكون نصح من التطورات الجارية س ن السوق والحاجة إلى المعلومات لاتخاذ القرارات بشأن التداول وقد تم استخدام البرنامج المسؤول عن إشارة من قبل المستثمرين منذ ما يقرب من عقد من الزمان، ويحلل مجموعة متنوعة من البيانات من مصادر مختلفة من أجل توفير إشارة إشارة software. Are الخيارات الثنائية احتيال . الجواب هو ببساطة أنها ليست عملية احتيال يجعل التداول سهلة بالنسبة لك تداول الخيارات الثنائية يقدم عوائد ممتازة للمستثمرين، وبعض يصل إلى 91 أو أكثر أقل عوائد في نطاق 65، مما يتيح فرص التداول مع عوائد عالية جدا في أقل من دقيقة واحدة المخاطر الخاصة بك وعوائد معروفة قبل الاستثمار الخاص بك وهذا يجعل من السهل نسبيا للوصول الى السوق دون كمية كبيرة من الاستثمارات المطلوبة تداول الخيارات الثنائية لديه القدرة على السماح لك لتصبح مستقلة ماليا وكسب المال على الانترنت ، في راحة منزلك أو في أي مكان كنت want. What يمكن أن تجد from. Binary خيارات التداول هو الوافد الجديد نسبيا بقدر ما خيارات التداول في السوق هي كونس إرنيد تم اعتمادها لأول مرة من قبل لجنة الأوراق المالية والبورصات الأمريكية في عام 2008، وهي الآن تتداول علنا على الانترنت في ما أصبح يعرف باسم منصات التداول خيار ثنائي أو السماسرة. جزء من نداء تداولها هو فوز بسيط أو تفقد السيناريو على التجارة والحقيقة سوف تعرف كم كنت خطر وكم كنت تقف على الربح قبل حتى وضع تجارتك يبدو بسيطا، ولكن في الواقع حيث تتحرك الأسواق المعنية، بل هو شيء بسيط ولكن هذا هو السبب هنا للمساعدة. غرضنا. هنا لتزويدك بالمعلومات الأكثر فائدة وهامة فيما يتعلق بالخيارات الثنائية وتداول العملات الأجنبية سوف تجد على الانترنت اليوم ونحن نسعى للقيام بذلك من خلال توفير لكم مع معلومات مفيدة جدا من شأنها أن تحسن بشكل كبير المعرفة التداول الخاص بك هنا سوف تجد معلومات حول أنواع مختلفة من استراتيجيات التداول أدلة شاملة جديدة المواد الخيارات الثنائية والأخبار من market. How سوف نفعل ذلك. تأسست من قبل الناس مع خبرة واسعة والمعرفة في مجال التمويل الدولي المؤلف الرئيسي لدينا في 7 الخيارات الثنائية هو جون ميلر. بفضل الاستفادة المثلى من مؤسسينا المعرفة والمهارات مجموعات، ونحن نهدف إلى تطوير والحفاظ باستمرار كما أفضل المعلومات الثنائية الخيارات و موقع تداول العملات الأجنبية على الانترنت. ما نحن تغطية. دعونا نلقي نظرة على جميع مجالات التداول التي نغطيها وكيف أن هذه سوف تساعدك على صياغة الاستراتيجية الخاصة بك وتساعدك على جعل لكم تحقيق أرباح متسقة على التداول الخاص بك. الذهب إلى أدوات التداول. نحن سوف يعلمك عن الأدوات الأساسية للتداول الناجح وتعطيك أحدث المعلومات وتحديثها حول كيفية استخدامها بنجاح. وعادة ما تصنف الخيارات الثنائية كخيارات التجارة المعقدة نوعا ما، ولكنها في الواقع أنها بسيطة للغاية للاستفادة وفهم فإن الطريقة التي يعملون بها تعطيك نظرة متعمقة في أدوات التداول المتوفرة حاليا ويعلمك كيفية استخدام وتطبيقها لجعل ترادين ناجحة ز القرارات. الخيارات الثنائية استراتيجيات لكسب المال Online. Don أن ينخدع ما تسمعه، تداول الخيارات الثنائية يتطلب خبرة قليلة جدا هناك سوء فهم مشترك أن تكون ناجحة في تداول الخيار يجب أن يكون الشخص الكثير من المعرفة من الأسواق وتداول الخيارات الثنائية على وجه الخصوص، وهذا هو بالكاد الحال مع أن يقال، كنت لا تزال بحاجة إلى معرفة الاستراتيجيات التي من شأنها أن تساعدك على تحقيق الربح باستمرار على الصفقات الخاصة بك. هو مصدر المعلومات الخاصة بك للحصول على معلومات وتفسيرات لجميع استراتيجيات التداول هذه سوف تساعدك على تعلم التنبؤ بالمتطلبات الأكثر أهمية من التداول، أي اتجاه سعر الأصول سوف الاتجاه إذا كنت يمكن أن تتعلم لجعل الصفقات التي تتنبأ بشكل صحيح أي اتجاه سعر الأصول وسوف تتخذ باستمرار، ثم سوف تجعل باستمرار الربح على الصفقات الخاصة بك. تجارة ناجحة في كثير من الأحيان نجاحا كبيرا فقط عن طريق الاستفادة من أساليب بسيطة والاستراتيجيات. بروكر الاستعراضات. يمكنك بالكاد أن يكون تاجر ناجح إذا كنت لا تعرف أين تذهب إلى وضع الصفقات الخاصة بك لا بد من أن تكون قادرا على استخدام أكثر من موقع واحد وسيط وتعلم كيفية استخدام الأدوات المختلفة التي كل واحد لديه لمساعدتك على جعل الصفقات الناجحة. مع أكثر من 400 منصات التداول على الانترنت، سيكون من المستحيل تقريبا مهمة بالنسبة لك لزيارة ومراجعة كل واحد لا تقلق هنا لأننا قد فعلت الكثير من العمل بالنسبة لك نحن ميزة تحديث التعليقات والمعلومات عن العديد من كبار وسطاء تداول الخيارات الثنائية ث في يمكن العثور على الانترنت اليوم. Signal Services. Strategies كبيرة، لكنها ليست كثيرا استخدام إذا كنت لا تعرف كيفية البحث عن إشارات رئيسية على مختلف الرسوم البيانية التحليل الفني وهذا هو حيث وجود خدمة إشارة جيدة يمكن أن يثبت أن يكون جدا مفيدة إشارات التداول لديها القدرة على تحويل المتداول العادي إلى واحد كبير. لديها قائمة شاملة من الاستعراضات لبعض من أفضل وأكثر ثقة مقدمي الإشارات سوف تجد المتاحة على الانترنت من خلال الاشتراك مع واحد منهم، سوف توفر قدرا كبيرا من الوقت على البحث وتحليل بيانات السوق وهذا سوف يسمح لك التركيز فقط على جعل الصفقات الذكية التي تقودك إلى جعل باستمرار الربح. خيار ثنائي روبوت التعليقات. وسوف توفر لك أيضا مع تحليل متعمق واستعراضات من برنامج ثنائي الخيارات روبوت بصراحة تماما، كنا أعجب من سهولة استخدامها والعروض الفريدة بشكل استثنائي. واحد من أهدافنا الرئيسية هو تثقيف وإعلامك قدر الإمكان على كل وجوانب مختلفة من تداول الخيارات الثنائية هناك قول مأثور أن المعرفة هي السلطة وينطبق على التداول فضلا عن المعرفة التجارية هو أفضل استخدام بطريقة منظمة ومستهدفة على وجه التحديد، ونحن هنا لمساعدتك في ذلك. الذهب لجعل المال مع الفوركس Trading. To تكون ناجحة في تداول الخيارات الثنائية تحتاج إلى أن تكون مألوفة جدا مع جوانب تداول العملات الأجنبية وكذلك لقد راجعنا أفضل وسطاء الفوركس على الانترنت لجعل من السهل اختيار أفضل وسيط لاحتياجات التداول المحددة الخاصة بك. جعلنا جزء ثابت من التداول الخاص بك. كما تعلمون عن ذلك وتصبح ناجحة في ذلك، يمكن أن تصبح التجارة وسيلة جديدة ومثيرة لوضع الصفقات في السوق مع دخل الاستثمار الثابت الخاص بك نأمل أن تساعد تثقيف لكم حول هذا الموضوع إلى النقطة التي كنت باستمرار تقليل المخاطر الخاصة بك وتعظيم الربح الخاص بك نحن باستمرار تحديث وتحسين موقعنا لأننا نريد أن تكون معروفة كأفضل المعلومات الثنائية خيارات الموقع هناك على الانترنت اليوم حتى أعود هنا في كثير من الأحيان، مع مساعدة من نحن سوف يرشدك في طريقك لتصبح الأكثر اطلاعا والتاجر الناجح يحتمل أن يكون من الممكن أن يكون. بدء كسب المال now. One من أفضل الأشياء عن التداول هو أنه يمكنك جعل الاستثمارات الصغيرة منخفضة المخاطر يمكنك البدء في التداول في منصات التداول لدينا الموصى بها مثل بوس كابيتال أو بانك دي بيناري في ما يصل الى 100، والتي قد مضاعفة في معاملة واحدة حدد وسيط التداول المفضل لديك من أعلى الصفحة، تسجيل، بدء التداول وكسب المال. A تاريخ موجز من تداول الخيارات الثنائية. وقد تم التداول في جميع أنحاء لبعض الوقت في ذلك ق المنشأ، كان تماما وسيلة للاستثمار محفوظة فقط للنخبة وتمارس مع قليل من لا r إغولاتيونس هذا تغير كل شيء عندما أنشأ مجلس شيكاغو للتجارة أول بيئة تجارية منظمة في عام 1971 كما شكلت مجلس شيكاغو لتبادل الخيارات كبوي أصبح تنظيم رئيس الوزراء من ذلك النوع وحتى هذا التاريخ هو أكبر طريقة للتداول الخيارات في جميع أنحاء العالم. على مدار الوقت، تحسنت اللوائح بشكل كبير مما أدى إلى زيادة المعلمة من المعاملات المعاملات تم إنشاء شركة مقاصة الخيارات أوك كشبكة أمان للإشراف وضمان أن المستثمرين شراء وبيع أصولهم وفقا للوائح وكان أوك سلطة إنفاذ الحظر في الحالات من الإهمال الواجب سوف تتطور الخيارات الثنائية في نهاية المطاف من هذه الإجراءات القياسية بهدف إنشاء بروتوكول استثماري أكثر جدوى مع الحد الأدنى من المضاعفات. على الرغم من أن الخيارات الثنائية السابقة لأوانها كانت لا تزال تجري دون وصفة طبية، فإن السوق الجديد كان مقصورا على النخبة وكان وقلة التصفية وعدم وجود أنظمة صارمة في عام 2007، غيرت أوك المبادئ التوجيهية للسماح الخيارات الثنائية لتكون المقايضة في البورصات الرئيسية وقد تمت الموافقة على هذا في عام 2008 من قبل لجنة الأوراق المالية والبورصات الولايات المتحدة الأمريكية من أجل إضفاء الشرعية على تصنيف الخيارات الثنائية كعقود قابلة للتداول في الأسواق المالية الأجنبية في مايو من نفس العام، أصبحت بورصة البورصة أول تبادل للقارات لعرض الخيارات الثنائية علنا في يونيو. اتبعت كبوي قادتها. مع إدخال التكنولوجيا الفائقة والأدوات المتطورة للغاية والأدوات، كان هناك انفجار في تداول الخيارات الثنائية تسليم الإنترنت الجديد من الخيارات الثنائية يوفر مرونة أكبر وكذلك زيادة تعديل الأصول الأساسية أنواع العقود أسعار الإضراب وأوقات الوفاء هذه الميزات تمكن استراتيجيات أكثر عدوانية لتشمل التي تقترح أقصى قدر من الأرباح في الحد الأدنى من المخاطر وهذا يسمح للسماسرة الخيارات الثنائية الجديدة لدخول الساحة وبالتالي تعزيز تحسنت بشكل كبير ومنصات متقدمة ثم إناب في عام 2010، تغييرات حاسمة على الصعاب والمخاطر والمكافآت الثابتة المرتبطة الآن بالخيارات الثنائية من شأنها أن تزيد من تعزيز سمعتهم ومنذ ذلك الحين، بدأ الوسطاء المهمين تنفيذ سياسات لضمان أن هذه العلامة التجارية من التجارة تصبح أكثر سهولة في الاستخدام بحيث يمكن للمستثمرين أن تكون قادرة على التجارة الخيارات من حدود منازلهم وكذلك عند الخروج وحول في جوهرها، عبقرية محض وجمال الشبكة العالمية جعلت من السهل على الأفراد للتداول الخيارات الثنائية في أي وقت و من أي مكان. في اليوم الحاضر، والخيارات الثنائية تنمو بسرعة في شعبية داخل صناعة الاستثمار المتغيرة باستمرار ويرجع ذلك إلى العديد من المزايا من الخيارات الثنائية بالمقارنة مع غيرها من الخيارات الاستثمارية التقليدية أكثر الخيارات الثنائية تقدم صرف مسبق و بالإضافة إلى تقديم المستثمرين مع سهولة خلق مواقف تجارية واسعة في الأصول البدائية باستخدام ديب النقدية محدودة أوسيت لا يمكن أن تكون تفضيلات التداول أي بساطة حيث يتعين على المستخدمين فقط أن يقرروا في أي مسار للمناورة في حقوقهم الأساسية أي أعلى أو لأسفل. ببساطة من خلال تداول الخيارات الثنائية، قد تحسن التجار بشكل كبير من إمكانية جعل كلا من الصفقات لا تقدر بثمن ويمكن الاعتماد عليها يمكن أن تكون ثابتة وزيادة أرباحهم في الوقت نفسه تقليل مخاطر التعرض في الوقت نفسه كما أنها تستثمر وقتها في دراسة وإتقان مجموعة لا حدود لها من سيناريوهات تداول الخيارات الثنائية التي تتوفر الآن في متناول أيديهم مع العديد من الخيارات، يمكنك بالتأكيد نقدر التطور المفاجئ للخيارات الثنائية من الغموض الكامل لارتفاع مفاجئ في الشهرة. الخيارات الثنائية لوائح التداول. حتى مع الزيادة الأخيرة في الخيارات الثنائية، العديد من المستثمرين لا تزال مترددة في الاستثمار في هذا السوق بسبب المخاوف المتزايدة بشأن الأنظمة والأمن المحيطة تداول الخيارات الثنائية هذا الشعور المتزايد والحذر هو جزئيا بسبب عدم وجود ثقة أن المستثمرين في ما المالية ركيت في ضوء الأزمات المالية الأخيرة والفضائح التي اندلعت على مدى العقد الماضي في الولايات المتحدة المعروفة باسم السوق الأكثر تنظيما في جميع أنحاء العالم، يمكن للمستثمرين الآن يمكن أن يتهم أن تكون حذرا جدا بغض النظر عن العديد من المفاهيم الخاطئة الحالية حول الخيارات الثنائية إلى حد كبير بسبب عدم فهم بالضبط كيف يعمل سوق الخيارات الثنائية. الإطار التنظيمي المحيطة بالخيارات الثنائية. اليوم، وجمهورية قبرص هي واحدة من المواقع الأكثر شعبية للسماسرة الخيارات الثنائية للأسف، العديد من المستثمرين يميلون إلى التفكير أنه منذ قبرص هي واحدة من الاقتصادات غير المطورة في أوروبا يرون أن البلاد غير متطورة مع القليل من عدم وجود لوائح مالية في مكانها في التفكير مشوهة، فإنها تشعر بأن الخيارات الثنائية وسطاء اختاروا هذا الموقع كقاعدة لعملياتهم من أجل تجنب اللوائح الصارمة، عندما تكون في الواقع والسبب هو أن الضرائب هي أقل بكثير في قبرص في المملكة المتحدة يتم فرض ضريبة على أرباح الشركات في 24 وهذا المعدل عشية ن أعلى في الولايات المتحدة حيث الشركات يمكن أن تخضع للضريبة تصل إلى 35 ومع ذلك، والضرائب هي 10 فقط في قبرص في ضوء هذا، فإنه يجعل من المعقول تماما أن العديد من السماسرة يختارون تأسيس أعمالهم في قبرص كثير منكم ربما لاحظت أن معظم ثنائي خيارات سماسرة يرفضون قبول العملاء من السوق الأمريكية لأنها لا ترغب في أن تخضع للضريبة من قبل السلطات الأمريكية. وهناك العديد التي من شأنها أن تدعي أن المعايير التنظيمية المالية في بلدان مثل ألمانيا والمملكة المتحدة هي أعلى من تلك من قبرص هذا ينبع من حقيقة أنه ليس لديهم فهم واضح لكيفية عمل سوق منطقة اليورو حتى أصدر الاتحاد الأوروبي الاتحاد الأوروبي البرلمان الأسواق في الأدوات المالية التوجيه ميفيد من أجل تنسيق الإطار التنظيمي للسوق المالية داخل منطقة اليورو تم تصميم ميفيد ل وزيادة حماية المستهلك وكذلك لدمج مختلف الأسواق المالية في سوق واحدة وينبغي أن يلاحظ على النحو الواجب أن قبرص في الامتثال الكامل لل ميف إد بموجب قانون خدمات الاستثمار والأنشطة وقانون الأسواق المنظمة 144 I لعام 2007. الأمن القانوني للحماية. وبالتالي فإن قبرص تحتفظ فعلا بمعايير أعلى في الواجبات الائتمانية من حيث الحماية القانونية من الشركات الاستثمارية المارقة من المملكة المتحدة التي لا تزال غير ممتثلة تماما من ميفيد نحن بحاجة إلى النظر في أن الخيارات الثنائية هي الابتكار المالي الأخير حتى لا يكون هناك القليل من عدم وجود الإطار القانوني الذي المنظمين يمكن أن تعمل هناك هناك القليل من التشريعات في الوجود لتغطية الخيارات التجارية الثنائية ويرجع ذلك إلى حقيقة أن أوتك وكانت الأسواق تاريخيا التنظيم الذاتي. فقط في الآونة الأخيرة لديها إطار لتنظيم الخيارات الثنائية التي شيدت في الواقع، قبرص هي واحدة من أول أعضاء منطقة اليورو في الواقع لديها معيار قانوني للخيارات الثنائية مع هذا التعريف القانوني، والتنظيمية سلطات مثل لجنة قبرص للأوراق المالية والبورصات سيسيك الآن سلطة التصرف بموجب الإطار التنظيمي المالي ر المستثمرين في معرفة أن الخيارات الثنائية هي في الواقع، لا تصنف على أنها الخيارات المالية بموجب قانون الخدمات المالية في المملكة المتحدة ولكن بدلا من ذلك يتم تنظيمها تحت لجنة الألعاب في المملكة المتحدة حيث تصنف الخيارات الثنائية الصفقات في الواقع الرهانات في المملكة المتحدة ديون القمار معروفة كديون الشرف وغير قابلة للإنفاذ في نظام المحاكم يمكنك أن تتخيل كيف سيكون صعبا مقاضاة وسيط الخيارات الثنائية في المملكة المتحدة لدين الشرف عندما يكون لديك أي أساس قانوني على الوقوف على أساس هذه الفرضية، وقبرص هو أفضل مكان لخيارات التداول الثنائية من حيث الحماية القانونية. بيجينرز دليل على أساسيات تداول الخيارات الثنائية. نحن سعداء لتقديم لكم هذا الدليل على أساسيات التداول في الخيارات الثنائية للمبتدئين في هذه الصناعة طوال هذه الصفحة، نحن ذاهبون إلى أن يأخذك من خلال العديد من الحقائق حول سوق الخيارات الثنائية التي تحتاج إلى تعلم قبل الاستثمار في السوق المالية لغرض المرجعية، قد تحتاج إلى المرجعية هذه الصفحة لأنها سوف تثبت أن تكون مفيدة في جميع أنحاء حياتك التجارية تداول الخيارات الثنائية وهنا لائحة من ما نحن ذاهبون لتغطية في جميع أنحاء الصفحة. فهم الخيارات الثنائية. أنواع مختلفة من الخيارات الثنائية trades. The استراتيجيات التداول الخيارات الثنائية الأساسية. الأدوات التي سوف تحتاج أثناء تداول الخيارات الثنائية. بعض الأشياء التي تحتاج إلى أن تضع في الاعتبار أثناء تداول الخيارات الثنائية. أمثلة من الصفقات في السوق المالية. كيفية الحصول على Start. Undstanding الخيارات الثنائية. ما هي بالضبط الخيارات الثنائية هذا هو وهو السؤال الذي لا يزال قائما في عقول العديد من المبتدئين في سوق الخيارات الثنائية حسنا، هذا هو شكل من أشكال الاستثمار في السوق المالية حيث التاجر يضع التجارة عقدا له مكافأة ثابتة فضلا عن خطر ثابت هذه الصفقات ويشار إلى الخيارات الثنائية لأنها تنطوي على واحد أو الخيار الآخر وبالمثل، هذه الصفقات ينطوي على الحصول على واحد أو الآخر دفع تعويض الخيار بمجرد انتهاء العقد بعض من خيارات التداول في هذه الصناعة تشمل خيارات أعلى أو لأسفل ولمس أو لا توجد خيارات اللمس في لغة الكمبيوتر، يشير مصطلح ثنائي إما 1 أو 0.The من الخيارات الثنائية هو بسيط جدا ما عليك القيام به كما تاجر يشير ما إذا كان أصل معين، والذي يشمل أسهم السلع وأزواج العملات سوف نقدر أو إهمال في القيمة خلال فترة معينة، وهي فترة انتهاء صلاحية العقد الخاص بك بالمعنى الفعلي للتجارة، كنت تراهن بالفعل على ما إذا كان سعر الأصول المختارة سوف تذهب صعودا أو هبوطا في غضون فترة معينة في حين فتح عقد موقف على منصة التداول الخيارات الثنائية المفضلة لديك، وسوف يتم عرض العائد المتوقع على الموقف الذي ترغب في فتحه مسبقا هذه هي نسبة من الأرباح التي يمكن أن تجعل إذا الخاص بك التنبؤ هو الحق في انتهاء العقد بالنسبة لمعظم وسطاء الخيارات الثنائية، ويتراوح مبلغ دفع تعويضات بين 70 و 85 في المئة من الأموال المستثمرة في الموقف وبالمثل، إذا كان لديك والتنبؤ على الموقف المفتوح هو الخطأ في وقت انتهاء العقد سوف تكون قد فقدت الرهان، وبالتالي يترتب على المال الذي رهن على التجارة. فرض كنت ترغب في حصة 100 على الأصول التي السعر الحالي هو 1612 75 والعائد المتوقع هو وأشار إلى 80 في المئة تحتاج إلى حصة 100 على هذا الموقف وتعيين فترة انتهاء الصلاحية المفضلة لديك لقول ساعة واحدة إذا في نهاية ساعة واحدة فترة انتهاء صلاحية العقد الخاص بك سعر الأصول ترتفع وكنت قد توقعت أنه سوف ترتفع، وكنت قد فازت في الموقف في هذه الحالة، سوف تحصل على المبلغ الذي رصعت على الموقف، 100، و 80 في المئة إضافية من المبلغ المستعبدة في المجموع، سوف تحصل على 180 من هذه التجارة ومع ذلك، يحتاج التجار أن نلاحظ أن الحجم الذي سوف يتحرك من خلاله سعر حركة السلع إلى مبلغ الدفع إذا كنت قد توقعت أن سعر الأصل سوف يرتفع ويسقط بدلا من الصعود، بحلول الوقت الذي ينتهي فيه العقد سوف تكون قد فقدت التجارة والتعاون بالتناوب المال كنت ستكد على الموقف. كيفية بدء التداول مع إق الخيار. المكونات الرئيسية لهذه التجارة. جميع العقود الصفقات التي سوف تكون وضعت في سوق الخيارات الثنائية سيكون دائما ثلاثة مكونات رئيسية، وهي سعر الإضراب في هذه الحالة هو سعر السلعة التي اخترتها للتداول في وقت فتح التجارة في المثال المذكور أعلاه، وسعر الإضراب من التجارة هو 1612 75 هذا هو سعر الأصول التي يتم التداول في في الوقت الذي تفتح التجارة ومن قيمة السعر الذي سيحدد ما إذا كنت قد فاز أو فقدت الموقف. الوقت انتهاء الصلاحية هي الفترة التي من المتوقع عقدك الانتهاء من انها الفترة بين الوقت الذي وضع التجارة والوقت تنتهي صلاحيتها بالنسبة لمعظم الوسطاء في هذه الصناعة يسمح للمتداول باختيار فترة انتهاء الصلاحية المفضلة لديه أثناء فتح الصفقة يمكن أن تكون فترة انتهاء الصلاحية قصيرة بقدر 60 ثانية أو ما دام أيام أو حتى أشهر. نسبة العوائد هي بريديت المبلغ المدفوع الذي يعرضه الوسيط مقابل الدفع إذا ربحت الصفقة في المثال المذكور أعلاه، كان المبلغ المدفوع 80 في المئة في هذه الحالة، سوف تحصل على 80 في المئة من المبلغ المرهون بالإضافة إلى المبلغ المستقر، إذا ربحت التجارة ومع ذلك، سوف تفقد مبلغ مخزون إذا فقدت الموقف في هذا المثال هناك وسطاء في هذه الصناعة التي تعود نسبة معينة من المال رصيدا، إذا التاجر يفقد التجارة هذا المبلغ يمكن أن تصل إلى 10 في المئة من the invested money but is dependent on the trade and the binary options trading platform that you are using. The Various Types of Binary Options Trades. Currently, there are various types of binary options that traders may trade on their preferred binary options trading platforms The simplest of all the binary options trades is the Up down option To learn more on the various binary options trading options, click here. The Basic Binary Options Trading Strategies. We have come up with a comprehensive list of the trading strategies that you will need to succeed in this industry as a beginner. The Tools You Will Need While Trading Binary Options. Over the years, various tools and features have been invented to make binary options trading more enjoyable and profitable for the traders We have compiled some information on some of the most beneficial binary options trading tools on this page. Some of the Things That You Need To Bear in Mind While Trading Binary Options. If you have been reading this page, you must have learned the basics of trading binary options Before venturing into binary options trading there are various things that you have to bear in mind, some of which include. There brokers with a minimum investment amount of as low as 10.Trader s risk is limited to the amount he or she has staked in a trade. You only lose the amount you had staked in a position, if you lose. You do not own the asset you have used to open a trade instead you simply bet on the price movements of the price. Tr ading binary options is comparatively risky Therefore, invest what you can afford to lose. There are numerous trading options in the industry, the commonest and easiest of them being the Up Down trading option. To continually make money while trading in binary options, you need to win most of the traders you place in the market. Basically, trading in binary options is designed to be easy to carry out, even for the beginners in the market. In all cases, the payout you will get after winning a certain trade is stated beforehand Since the risk you incur while trading binary options is limited to the amount of money you put at stake, you should only risk what you can afford to lose in any position. The Up Down Trading Option. The Up Down is among the easiest trading options in the binary options industry Just like the name suggests, this options entails clicking on either the UP call or the Down put button, in accordance with the direction that you believe the price will take Let us look at an e xample where Gold is the asset you would like to open a trade on Most binary options brokers will feature a graph on each asset listed on their platform In the case of Gold, the graph provided will have a line to indicate the movement of gold prices over time From the provided graph, you can see how the price of Gold has been changing over time As such, you can decide on the probable direction that the price will move in the near future It is on this basis that you make your prediction on whether the price of Gold will rise or fall in the near future. If you believe that Gold will appreciate in value in the near future, you should click on the Call button to open a trade You should then indicate the amount you would like to stake in the trade and your preferred expiry period from the dropdown menu provided by the broker and then place the trade If you believe that the price will drop in the near future, you should click on the Put and indicate the amount you would like to stake as well as your preferred expiry period before placing the trade. This is known as binary options simply because the possible results are only two, the UP and the Down options If you had made the right prediction, you will win the trade after the position has expired However, if your prediction is wrong, you will end up losing the trade Since the choices are only two, there are only to results, you either win or lose the trade This type of binary options trading options is very easy for the beginners in this market to implemen t As such, it is one of the easiest trading options that new traders should consider trying out Since the payout on any position is indicated on the platform, even before the trade has opened a position, it should be very easy for beginners in the industry to invest in the financial markets using this trading option. With the Up Down binary options trading, everything is designed to be very easy As such, this is the same procedure that you need to apply, regardless of the underlying asset you would like to open a position on or the binary options trading platform you are using to invest in the financial market Additionally, you also have the freedom and flexibility to choose whichever asset you would like to make a prediction on, depending on the variety or assets offered by you preferred binary options broker. For many brokers in this industry traders have an array of expiry period options to choose from Some binary options trading platforms are offering 5 seconds, 12 seconds expiry periods and an array of other short-term expiry periods Additionally this option also allows traders to incest in long-term options such as the trades with expiry periods of days or even weeks It is at the expiry time that the broker determines whether you have won or lost the trade This is done by comparing the price of the chosen asset at the time of expiry of the contract to the strike price of the asset If you had chosen Call and the price of the asset is higher than the strike price, at the end of the contract period you win the trade. Examples of Trades in the Financial Market. Example 1 Using the Up Down option to trade Google Stock. Assuming that Google was performing fairly well and you expect that the Google stock will be trading above 672 10 by 4 00pm Est time You should then open a position based on this conviction To make this forecast, you can make use of the market reviews and trade signals provided by your broker Alternatively, you may also analyse the market on your own and read the charts on the binary options trading platform you are using Based on such information, you stake 1000 on the Google stock asset and set the expiry time to correspond to sometime after 4 00pm Est For the purpose of this example, we are going to assume that you broker is offering a payout of 70 percent on this asset if you win and a rebate of 10 percent, if you lose. If after the contract period has expired the Google stock asset has appreciated to a value that is g reater than 672 1 00 as you had predicted, you will earn 1700 This includes the 1000 you had staked in the trade and the 70 percent payout, which translates to 700 However, if the price of Google stock goes against your prediction, you will get a 10 percent rebate from the broker As such, you will get 100, which is 10 percent of the staked amount In this case, you will lose 900.In this case, the 672 10 price of the Google stock asset is referred to as the strike price Now that you had predicted that the price will rise, this is a call trade The 700 that you earned above the invested amount is the payoff hence your profit for this trade In some cases, some binary options brokers will offer a rebate amount This is the amount that the broker will reimburse to you if you lose the trade In this example, the rebate is set at 10 percent hence is 100 However, you need to understand that not all binary options brokers offer a rebate for their traders. As opposed to this example, you may also dec ide to bet in the opposite direction if you believe that the price of the Google stock will drop in the near future In this case, you will have to place a Put trade but the payout will remain to be the same if your prediction is right Similarly, the loss will also be the same if your prediction is wrong. Example 2 Using Touch Trade Options to Trade Gold prices. With binary options, it is possible for traders to take advantage of gold price movements to make a profit In this example, we will use the touch trading options to predict price movements of the gold asset In this regard, the price of Gold has to hit the touch price for you, the trader, to win the trade With the conviction that the price of Gold will hit the 1617 40 mark by 4 00 pm, a trader invests 100 in this trade using the touch trading option For the purpose of this example, we are going to assume that the payout offered by the broker is 70 percent if the trader wins the trade and a rebate of 15 percent if the trader loses t he trade. If by the expiry period the price has touched the touch price indicated by the trader, the trader will have won the trade In this case, he or she will get 170, which includes the 100 staked in the positions and the payout amount, which is 70 If the price of Gold does not hit the touch price, the trader will have lost the trade As such, he or she will only get the rebate amount, which is 15 in this case As a result, the trader will lose 85.With the touch trading options the trader is required to indicate the touch price as well as his or her preferred expiry period before placing the trade Suppose the trader selects 1617 40 as the touch price and 4 00pm as the expiry period After placing the trade, bad news regarding the value of the dollar breaks out This will drive inflation fears and force oil and gold prices to rise As such, the price of gold will hit the touch price Although not all brokers in the industry offer the touch trading option, they are the second most popular bi nary options trading option. A General Binary Options Trading Example. Trading in the majority of assets, such as oil and gold provided by your preferred broker should be easy and fast The following general trading procedure should be applied. To begin with, you need to select an underlying asset to trade in, such as a currency pair gold or oil. You then need to select your preferred expiry period from the options provided by your broker this could be 60 seconds, 1 hour, a day or a week. Indicate the amount of money you would like to invest in the position for instance, you may choose to stake 10.Predict the direction you think the price will move towards up or down This is done by selecting the up or the down option. Prior to submitting your request, you should check the payouts for the position if you win or lose the trade. Now click on the apply button to place the trade. While trading binary options, it is not possible to lose more money than you have staked in the open position s Again, i t is not possible to make more profit than the indicated payout percentage on any trade you have placed For most brokers, the payouts offered to traders after winning a position ranges between 70 and 85 percent Although some brokers do not offer rebates, there are those brokers that offer rebates of up to 15 percent of the staked amount. What You Have to Remember While Investing In Binary Options. Here are a couple of things that beginners need to know about the binary options trading industry. As opposed to Forex trading traders in binary options are not restricted by leveraging. The profit or lose you will make from any trade is known before hand and you cannot lose more than what you have invested in a trade. The magnitude by which the price has moved will not affect the much profit or loss you make while trading binary options. The amount of payout on any trade is clearly indicated. The majority of brokers we have listed will offer traders an early closure option This feature allows trade rs on their platforms to close the trade at any time, before the expiry time, when they find the price appealing This allows traders to make an early exist from any trade and to minimise losses. All the brokers we have listed offer a payout of between 70 and 85 percent on various assets. Trading binary options is comparatively easy, regardless of your experience in the industry of the broker you are using. Trading binary options is not associated with any hidden costs and fees. With this form of trade, you need not to be an expert to make a profit. The trade entails one or the other option, hence is referred to as binary. Opening a trade on an asset does not mean that you buy it you are just betting on the price movements of the said asset. How to Get Started. Since this page is the basic overview of investing in financial market through binary options and making money online, you should navigate to the page that focuses on how to invest in binary options For more information on how to start t rading in binary options, the following tutorial can be of great help. Binary Options Trading for Beginners. Basically, you do not have to be an expert in trading binary options for you to profit from the trade and make money In this regard, it is possible for the professional traders, as well as the beginners in the industry to profit from the trade However, it is essential that traders in this industry come up with a winning strategy in order to continually profit from trading binary options To achieve this, you may need to study the various tips and methodologies offered by the experts in the industry Additionally, you may also use the risk-free, demo accounts offered by some of the reputable and legitimate online brokers to fine tune your skills in trading binary options. To succeed in making money by trading binary options, you will also need to master how to analyse the market and read graphs and charts offered by your broker With these in mind, trading binary options should be easy enough for beginners to continually make a profit. IQ Option Trading Window Adjustment. A List of Our Broker Reviews. Binary Options Trading Systems. References and Further Reading. About Us Disclaimer. Disclaimer 7 Binary Options will not be held liable for any loss or damage resulting from reliance on the information contained within this website The data contained in this website is not necessarily real-time nor accurate, and analyses are the opinions of the author is only a website offering information - not a regulated broker or investment adviser, and none of the information is intended to guarantee future results. Binary option trading on margin involves high risk, and is not suitable for all investors As a leveraged product losses are able to exceed initial deposits and capital is at risk Before deciding to trade binary options or any other financial instrument you should carefully consider your investment objectives, level of experience, and risk appetite. In accordance with FTC guid elines, has financial relationships with some of the products and services mentioned on this website, and may be compensated if consumers choose to click these links in our content and ultimately sign up for them. By using this website you agree with the limitations and exclusions of liability set out in this disclaimer and the separate disclaimer page If you do not agree with them, you must not use this website. CGI - Handle Common Gateway Interface requests and responses. is a stable, complete and mature solution for processing and preparing requests and responses Major features including processing form submissions, file uploads, reading and writing cookies, query string generation and manipulation, and processing and preparing headers Some HTML generation utilities are included as well. performs very well in a vanilla environment and also comes with built-in support for modperl and modperl2 as well as FastCGI. It has the benefit of having developed and refined over 10 years with input from dozens of contributors and being deployed on thousands of websites has been included in the Perl distribution since Perl 5 4, and has become a de-facto standard. PROGRAMMING STYLE. There are two styles of programming with an object-oriented style and a function-oriented style In the object-oriented style you create one or more CGI objects and then use object methods to create the various elements of the page Each CGI object starts out with the list of named parameters that were passed to your CGI script by the server You can modify the objects, save them to a file or database and recreate them Because each object corresponds to the state of the CGI script, and because each object s parameter list is independent of the others, this allows you to save the state of the script and restore it later. For example, using the object oriented style, here is how you create a simple Hello World HTML page. In the function-oriented style, there is one default CGI object that you rarely deal with directly Instead you just call functions to retrieve CGI parameters, create HTML tags, manage cookies, and so on This provides you with a cleaner programming interface, but limits you to using one CGI object at a time The following example prints the same page, but uses the function-oriented interface The main differences are that we now need to import a set of functions into our name space usually the standard functions , and we don t need to create the CGI object. The examples in this document mainly use the object-oriented style See HOW TO IMPORT FUNCTIONS for important information on function-oriented programming in. CALLING ROUTINES. Most routines accept several arguments, sometimes as many as 20 optional ones To simplify this interface, all routines use a named argument calling style tha t looks like this. Each argument name is preceded by a dash Neither case nor order matters in the argument list - type, - Type, and - TYPE are all acceptable In fact, only the first argument needs to begin with a dash If a dash is present in the first argument, assumes dashes for the subsequent ones. Several routines are commonly called with just one argument In the case of these routines you can provide the single argument without an argument name header happens to be one of these routines In this case, the single argument is the document type. Other such routines are documented below. Sometimes named arguments expect a scalar, sometimes a reference to an array, and sometimes a reference to a hash Often, you can pass any type of argument and the routine will do whatever is most appropriate For example, the param routine is used to set a CGI parameter to a single or a multi-valued value The two cases are shown below. A large number of routines in actually aren t specifically defined in the mod ule, but are generated automatically as needed These are the HTML shortcuts, routines that generate HTML tags for use in dynamically-generated pages HTML tags have both attributes the attribute value pairs within the tag itself and contents the part between the opening and closing pairs To distinguish between attributes and contents, uses the convention of passing HTML attributes as a hash reference as the first argument, and the contents, if any, as any subsequent arguments It works out like this. HTML tags are described in more detail later. Many newcomers to are puzzled by the difference between the calling conventions for the HTML shortcuts, which require curly braces around the HTML tag attributes, and the calling conventions for other routines, which manage to generate attributes without the curly brackets Don t be confused As a convenience the curly braces are optional in all but the HTML shortcuts If you like, you can use curly braces when calling any routine that takes named arg uments For example. If you use the - w switch, you will be warned that some argument names conflict with built-in Perl functions The most frequent of these is the - values argument, used to create multi-valued menus, radio button clusters and the like To get around this warning, you have several choices. Use another name for the argument, if one is available For example, - value is an alias for - values. Change the capitalization, e g - Values. Put quotes around the argument name, e g - values. Many routines will do something useful with a named argument that it doesn t recognize For example, you can produce non-standard header fields by providing them as named arguments. This will produce the following nonstandard header. Notice the way that underscores are translated automatically into hyphens HTML-generating routines perform a different type of translation. This feature allows you to keep up with the rapidly changing and HTML standards. CREATING A NEW QUERY OBJECT OBJECT-ORIENTED STYLE. This will p arse the input from POST, GET and DELETE methods and store it into a perl5 object called query. Any filehandles from file uploads will have their position reset to the beginning of the file. CREATING A NEW QUERY OBJECT FROM AN INPUT FILE. If you provide a file handle to the new method, it will read parameters from the file or STDIN, or whatever The file can be in any of the forms describing below under debugging i e a series of newline delimited TAG VALUE pairs will work Conveniently, this type of file is created by the save method see below Multiple records can be saved and restored. Perl purists will be pleased to know that this syntax accepts references to file handles, or even references to filehandle globs, which is the official way to pass a filehandle. You can also initialize the CGI object with a FileHandle or IO File object. If you are using the function-oriented interface and want to initialize CGI state from a file handle, the way to do this is with restoreparameters This will re initialize the default CGI object from the indicated file handle. You can also initialize the query object from a hash reference. or from a properly formatted, URL-escaped query string. or from a previously existing CGI object currently this clones the parameter list, but none of the other object-specific fields, such as autoescaping. To create an empty query, initialize it from an empty string or hash. FETCHING A LIST OF KEYWORDS FROM THE QUERY. If the script was invoked as the result of an ISINDEX search, the parsed keywords can be obtained as an array using the keywords method. FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR SCRIPT. If the script was invoked with a parameter list e g name1 value1 name2 value2 name3 value3 , the param method will return the parameter names as a list If the script was invoked as an ISINDEX script and contains a string without ampersands e g value1 value2 value3 there will be a single parameter named keywords containing the - delimited keywords. NOTE As of version 1 5, the array of parameter names returned will be in the same order as they were submitted by the browser Usually this order is the same as the order in which the parameters are defined in the form however, this isn t part of the spec, and so isn t guaranteed. FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER. Pass the param method a single argument to fetch the value of the named parameter If the parameter is multivalued e g from multiple selections in a scrolling list , you can ask to receive an array Otherwise the method will return a single value. If a value is not given in the query string, as in the queries name1 name2 , it will be returned as an empty string. If the parameter does not exist at all, then param will return undef in a scalar context, and the empty list in a list context. SETTING THE VALUE S OF A NAMED PARAMETER. This sets the value for the named parameter foo to an array of values This is one way to change the value of a field AFTER the script has been invoked once before Another way is with the - override parameter accepted by all methods that generate form elements. param also recognizes a named parameter style of calling described in more detail later. APPENDING ADDITIONAL VALUES TO A NAMED PARAMETER. This adds a value or list of values to the named parameter The values are appended to the end of the parameter if it already exists Otherwise the parameter is created Note that this method only recognizes the named argument calling syntax. IMPORTING ALL PARAMETERS INTO A NAMESPACE. This creates a series of variables in the R namespace For example, R foo, R foo For keyword lists, a variable R keywords will appear If no namespace is given, this method will assume Q WARNING don t import anything into main this is a major security risk. NOTE 1 Variable names are transformed as necessary into legal Perl variable names All non-legal characters are transformed into underscores If you need to keep the original names, you should use the param meth od instead to access CGI variables by name. NOTE 2 In older versions, this method was called import As of version 2 20, this name has been removed completely to avoid conflict with the built-in Perl module import operator. DELETING A PARAMETER COMPLETELY. This completely clears a list of parameters It sometimes useful for resetting parameters that you don t want passed down between script invocations. If you are using the function call interface, use Delete instead to avoid conflicts with Perl s built-in delete operator. DELETING ALL PARAMETERS. This clears the CGI object completely It might be useful to ensure that all the defaults are taken when you create a fill-out form. Use Deleteall instead if you are using the function call interface. HANDLING NON-URLENCODED ARGUMENTS. If POSTed data is not of type application x-www-form-urlencoded or multipart form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA To retrieve it, use code like this. Likewise if PUTed data can be retrieved with code like this. If you don t know what the preceding means, don t worry about it It only affects people trying to use CGI for XML processing and other specialized tasks. DIRECT ACCESS TO THE PARAMETER LIST. If you need access to the parameter list in a way that isn t covered by the methods given in the previous sections, you can obtain a direct reference to it by calling the paramfetch method with the name of the parameter This will return an array reference to the named parameter, which you then can manipulate in any way you like. You can also use a named argument style using the - name argument. FETCHING THE PARAMETER LIST AS A HASH. Many people want to fetch the entire parameter list as a hash in which the keys are the names of the CGI parameters, and the values are the parameters values The Vars method does this Called in a scalar context, it returns the parameter list as a tied hash reference Changing a key changes the value of the parameter in the underlying CGI parameter list Called in a list context , it returns the parameter list as an ordinary hash This allows you to read the contents of the parameter list, but not to change it. When using this, the thing you must watch out for are multivalued CGI parameters Because a hash cannot distinguish between scalar and list context, multivalued parameters will be returned as a packed string, separated by the 0 null character You must split this packed string in order to get at the individual values This is the convention introduced long ago by Steve Brenner in his module for Perl version 4.If you wish to use Vars as a function, import the cgi-lib set of function calls also see the section on CGI-LIB compatibility. SAVING THE STATE OF THE SCRIPT TO A FILE. This will write the current state of the form to the provided filehandle You can read it back in by providing a filehandle to the new method Note that the filehandle can be a file, a pipe, or whatever. The format of the saved file is. Both name and value are URL escaped Multi-valued CGI para meters are represented as repeated names A session record is delimited by a single symbol You can write out multiple records and read them back in with several calls to new You can do this across several sessions by opening the file in append mode, allowing you to create primitive guest books, or to keep a history of users queries Here s a short example of creating multiple session records. The file format used for save restore is identical to that used by the Whitehead Genome Center s data exchange format Boulderio , and can be manipulated and even databased using Boulderio utilities See. for further details. If you wish to use this method from the function-oriented non-OO interface, the exported name for this method is saveparameters. RETRIEVING CGI ERRORS. Errors can occur while processing user input, particularly when processing uploaded files When these errors occur, CGI will stop processing and return an empty parameter list You can test for the existence and nature of errors using th e cgierror function The error messages are formatted as status codes You can either incorporate the error text into an HTML page, or use it as the value of the status. When using the function-oriented interface see the next section , errors may only occur the first time you call param Be ready for this. USING THE FUNCTION-ORIENTED INTERFACE. To use the function-oriented interface, you must specify which routines or sets of routines to import into your script s namespace There is a small overhead associated with this importation, but it isn t much. The listed methods will be imported into the current package you can call them directly without creating a CGI object first This example shows how to import the param and header methods, and then use them directly. More frequently, you ll import common sets of functions by referring to the groups by name All function sets are preceded with a character as in html3 for tags defined in the HTML 3 standard. Here is a list of the function sets you can i mport. Import all CGI-handling methods, such as param pathinfo and the like. Import all fill-out form generating methods, such as textfield. Import all methods that generate HTML 2 0 standard elements. Import all methods that generate HTML 3 0 elements such as table , super and sub. Import all methods that generate HTML 4 elements such as abbrev , acronym and thead. Import the blink , fontsize and center tags. Import all HTML-generating shortcuts i e html2 , html3 , html4 and netscape. Import standard features, html2 , html3 , html4 , form and cgi. Import all the available methods For the full list, see the code, where the variable EXPORTTAGS is defined. If you import a function name that is not part of the module will treat it as a new HTML tag and generate the appropriate subroutine You can then use it like any other HTML tag This is to provide for the rapidly-evolving HTML standard For example, say Microsoft comes out with a new tag called gradient which causes the user s desktop to be floode d with a rotating gradient fill until his machine reboots You don t need to wait for a new version of to start using it immediately. Note that in the interests of execution speed does not use the standard Exporter syntax for specifying load symbols This may change in the future. If you import any of the state-maintaining CGI or form-generating methods, a default CGI object will be created and initialized automatically the first time you use any of the methods that require one to be present This includes param textfield submit and the like If you need direct access to the CGI object, you can find it in the global variable CGI Q By importing methods, you can create visually elegant scripts. In addition to the function sets, there are a number of pragmas that you can import Pragmas, which are always preceded by a hyphen, change the way that functions in various ways Pragmas, function sets, and individual functions can all be imported in the same use line For example, the following use statem ent imports the standard set of functions and enables debugging mode pragma - debug. The current list of pragmas is as follows. When you use CGI - any then any method that the query object doesn t recognize will be interpreted as a new HTML tag This allows you to support the next ad hoc HTML extension This lets you go wild with new and unsupported tags. Since using cite any cite causes any mistyped method name to be interpreted as an HTML tag, use it with care or not at all. This causes the indicated autoloaded methods to be compiled up front, rather than deferred to later This is useful for scripts that run for an extended period of time under FastCGI or modperl, and for those destined to be crunched by Malcolm Beattie s Perl compiler Use it in conjunction with the methods or method families you plan to use. Note that using the - compile pragma in this way will always have the effect of importing the compiled functions into the current namespace If you want to compile without importing use th e compile method instead. This is particularly useful in a modperl environment, in which you might want to precompile all CGI routines in a startup script, and then import the functions individually in each modperl script. By default the CGI module implements a state-preserving behavior called sticky fields The way this works is that if you are regenerating a form, the methods that generate the form field values will interrogate param to see if similarly-named parameters are present in the query string If they find a like-named parameter, they will use it to set their default values. Sometimes this isn t what you want The - nosticky pragma prevents this behavior You can also selectively change the sticky behavior in each element that you generate. Automatically add tab index attributes to each form field With this option turned off, you can still add tab indexes manually by passing a - tabindex option to each field-generating method. This keeps from including undef params in the parameter lis t. By default, versions 2 69 and higher emit XHTML The - noxhtml pragma disables this feature Thanks to Michalis Kabrianis for this feature. If starthtml s - dtd parameter specifies an HTML 2 0, 3 2, 4 0 or 4 01 DTD, XHTML will automatically be disabled without needing to use this pragma. This makes treat all parameters as UTF-8 strings Use this with care, as it will interfere with the processing of binary uploads It is better to manually select which fields are expected to return utf-8 strings and convert them using code like this. This makes produce a header appropriate for an NPH no parsed header script You may need to do other things as well to tell the server that the script is NPH See the discussion of NPH scripts below. Separate the name value pairs in CGI parameter query strings with semicolons rather than ampersands For example. Semicolon-delimited query strings are always accepted, and will be emitted by selfurl and querystring newstyleurls became the default in version 2 64.Separate the name value pairs in CGI parameter query strings with ampersands rather than semicolons This is no longer the default. This overrides the autoloader so that any function in your program that is not recognized is referred to for possible evaluation This allows you to use all the functions without adding them to your symbol table, which is of concern for modperl users who are worried about memory consumption Warning when - autoload is in effect, you cannot use poetry mode functions without the parenthesis Use hr rather than hr or add something like use subs qw hr p header to the top of your script. This turns off the command-line processing features If you want to run a script from the command line to produce HTML, and you don t want it to read CGI parameters from the command line or STDIN, then use this pragma. This turns on full debugging In addition to reading CGI arguments from the command-line processing, will pause and try to read arguments from STDIN, producing the message offline mode enter name value pairs on standard input features. See the section on debugging for more details. can process uploaded file Ordinarily it spools the uploaded file to a temporary directory, then deletes the file when done However, this opens the risk of eavesdropping as described in the file upload section Another CGI script author could peek at this data during the upload, even if it is confidential information On Unix systems, the - privatetempfiles pragma will cause the temporary file to be unlinked as soon as it is opened and before any data is written into it, reducing, but not eliminating the risk of eavesdropping there is still a potential race condition To make life harder for the attacker, the program chooses tempfile names by calculating a 32 bit checksum of the incoming headers. To ensure that the temporary file cannot be read by other CGI scripts, use suEXEC or a CGI wrapper program to run your script The temporary file is created with mode 0600 neither world nor group readable. The temporary directory is selected using the following algorithm. Each of these locations is che cked that it is a directory and is writable If not, the algorithm tries the next choice. SPECIAL FORMS FOR IMPORTING HTML-TAG FUNCTIONS. Many of the methods generate HTML tags As described below, tag functions automatically generate both the opening and closing tags For example. There will be some times when you want to produce the start and end tags yourself In this case, you can use the form start tagname and end tagname as in. With a few exceptions described below , start tagname and end tagname functions are not generated automatically when you use CGI However, you can specify the tags you want to generate start end functions for by putting an asterisk in front of their name, or, alternatively, requesting either start tagname or end tagname in the import list. In this example, the following functions are generated in addition to the standard ones.1 starttable generates a table tag 2 endtable generates a table tag 3 startul generates a ul tag 4 endul generates a ul tag. GENERATING DYNAMIC DOCUMENTS. Most of functions deal with creating documents on the fly Generally you will produce the header first, followed by the document itself provides functions for generating headers of various types as well as for generating HTML For creating GIF images, see the module. Each of these functions produces a fragment of HTML or which you can print out directly so that it displays in the browser window, append to a string, or save to a file for later use. CREATING A STANDARD HEADER. Normally the first thing you will do in any CGI script is print out an header This tells the browser what type of document to expect, and gives other optional information, such as the language, expiration date, and whether to cache the document The header can also be manipulated for special purposes, such as server push and pay per view pages. header returns the Content-type header You can provide your own MIME type if you choose, otherwise it defaults to text html An optional second parameter specifies the st atus code and a human-readable message For example, you can specify 204, No response to create a script that tells the browser to do nothing at all Note that RFC 2616 expects the human-readable phase to be there as well as the numeric status code. The last example shows the named argument style for passing arguments to the CGI methods using named parameters Recognized parameters are - type - status - expires and - cookie Any other named parameters will be stripped of their initial hyphens and turned into header fields, allowing you to specify any header you desire Internal underscores will be turned into hyphens. Most browsers will not cache the output from CGI scripts Every time the browser reloads the page, the script is invoked anew You can change this behavior with the - expires parameter When you specify an absolute or relative expiration interval with this parameter, some browsers and proxy servers will cache the script s output until the indicated expiration date The following forms ar e all valid for the - expires field. The - cookie parameter generates a header that tells the browser to provide a magic cookie during all subsequent transactions with your script Some cookies have a special format that includes interesting attributes such as expiration time Use the cookie method to create and retrieve session cookies. The - nph parameter, if set to a true value, will issue the correct headers to work with a NPH no-parse-header script This is important to use with certain servers that expect all their scripts to be NPH. The - charset parameter can be used to control the character set sent to the browser If not provided, defaults to ISO-8859-1 As a side effect, this sets the charset method as well. The - attachment parameter can be used to turn the page into an attachment Instead of displaying the page, some browsers will prompt the user to save it to disk The value of the argument is the suggested name for the saved file In order for this to work, you may have to set the - type to application octet-stream. The - p3p parameter will add a P3P tag to the outgoing header The parameter can be an arrayref or a space-delimited string of P3P tags For example. In either case, the outgoing header will be formatted as. will accept valid multi-line headers when each line is separated with a CRLF value r n on most platforms followed by at least one space For example. Invalid multi-line header input will trigger in an exception When multi-line headers are received, will always output them back as a single line, according to the folding rules of RFC 2616 the newlines will be removed, while the white space remains. GENERATING A REDIRECTION HEADER. Sometimes you don t want to produce a document yourself, but simply redirect the browser elsewhere, perhaps choosing a URL based on the time of day or the identity of the user. The redirect method redirects the browser to a different URL If you use redirection like this, you should not print out a header as well. You should always use full URLs including the or ftp part in redirection requests Relative URLs will not work correctly. You can also use named arguments. All names arguments recognized by header are also recognized by redirect However, most headers, including those generated by - cookie and - target, are ignored by the browser. The - nph parameter, if set to a true value, will issue the correct headers to work with a NPH no-parse-header script This is important to use with certain servers, such as Microsoft IIS, which expect all their scripts to be NPH. The - status parameter will set the status of the redirect defines three different possible redirection status codes. The default if not specified is 302, which means moved temporarily You may change the status to another status code if you wish Be advised that changing the status to anything other than 301, 302 or 303 will probably break redirection. Note that the human-readable phrase is also expected to be present to conform with RFC 2616, section 6 1.CREATING THE HTML DOCUMENT HEADER. The starthtml routine creates the top of the page, along with a lot of optional information that controls the page s appearance and behavior. This method returns a canned HTML header and the opening body tag All par ameters are optional In the named parameter form, recognized parameters are - title, - author, - base, - xbase, - dtd, - lang and - target see below for the explanation Any additional parameters you provide, such as the unofficial BGCOLOR attribute, are added to the body tag Additional parameters must be proceeded by a hyphen. The argument - xbase allows you to provide an HREF for the base tag different from the current location, as in. All relative links will be interpreted relative to this tag. The argument - target allows you to provide a default target frame for all the links and fill-out forms on the page This is a non-standard feature which only works with some browsers. All relative links will be interpreted relative to this tag You add arbitrary meta information to the header with the - meta argument This argument expects a reference to a hash containing name value pairs of meta information These will be turned into a series of header meta tags that look something like this. To create an type of meta tag, use - head described below. The - style argument is used to incorporate cascading stylesheets into your code See the section on CASCADING STYLESHEETS for more information. The - lang argument is used to incorporate a language attribute into the html tag For example. The default if not specified is en-US for US English, unless the - dtd parameter specifies an HTML 2 0 or 3 2 DTD, in which case the lang attribute is left off You can force the lang attribute to left off in other cases by passing an empty string - lang. The - encoding argument can be used to specify the character set for XHTML It defaults to iso-8859-1 if not specified. The - dtd argument can be used to specify a public DTD identifier string For example. Alternatively, it can take public and system DTD identifiers as an array. For the public DTD identifier to be considered, it must be valid Otherwise it will be replaced by the default DTD If the public DTD contains XHTML , will emit XML. The - declarexml argument, when used in conjunction with XHTML, will put a xml declaration at the top of the HTML header The sole purpose of this declaration is to declare the character set encoding In the absence of - declarexml, the output HTML will contain a meta tag that specifies the encoding, allowing the HTML to pass most validators The default for - declarexml is false. You can place other arbitrary HTML elements to the head section with the - head tag For example, to place a link element in the head section, use this. To incorporate multiple HTML elements into the head section, just pass an array reference. And here s how to create an meta tag. JAVASCRIPTING The - script - noScript - onLoad - onMouseOver - onMouseOut and - onUnload parameters are used to add JavaScript calls to your pages - script should point to a block of text containing JavaScript function definitions This block will be placed within a script block inside the HTML not header The block is placed in the header in order to give your page a fighting chance of h aving all its JavaScript functions in place even if the user presses the stop button before the page has loaded completely attempts to format the script in such a way that JavaScript-naive browsers will not choke on the code unfortunately there are some browsers, such as Chimera for Unix, that get confused by it nevertheless. The - onLoad and - onUnload parameters point to fragments of JavaScript code to execute when the page is respectively opened and closed by the browser Usually these parameters are calls to functions defined in the - script field. Use the - noScript parameter to pass some HTML text that will be displayed on browsers that do not have JavaScript or browsers where JavaScript is turned off. The script tag, has several attributes including type , charset and src src allows you to keep JavaScript code in an external file To use these attributes pass a HASH reference in the - script parameter containing one or more of - type, - src, or - code. A final feature allows you to incorporat e multiple script sections into the header Just pass the list of script sections as an array reference this allows you to specify different source files for different dialects of JavaScript Example. The option - language is a synonym for - type, and is supported for backwards compatibility. The old-style positional parameters are as follows. The author s e-mail address will create a link rev MADE tag if present. A true flag if you want to include a base tag in the header This helps resolve relative addresses to absolute ones when the document is moved, but makes the document hierarchy non-portable Use with care. Other parameters you want to include in the body tag may be appended to these This is a good place to put HTML extensions, such as colors and wallpaper patterns. ENDING THE HTML DOCUMENT. This ends an HTML document by printing the body html tags. CREATING A SELF-REFERENCING URL THAT PRESERVES STATE INFORMATION. selfurl will return a URL, that, when selected, will reinvoke this script with all its state information intact This is most useful when you want to jump around within the document using internal anchors but you don t want to disrupt the current contents of the form s Something like this will do the trick. If you want more control over what s returned, using the url method instead. You can also retrieve the unprocessed query string with querystring. The behavior of calling querystring is currently undefined when the method is something other than GET. OBTAINING THE SCRIPT S URL. url returns the script s URL in a variety of formats Called without any arguments, it returns the full form of the URL, including host name and port number. You can modify this format with the following named arguments. If true, produce an absolute URL, e g. Produce a relative URL This is useful if you want to reinvoke your script with different parameters For example. Produce the full URL, exactly as if called without any arguments This overrides the - relative and - absolute arguments. Append the additional path information to the URL This can be combined with - full - absolute or - relative - pathinfo is provided as a synonym. Append the query string to the URL This can be combined with - full - absolute or - relative - querystring is provided as a synonym. Generate just the protocol and net location, as in. If Apache s modrewrite is turned on, then the script name and path info probably won t match the request that the user sent Set - rewrite 1 default to return URLs that match what the user sent the original request URI Set - rewrite 0 to return URLs that match the URL after modrewrite s rules have run. MIXING POST AND URL PARAMETERS. It is possible for a script to receive CGI parameters in the URL as well as in the fill-out form by creating a form that POSTs to a URL containing a query string a mark followed by arguments The param method will always return the contents of the POSTed fill-out form, ignoring the URL s query string To retrieve URL parameters, call the urlparam method Use it in the same way as param The main difference is that it allows you to read the parameters, but not set them. Under no circumstances will the contents of the URL query string interfere with similarly-named CGI parameters in POSTed forms If you try to mix a URL query string with a form submitted with the GET method, the results will not be what you expect. CREATING STANDARD HTML ELEMENTS. defines general HTML shortcut methods for many HTML tags HTML shortcuts are named after a single HTML element and return a fragment of HTML text Example. This results in the following HTML code extra newlines have been added for readability. If you find the syntax for calling the HTML shortcuts awkward, you can import them into your namespace and dispense with the object syntax completely see the next section for more details. PROVIDING ARGUMENTS TO HTML SHORTCUTS. The HTML methods will accept zero, one or multiple arguments If you provide no arguments, you get a single tag. If you provide one or more string arguments, they are concatenated together with spaces and placed between opening and closing tags. If the first argument is a hash reference, then the keys and values of the hash become the HTML tag s attributes. You may dispense with the dashes in front of the attribute names if you prefer. Sometimes an HTML tag attribute has no argument For example, ordered lists can be marked as COMPACT The syntax for this is an argument that that points to an undef string. Prior to version 2 41, providing an empty string as an attribute argument was the same as providing undef However, this has changed in order to accommodate those who want to create tags of the form img alt The difference is shown in these two pieces of code. THE DISTRIBUTIVE PROPERTY OF HTML SHORTCUTS. One of the cool features of the HTML shortcuts is that they are distributive If you give them an argument consisting of a reference to a list, the tag will be distributed across each element of the list For example, here s one way to make an ordered list. This example will result in HTML output that looks like this. This is extremely useful for creating tables For example. HTML SHORTCUTS AND LIST INTERPOLATION. Consider this bit of code. It will ordinarily return the string that you probably expect, namely. Note the space between the element Hi and the element mom puts the extra space there using array interpolation, which i s controlled by the magic variable Sometimes this extra space is not what you want, for example, when you are trying to align a series of images In this case, you can simply change the value of to an empty string. I suggest you put the code in a block as shown here Otherwise the change to will affect all subsequent code until you explicitly reset it. NON-STANDARD HTML SHORTCUTS. A few HTML tags don t follow the standard pattern for various reasonsment generates an HTML comment -- comment -- Call it like. Because of conflicts with built-in Perl functions, the following functions begin with initial caps. In addition, starthtml , endhtml , startform , endform , startmultipartform and all the fill-out form tags are special See their respective sections. AUTOESCAPING HTML. By default, all HTML that is emitted by the form-generating functions is passed through a function called escapeHTML. escapedstring escapeHTML unescaped string. Escape HTML formatting characters in a string. Provided that you have specified a character set of ISO-8859-1 the default , the standard HTML escaping rules will be used The character becomes lt , becomes gt , becomes amp , and the quote character becomes quot In addition, the hexadecimal 0x8b and 0x9b characters, which some browsers incorrectly interpret as the left and right angle-bracket characters, are replaced by their numeric character entities 8249 and 8250 If you manually change the charset, either by calling the charset method explicitly or by passing a - charset argument to header , then all characters will be replaced by their numeric entities, since has no lookup table for all the possible encodings. escapeHTML expects the supplied string to be a character string This means you should Encode decode data received from outside and Encode encode your strings before sending them back outside If your source code UTF-8 encoded and you want t o upgrade string literals in your source to character strings, you can use use utf8 See perlunitut perlunifaq and perlunicode for more information on how Perl handles the difference between bytes and characters. The automatic escaping does not apply to other shortcuts, such as h1 You should call escapeHTML yourself on untrusted data in order to protect your pages against nasty tricks that people may enter into guestbooks, etc To change the character set, use charset To turn autoescaping off completely, use autoEscape 0.Get or set the current character set. Get or set the value of the autoescape flag. PRETTY-PRINTING HTML. By default, all the HTML produced by these functions comes out as one long line without carriage returns or indentation This is yuck, but it does reduce the size of the documents by 10-20 To get pretty-printed output, please use CGI Pretty a subclass contributed by Brian Paulsen. CREATING FILL-OUT FORMS. General note The various form-creating methods all return strings to t he caller, containing the tag or tags that will create the requested form element You are responsible for actually printing out these strings It s set up this way so that you can place formatting tags around the form elements. Another note The default values that you specify for the forms are only used the first time the script is invoked when there is no query string On subsequent invocations of the script when there is a query string , the former values are used even if they are blank. If you want to change the value of a field from its previous value, you have two choices. 1 call the param method to set it. 2 use the - override alias - force parameter a new feature in version 2 15 This forces the default value to be used, regardless of the previous value. Yet another note By default, the text and labels of form elements are escaped according to HTML rules This means that you can safely use CLICK ME as the label for a button However, it also interferes with your ability to incorporate special HTML character sequences, such as Aacute, into your fields If you wish to turn off automatic escaping, call the autoEscape method with a false value immediately after creating the CGI object. Note that autoEscape is exclusively used to effect the behavior of how some HTML generation functions handle escaping Calling escapeHTML explicitly will always escape the HTML. A Lurking Trap Some of the form-element generating methods return multiple tags In a scalar context, the tags will be concatenated together with spaces, or whatever is the current value of the global In a list context, the methods will return a list of elements, allowing you to modify them if you wish Usually you will not notice this behavior, but beware of this. endform produces several tags, and only the first of them will be printed because the format only expects one value. CREATING AN ISINDEX TAG. Prints out an isindex tag Not very exciting The parameter - action specifies the URL of the script to process the query The default is to process the query with the current script. STARTING AND ENDING A FORM. startform will return a form tag with the optional method, action and form encoding that you specify The defaults are. endform returns the closing form tag. Startform s enctype argument tells the browser how to package the various fields of the form before sending the form to the server Two values are possible. Note These methods were previously named startform and endform These methods are now DEPRECATED Please use startform and endform instead. This is the older type of encoding It is compatible with many CGI scripts and is suita ble for short fields containing text data For your convenience, stores the name of this encoding type in CGI URLENCODED. This is the newer type of encoding It is suitable for forms that contain very large fields or that are intended for transferring binary data Most importantly, it enables the file upload feature For your convenience, stores the name of this encoding type in CGI MULTIPART. Forms that use this type of encoding are not easily interpreted by CGI scripts unless they use or another library designed to handle them. If XHTML is activated the default , then forms will be automatically created using this type of encoding. The startform method uses the older form of encoding by default unless XHTML is requested If you want to use the newer form of encoding by default, you can call startmultipartform instead of startform The method endmultipartform is an alias to endform. JAVASCRIPTING The - name and - onSubmit parameters are provided for use with JavaScript The - name parameter gives th e form a name so that it can be identified and manipulated by JavaScript functions - onSubmit should point to a JavaScript function that will be executed just before the form is submitted to your server You can use this opportunity to check the contents of the form for consistency and completeness If you find something wrong, you can put up an alert box or maybe fix things up yourself You can abort the submission by returning false from this function. Usually the bulk of JavaScript functions are defined in a script block in the HTML header and - onSubmit points to one of these function call See starthtml for details. FORM ELEMENTS. After starting a form, you will typically create one or more textfields, popup menus, radio groups and other form elements Each of these elements takes a standard set of named arguments Some elements also have optional arguments The standard arguments are as follows. The name of the field After submission this name can be used to retrieve the field s value using t he param method. The initial value of the field which will be returned to the script after form submission Some form elements, such as text fields, take a single scalar - value argument Others, such as popup menus, take a reference to an array of values The two arguments are synonyms. A numeric value that sets the order in which the form element receives focus when the user presses the tab key Elements with lower values receive focus first. A string identifier that can be used to identify this element to JavaScript and DHTML. A boolean, which, if true, forces the element to take on the value specified by - value overriding the sticky behavior described earlier for the - nosticky pragma. These are used to assign JavaScript event handlers See the JavaScripting section for more details. Other common arguments are described in the next section In addition to these, all attributes described in the HTML specifications are supported. CREATING A TEXT FIELD. textfield will return a text input field. The fi rst parameter is the required name for the field - name. The optional second parameter is the default starting value for the field contents - value, formerly known as - default. The optional third parameter is the size of the field in characters - size. The optional fourth parameter is the maximum number of characters the field will accept - maxlength. As with all these methods, the field will be initialized with its previous contents from earlier invocations of the script When the form is processed, the value of the text field can be retrieved with. If you want to reset it from its initial value after the script has been called once, you can do so like this. CREATING A BIG TEXT FIELD. textarea is just like textfield, but it allows you to specify rows and columns for a multiline text entry box You can provide a starting value for the field, which can be long and contain multiple lines. CREATING A PASSWORD FIELD. passwordfield is identical to textfield , except that its contents will be starred out o n the web page. CREATING A FILE UPLOAD FIELD. filefield will return a file upload field In order to take full advantage of this you must use the new multipart encoding scheme for the form You can do this either by calling startform with an encoding type of CGI MULTIPART or by calling the new method startmultipartform instead of vanilla startform. The first parameter is the required name for the field - name. The optional second parameter is the starting value for the field contents to be used as the default file name - default. For security reasons, browsers don t pay any attention to this field, and so the starting value will always be blank Worse, the field loses its sticky behavior and forgets its previous contents The starting value field is called for in the HTML specification, however, and possibly some browser will eventually provide support for it. The optional third parameter is the size of the field in characters - size. The optional fourth parameter is the maximum number of characters the field will accept - maxlength. JAVASCRIPTING The - onChange - onFocus - onBlur - onMouseOver - onMouseOut and - onSelect parameters are recognized See textfield for details. PROCESSING A FILE UPLOAD FIELD. When the form is processed, you can retrieve an IO Handle compatible handle for a file upload field like this. In a list context, upload will return an array of filehandles This makes it possible to process forms that use the same name for multiple upload fields. If you want the entered file name for the file, you can just call param. Different browsers will return slightly different things for the name Some browsers return the filename only Others return the full path to the file, using the path conventions of the user s machine Regardless, the name returned is always the name of the file on the user s machine, and is unrelated to the name of the temporary file that creates during upload spooling see below. When a file is uploaded the browser usually sends along some information along with i t in the format of headers The information usually includes the MIME content type To retrieve this information, call uploadInfo It returns a reference to a hash containing all the document headers. If you are using a machine that recognizes text and binary data modes, be sure to understand when and how to use them see the Camel book Otherwise you may find that binary files are corrupted during file uploads. Accessing the temp files directly. When processing an uploaded file, creates a temporary file on your hard disk and passes you a file handle to that file After you are finished with the file handle, unlinks deletes the temporary file If you need to you can access the temporary file directly You can access the temp file for a file upload by passing the file name to the tmpFileName method. The temporary file will be deleted automatically when your program exits unless you manually rename it On some operating systems such as Windows NT , you will need to close the temporary file s filehand le before your program exits Otherwise the attempt to delete the temporary file will fail. Handling interrupted file uploads. There are occasionally problems involving parsing the uploaded file This usually happens when the user presses Stop before the upload is finished In this case, will return undef for the name of the uploaded file and set cgierror to the string 400 Bad request malformed multipart POST This error message is designed so that you can incorporate it into a status code to be sent to the browser Example. You are free to create a custom HTML page to complain about the error, if you wish. Progress bars for file uploads and avoiding temp files. gives you low-level access to file upload management through a file upload hook You can use this feature to completely turn off the temp file storage of file uploads, or potentially write your own file upload progress meter. This is much like the UPLOADHOOK facility available in Apache Request with the exception that the first argument to the callback is an Apache Upload object, here it s the remote filename. The data field is optional it lets you pass configuration information e g a database handle to your hook callback. The usetempfile field is a flag that lets you turn on and off use of a temporary disk-based file during file upload If you set this to a FALSE value default true then q - param uploadedfile will no longer work, and the only way to get at the uploaded data is via the hook you provide. If using the function-oriented interface, call the CGI uploadhook method before calling param or any other CGI functions. This method is not exported by default You will have to import it expli citly if you wish to use it without the CGI prefix. Troubleshooting file uploads on Windows. If you are using on a Windows platform and find that binary files get slightly larger when uploaded but that text files remain the same, then you have forgotten to activate binary mode on the output filehandle Be sure to call binmode on any handle that you create to write the uploaded file to disk. Older ways to process file uploads. This section is here for completeness if you are building a new application with you can skip it. The original way to process file uploads with was to use param The value it returns has a dual nature as both a file name and a lightweight filehandle This dual nature is problematic if you following the recommended practice of having use strict in your code Perl will complain when you try to use a string as a filehandle More seriously, it is possible for the remote user to type garbage into the upload field, in which case what you get from param is not a filehandle at all, but a string. To solve this problem the upload method was added, which always returns a lightweight filehandle This generally works well, but will have trouble interoperating with some other modules because the file handle is not derived from IO Handle So that brings us to current recommendation given above, which is to call the handle method on the file handle returned by upload That upgrades the handle to an IO Handle I t s a big win for compatibility for a small penalty of loading IO Handle the first time you call it. CREATING A POPUP MENU. popupmenu creates a menu. The required first argument is the menu s name - name. The required second argument - values is an array reference containing the list of menu items in the menu You can pass the method an anonymous array, as shown in the example, or a reference to a named array, such as foo. The optional third parameter - default is the name of the default menu choice If not specified, the first item will be the default The values of the previous choice will be maintained across queries Pass an array reference to select multiple defaults. The optional fourth parameter - labels is provided for people who want to use different values for the user-visible label inside the popup menu and the value returned to your script It s a pointer to an hash relating menu values to user-visible labels If you leave this parameter blank, the menu values will be displayed by default You can also leave a label undefined if you want to. The optional fifth parameter - attributes is provided to assign any of the common HTML attributes to an individual menu item It s a pointer to a hash relating menu values to another hash with the attribute s name as the key and the attribute s value as the value. When the form is processed, the selected value of the popup menu can be retrieved using. CREATING AN OPTION GROUP. Named parameter style. optgroup creates an option group within a popup menu. The required first argument - name is the label attribute of the optgroup and is not inserted in the parameter list of the query. The required second argument - values is an array reference containing the list of menu items in the menu You can pass the method an anonymous array, as shown in the example, or a reference to a named array, such as foo If you pass a HASH reference, the keys will be used for the menu values, and the values will be used for the menu labels see - labels below. The optional third parameter - labels allows you to pass a reference to a hash containing user-visible labels for one or more of the menu items You can use this when you want the user to see one menu string, but have the browser return your program a different one If you don t specify this, the value string will be used instead eenie , meenie and minie in this example This is equivalent to using a hash reference for the - values parameter. An optional fourth parameter - labeled can be set to a true value and indicates that the values should be used as the label attribute for each option element within the optgroup. An optional fifth parameter - novals can be set to a true value and indicates to suppress the val attribute in each option element within the optgroup. An optional sixth parameter - attributes is provided to assign any of the common HTML attributes to an individual menu item It s a pointer to a hash relating menu values to another hash with the attribute s name as the key and the attribute s va lue as the value. CREATING A SCROLLING LIST. scrollinglist creates a scrolling list. The first and second arguments are the list name - name and values - values As in the popup menu, the second argument should be an array reference. The optional third argument - default can be either a reference to a list containing the values to be selected by default, or can be a single value to select If this argument is missing or undefined, then nothing is selected when the list first appears In the named parameter version, you can use the synonym - defaults for this parameter. The optional fourth argument is the size of the list - size. The optional fifth argument can be set to true to allow multiple simultaneous selections - multiple Otherwise only one selection will be allowed at a time. The optional sixth argument is a pointer to a hash containing long user-visible labels for the list items - labels If not provided, the values will be displayed. The optional sixth parameter - attributes is provided to assign any of the common HTML attributes to an individual menu item It s a pointer to a hash relating menu values to another hash with the attribute s name as the key and the attribute s value as the value. When this form is processed, all selected list items will be returned as a list under the parameter name listname The values of the selected items can be retrieved with. CREATING A GROUP OF RELATED CHECKBOXES. checkboxgroup creates a list of checkboxes that are related by the same name. The first and second arguments are the checkbox name and values, respectively - name and - values As in the popup menu, the second argument should be an array reference These values are used for the user-readable labels printed next to the checkboxes as well as for the values passed to your script in the query string. The optional third argument - default can be either a reference to a list containing the values to be checked by default, or can be a single value to checked If this argument is missing or undefined, then nothing is selected when the list first appears. The optional fourth argument - linebreak can be set to true to place line breaks between the checkboxes so that they appear as a vertical list Otherwise, they will be strung together on a horizontal line. The optional - labels argument is a pointer to a hash relating the checkbox values to the user-visible labels that will be printed next to them If not provided, the values will be used as the default. The optional parameters - rows and - columns cause checkboxgroup to return an HTML3 compatible table containing the checkbox group formatted with the specified number of rows and columns You can provide just the - columns parameter if you wish checkboxgroup will calculate the correct number of rows for you. The option - disabled takes an array of checkbox values and disables them by greying them out this may not be supported by all browsers. The optional - attributes argument is provided to assign any of the common HTML attributes to an individua l menu item It s a pointer to a hash relating menu values to another hash with the attribute s name as the key and the attribute s value as the value. The optional - tabindex argument can be used to control the order in which radio buttons receive focus when the user presses the tab button If passed a scalar numeric value, the first element in the group will receive this tab index and subsequent elements will be incremented by one If given a reference to an array of radio button values, then the indexes will be jiggered so that the order specified in the array will correspond to the tab order You can also pass a reference to a hash in which the hash keys are the radio button values and the values are the tab indexes of each button Examples. The optional - labelattributes argument will contain attributes attached to the label element that surrounds each button. When the form is processed, all checked boxes will be returned as a list under the parameter name groupname The values of the on che ckboxes can be retrieved with. The value returned by checkboxgroup is actually an array of button elements You can capture them and use them within tables, lists, or in other creative ways. CREATING A STANDALONE CHECKBOX. checkbox is used to create an isolated checkbox that isn t logically related to any others. The first parameter is the required name for the checkbox - name It will also be used for the user-readable label printed next to the checkbox. The optional second parameter - checked specifies that the checkbox is turned on by default Synonyms are - selected and - on. The optional third parameter - value specifies the value of the checkbox when it is checked If not provided, the word on is assumed. The optional fourth parameter - label is the user-readable label to be attached to the checkbox If not provided, the checkbox name is used. The value of the checkbox can be retrieved using. CREATING A RADIO BUTTON GROUP. radiogroup creates a set of logically-related radio buttons turning one member of the group on turns the others off. The first argument is the name of the group and is required - name. The second argument - values is the list of values for the radio buttons The values and the labels that appear on the page are identical Pass an array reference in the second argument, either using an anonymous array, as shown, or by referencing a named array as in foo. The optional third parameter - default is the name of the default button to turn on If not specified, the first item will be the default You can provide a nonexistent button name, such as - to start up with no buttons selected. The optional fourth parameter - linebreak can be set to true to put line breaks between the buttons, creating a vertical list. The optional fifth parameter - labels is a pointer to an associative array relating the radio button values to user-visible labels to be used in the display If not provided, the values themselves are displayed. All modern browsers can take advantage of the optional parameters - rows and - columns These parameters cause radiogroup to return an HTML3 compatible table containing the radio group formatted with the specified number of rows and columns You can provide just the - columns parameter if you wish radiogroup will calculate the correct number of rows for you. To include row and column headings in the returned table, you can use the - rowheaders and - colheaders parameters Both of these accept a pointer to an array of headings to use The headings are just decorative They don t reorganize the interpretation of the radio buttons -- they re still a single named unit. The optional - tabindex argument can be used to control the order in which radio buttons receive focus when the user presses the tab button If passed a scalar numeric value, the first element in the group will receive this tab index and subsequent elements will be incremented by one If given a reference to an array of radio button values, then the indexes will be jiggered so that the order specified in the array will correspond to the tab order You can also pass a reference to a hash in which the hash keys are the radio button values and the values are the tab indexes of each button Examples. The optional - attributes argument is provided to assign any of the common HTML attributes to an individual menu item It s a pointer to a hash relating menu values to another hash with the attribute s name as the key and the attribute s value as the value. The optional - labelattributes argument will contain attributes attached to the label element that surrounds each button. When the form is processed, the selected radio button can be retrieved using. The value returned by radiogroup is actually an array of button elements You can capture them and use them within tables, lists, or in other creative ways. CREATING A SUBMIT BUTTON. submit will create the query submission button Every form should have one of these. The first argument - name is optional You can give the button a name if you have several subm ission buttons in your form and you want to distinguish between them. The second argument - value is also optional This gives the button a value that will be passed to your script in the query string The name will also be used as the user-visible label. You can use - label as an alias for - value I always get confused about which of - name and - value changes the user-visible label on the button. You can figure out which button was pressed by using different values for each one. CREATING A RESET BUTTON. reset creates the reset button Note that it restores the form to its value from the last time the script was called, NOT necessarily to the defaults. Note that this conflicts with the Perl reset built-in Use CORE reset to get the original reset function. CREATING A DEFAULT BUTTON. defaults creates a button that, when invoked, will cause the form to be completely reset to its defaults, wiping out all the changes the user ever made. CREATING A HIDDEN FIELD. hidden produces a text field that can t be see n by the user It is useful for passing state variable information from one invocation of the script to the next. The first argument is required and specifies the name of this field - name. The second argument is also required and specifies its value - default In the named parameter style of calling, you can provide a single value here or a reference to a whole list. Fetch the value of a hidden field this way. Note, that just like all the other form elements, the value of a hidden field is sticky If you want to replace a hidden field with some other values after the script has been called once you ll have to do it manually. CREATING A CLICKABLE IMAGE BUTTON. imagebutton produces a clickable image When it s clicked on the position of the click is returned to your script as buttonname x and buttonname y , where buttonname is the name you ve assigned to it. The first argument - name is required and specifies the name of this field. The second argument - src is also required and specifies the URL. The t hird option - align, optional is an alignment type, and may be TOP, BOTTOM or MIDDLE. Fetch the value of the button this way x param buttonname x y param buttonname y. CREATING A JAVASCRIPT ACTION BUTTON. button produces an input tag with type button When it s pressed the fragment of JavaScript code pointed to by the - onClick parameter will be executed. Browsers support a so-called cookie designed to help maintain state within a browser session has several methods that support cookies. A cookie is a name value pair much like the named parameters in a CGI query string CGI scripts create one or more cookies and send them to the browser in the header The browser maintains a list of cookies that belong to a particular Web server, and returns them to the CGI script during subsequent interactions. In addition to the required name value pair, each cookie has several optional attributes.1 an expiration time. This is a time date string in a special GMT format that indicates when a cookie expires The c ookie will be saved and returned to your script until this expiration date is reached if the user exits the browser and restarts it If an expiration date isn t specified, the cookie will remain active until the user quits the browser. This is a partial or complete domain name for which the cookie is valid The browser will return the cookie to any host that matches the partial domain name For example, if you specify a domain name of then the browser will return the cookie to Web servers running on any of the machines etc Domain names must contain at least two periods to prevent attempts to match on top level domains like If no domain is specified, then the browser will only return the cookie to servers on the host the cookie originated from. If you provide a cookie path attribute, the browser will check it against your script s URL before returning the cookie For example, if you specify the path cgi-bin , then the cookie will be returned to each of the scripts and but not to the script By default, path is set to , which causes the cookie to be sent to any CGI script on your site. If the secure attribute is set, the cookie will only be sent to your script if the CGI request is occurring on a secure channel, such as SSL. The interface to cookies is the cookie method. cookie creates a new cookie Its parameters include. The name of the cookie required This can be any string at all Although browsers limit their cookie names to non-whitespace alphanumeric characters, removes this restriction by escaping and unescaping cookies behind the scenes. The value of the cookie This can be any scalar value, array reference, or even hash reference For example, you can store an entire hash into a cookie this way. The optional partial path for which this cookie will be valid, as described above. The optional partial domain for which this cookie will be valid, as described above. The optional expiration date for this cookie The format is as described in the section on the header method. If set to true, this cookie will only be used within a secure SSL session. The cookie created by cookie must be incorporated into the header within the string returned by the header method. To create multiple cookies, give header an array reference. To retrieve a cookie, request it by name by calling cookie method without the - value parameter This example uses the object-oriented form. Cookies created with a single scalar value, such as the riddlename cookie, will be returned in that form Cookies with array and hash values can also be retrieved. The cookie and CGI namespaces are separate If you have a parameter named answers and a cookie named answers , the values retrieved by param and cookie are independent of each other However, it s simple to turn a CGI parameter into a cookie, and vice-versa. If you call cookie without any parameters, it will return a list of the names of all cookies passed to your script. See the example script for some ideas on how to use cookies effectively. WORKING WITH FRAMES. It s possible for scripts to write into several browser panels and windows using the HTML 4 frame mechanism There are three techniques for defining new frames programmatically.1 Create a Frameset document. After writing out the header, instead of creating a standard HTML document using the starthtml call, create a frameset document that defines the frames on the page Specify your script s with appropriate parameters as the SRC for each of the frames. There is no specific support for creating frameset sections in but the HTML is very simple to write.2 Specify the destination for the document in the header. You may provide a - target parameter to the header method. This will tell the browser to load the output of your script into the frame named ResultsWindow If a frame of that name doesn t already exist, the browser will pop up a new window and load your script s document into that There are a number of magic names that you can use for targets See the HTML frame documentation for details.3 S pecify the destination for the document in the form tag. You can specify the frame to load in the FORM tag itself With it looks like this. When your script is reinvoked by the form, its output will be loaded into the frame named ResultsWindow If one doesn t already exist a new window will be created. The script in the examples directory shows one way to create pages in which the fill-out form and the response live in side-by-side frames. SUPPORT FOR JAVASCRIPT. The usual way to use JavaScript is to define a set of functions in a SCRIPT block inside the HTML header and then to register event handlers in the various elements of the page Events include such things as the mouse passing over a form element, a button being clicked, the contents of a text field changing, or a form being submitted When an event occurs that involves an element that has registered an event handler, its associated JavaScript code gets called. The elements that can register event handlers include the BODY of an HTML doc ument, hypertext links, all the various elements of a fill-out form, and the form itself There are a large number of events, and each applies only to the elements for which it is relevant Here is a partial list. The browser is loading the current document Valid in. The browser is closing the current page or frame Valid for. The user has pressed the submit button of a form This event happens just before the form is submitted, and your function can return a value of false in order to abort the submission Valid for. The mouse has clicked on an item in a fill-out form Valid for. The user has changed the contents of a field Valid for. The user has selected a field to work with Valid for. The user has deselected a field gone to work somewhere else Valid for. The user has changed the part of a text field that is selected Valid for. The mouse has moved over an element. The mouse has moved off an element. In order to register a JavaScript event handler with an HTML element, just use the event name as a pa rameter when you call the corresponding CGI method For example, to have your validateAge JavaScript code executed every time the textfield named age changes, generate the field like this. This example assumes that you ve already declared the validateAge function by incorporating it into a SCRIPT block The starthtml method provides a convenient way to create this section. Similarly, you can create a form that checks itself over for consistency and alerts the user if some essential value is missing by creating it this way print startform - onSubmit validateMe this. See the script for a demonstration of how this all works. LIMITED SUPPORT FOR CASCADING STYLE SHEETS. has limited support for HTML3 s cascading style sheets css To incorporate a stylesheet into your document, pass the starthtml method a - style parameter The value of this parameter may be a scalar, in which case it is treated as the source URL for the stylesheet, or it may be a hash reference In the latter case you should provide the hash with one or more of - src or - code - src points to a URL where an externally-defined stylesheet can be found - code points to a scalar value to be incorporated into a style section Style definitions in - code override similarly-named ones in - src hence the name cascading. You may also specify the type of the stylesheet by adding the optional - type parameter to the hash pointed to by - style If not specified, the style defaults to text css. To refer to a style within the body of your document, add the - class parameter to any HTML element. Or define styles on the fly with the - style parameter. You may also use the new span element to apply a style to a section of text. Note that you must import the html3 definitions to have the span method available Here s a quick and dirty example of using CSS s See the CSS specification at for more information. Pass an array reference to - code or - src in order to incorporate multiple stylesheets into your document. Should you wish to incorporate a verbatim stylesheet that includes arbitrary formatting in the header, you may pass a - verbatim tag to the - style hash, as follows. This will generate an HTML header that contains this. Any additional arguments passed in the - style value will be incorporated into the link tag For example. To make more complicated link tags, use the Link function and pass it to starthtml in the - head argument, as in. To create primary and alternate stylesheet, use the - alternate option. If you are running the script from the command line or in the perl debugger, you can pass the script a list of keywords or parameter value pairs on the command line or from standard input you don t have to wo rry about tricking your script into reading from environment variables You can pass keywords like this. To turn off this feature, use the - nodebug pragma. To test the POST method, you may enable full debugging with the - debug pragma This will allow you to feed newline-delimited name value pairs to the script on standard input. When debugging, you can use quotes and backslashes to escape characters in the familiar shell manner, letting you place spaces and other funny characters in your parameter value pairs. Finally, you can set the path info for the script by prefixing the first name value parameter with the path followed by a question mark. DUMPING OUT ALL THE NAME VALUE PAIRS. The Dump method produces a string consisting of all the query s name value pairs formatted nicely as a nested list This is useful for debugging purposes. Produces something that looks like. As a shortcut, you can interpolate the entire CGI object into a string and it will be replaced with the a nice HTML dump shown ab ove. FETCHING ENVIRONMENT VARIABLES. Some of the more useful environment variables can be fetched through this interface The methods are as follows. Return a list of MIME types that the remote browser accepts If you give this method a single argument corresponding to a MIME type, as in Accept text html , it will return a floating point value corresponding to the browser s preference for this type from 0 0 don t want to 1 0 Glob types e g text in the browser s accept list are handled correctly. Note that the capitalization changed between version 2 43 and 2 44 in order to avoid conflict with Perl s accept function. Returns the variable Cookies have a special format, and this method call just returns the raw form cookie dough See cookie for ways of setting and retrieving cooked cookies. Called with no parameters, rawcookie returns the packed cookie structure You can separate it into individual cookies by splitting on the character sequence Called with the name of a cookie, retrieves the unesc aped form of the cookie You can use the regular cookie method to get the names, or use the rawfetch method from the CGI Cookie module. Returns the variable If you give this method a single argument, it will attempt to pattern match on it, allowing you to do something like useragent Mozilla. Returns additional path information from the script URL E G fetching cgi-bin yourscript additional stuff will result in pathinfo returning additional stuff. NOTE The Microsoft Internet Information Server is broken with respect to additional path information If you use the Perl DLL library, the IIS server will attempt to execute the additional path information as a Perl script If you use the ordinary file associations mapping, the path information will be present in the environment, but incorrect The best thing to do is to avoid using additional path information in CGI scripts destined for use with IIS. As per pathinfo but returns the additional path information translated into a physical path, e g. The M icrosoft IIS is broken with respect to the translated path as well. Returns either the remote host name or IP address if the former is unavailable. Returns the remote host IP address, or 127 0 0 1 if the address is unavailable. scriptname Return the script name as a partial URL, for self-referring scripts. Return the URL of the page the browser was viewing prior to fetching your script Not available for all browsers. Return the authorization verification method in use for this script, if any. Returns the name of the server, usually the machine s host name. When using virtual hosts, returns the name of the host that the browser attempted to contact. Return the port that the server is listening on. Like serverport except that it takes virtual hosts into account Use this when running with virtual hosts. Returns the server software and version number. Return the authorization verification name used for user verification, if this script is protected. Attempt to obtain the remote user s name, using a va riety of different techniques This only works with older browsers such as Mosaic Newer browsers do not report the user name for privacy reasons. Returns the method used to access your script, usually one of POST , GET or HEAD. Returns the contenttype of data submitted in a POST, generally multipart form-data or application x-www-form-urlencoded. Called with no arguments returns the list of environment variables, including such things as and corresponding to the like-named header fields in the request Called with the name of an header field, returns its value Capitalization and the use of hyphens versus underscores are not significant. For example, all three of these examples are equivalent. The same as but operates on the environment variables present when the SSL protocol is in effect Can be used to determine whether SSL is turned on. USING NPH SCRIPTS. NPH, or no-parsed-header , scripts bypass the server completely by sending the complete header directly to the browser This has slight perfo rmance benefits, but is of most use for taking advantage of extensions that are not directly supported by your server, such as server push and PICS headers. Servers use a variety of conventions for designating CGI scripts as NPH Many Unix servers look at the beginning of the script s name for the prefix nph - The Macintosh WebSTAR server and Microsoft s Internet Information Server, in contrast, try to decide whether a program is an NPH script by examining the first line of script output. supports NPH scripts with a special NPH mode When in this mode, will output the necessary extra header information when the header and redirect methods are called. The Microsoft Internet Information Server requires NPH mode As of version 2 30, will automatically detect when the script is running under IIS and put itself into this mode You do not need to do this manually, although it won t hurt anything if you do However, note that if you have applied Service Pack 6, much of the functionality of NPH scripts, including the ability to redirect while setting a cookie, do not work at all on IIS without a special patch from Microsoft See Non-Parsed Headers Stripped From CGI Applications That Have nph - Prefix in Name. Simply add the - nph pragma to the list of symbols to be imported into your script. Call nph with a non-zero parameter at any point after using in your program. in the header and redirect statements. Server Push. provides four simple functions for producing multipart documents of the type needed to implement server push These functions were graciously provided by Ed Jordan To import these into your namespace, you must import the push set You are also advised to put the script into NPH mode and to set to 1 to avoid buffering problems. Here is a simple script that demonstrates server push. This script initializes server push by calling multipartinit It then enters a loop in which it begins a new multipart section by calling multipartstart prints the current local time, and ends a multipart section with multipartend It then sleeps a second, and begins again On the final iteration, it ends the multipart section with multipartfinal rather than with multipartend. Initialize the multipart system The - boundary argument specifies what MIME boundary string to use to separate parts of the document If not provided, chooses a reasonable boundary for you. Start a new part of the multipart document using the spec ified MIME type If not specified, text html is assumed. End a part You must remember to call multipartend once for each multipartstart , except at the end of the last part of the multipart document when multipartfinal should be called instead of multipartend. End all parts You should call multipartfinal rather than multipartend at the end of the last part of the multipart document. Users interested in server push applications should also have a look at the CGI Push module. Avoiding Denial of Service Attacks. A potential problem with is that, by default, it attempts to process form POSTings no matter how large they are A wily hacker could attack your site by sending a CGI script a huge POST of many megabytes will attempt to read the entire POST into a variable, growing hugely in size until it runs out of memory While the script attempts to allocate the memory the system may slow down dramatically This is a form of denial of service attack. Another possible attack is for the remote user to for ce to accept a huge file upload will accept the upload and store it in a temporary directory even if your script doesn t expect to receive an uploaded file will delete the file automatically when it terminates, but in the meantime the remote user may have filled up the server s disk space, causing problems for other programs. The best way to avoid denial of service attacks is to limit the amount of memory, CPU time and disk space that CGI scripts can use Some Web servers come with built-in facilities to accomplish this In other cases, you can use the shell limit or ulimit commands to put ceilings on CGI resource usage. also has some simple built-in protections against denial of service attacks, but you must activate them before you can use them These take the form of two global variables in the CGI name space. If set to a non-negative integer, this variable puts a ceiling on the size of POSTings, in bytes If detects a POST that is greater than the ceiling, it will immediately exit with an error message This value will affect both ordinary POSTs and multipart POSTs, meaning that it limits the maximum size of file uploads as well You should set this to a reasonably high value, such as 1 megabyte. If set to a non-zero value, this will disable file uploads completely Other fill-out form values will work as usual. You can use these variables in either of two ways. Set the variable at the top of the script, right after the use statement. Open up find the definitions for POSTMAX and DISABLEUPLOADS, and set them to the desired values You ll find them towards the top of the file in a subroutine named initializeglo bals. An attempt to send a POST larger than POSTMAX bytes will cause param to return an empty CGI parameter list You can test for this event by checking cgierror either after you create the CGI object or, if you are using the function-oriented interface, call param for the first time If the POST was intercepted, then cgierror will return the message 413 POST too large. This error message is actually defined by the protocol, and is designed to be returned to the browser as the CGI script s status code For example. However it isn t clear that any browser currently knows what to do with this status code It might be better just to create an HTML page that warns the user of the problemPATIBILITY WITH. To make it easier to port existing programs that use the compatibility routine ReadParse is provided Porting is simple. ReadParse routine creates a tied variable named in, which can be accessed to obtain the query variables Like ReadParse, you can also provide your own variable Infrequently used features of ReadParse, such as the creation of in and in variables, are not supported. Once you use ReadParse, you can retrieve the query object itself this way. This allows you to start using the more interesting features of without rewriting your old scripts from scratch. An even simpler way to mix cgi-lib calls with calls is to import both the cgi - lib and standard method. Cgi-lib functions that are available in. In compatibility mode, the following functions are available for your use. Cgi-lib functions that are not available in. AUTHOR INFORMATION. The distribution is copyright 1995-2007, Lincoln D Stein It is distributed under GPL and the Artistic License 2 0 It is currently maintained by Mark Stosberg with help from many contributors. Address bug reports and comments to When sending bug reports, please provide th e version of the version of Perl, the name and version of your Web server, and the name and version of the operating system you are using If the problem is even remotely browser dependent, please provide information about the affected browsers as well. Thanks very much to. Matt Heffron. James Taylor. Scott Anguish. Mike Jewell. Timothy Shimmin. Joergen Haegg. Laurent Delfosse. Richard Resnick. Craig Bishop. Tony Curtis. Tom Christiansen. Andreas Koenig. Tim MacKenzie. Kevin B Hendricks. Stephen Dahmen. David Alan Pisoni. Doug MacEachern. Robin Houston. and many many more. for suggestions and bug fixes. A COMPLETE EXAMPLE OF A SIMPLE FORM-BASED SCRIPT. Please report them. CGI Carp - provides a Carp implementation tailored to the CGI environment. CGI Fast - supports running CGI applications under FastCGI. CGI Pretty - pretty prints HTML generated by with a performance penalty.
Comments
Post a Comment