PHP Sessions &

0 Cevap

Edit

How can I rewrite this PHP code for POST[ 'phrase' ] == session[ 'phrase' ] ?

psuedo-code

//process_form.php

PHP
session_start()

IF POST SUBMIT
    IF empty text1 && empty text2 
        echo error msg, include HTML FORM

    ELSE IF empty radiobtn 
        echo error msg, include HTML FORM

    ELSE IF 
        isset POST[phrase] isstring POST[phrase] isset SESSION[phrase]
        strlen POST[phrase] > 0 strlen SESSION[phrase] > 0 
        POST[phrase] == SESSION[phrase]

        SQL INSERT

    ELSE
        echo POST[phrase]
        echo SESSION[phrase]

ELSE
    include HTML FORM
/PHP

 

FORM

PHP
PEAR CAPTCHA Settings ...
require_once 'Text/captcha.php'
/PHP

HTML
FORM METHOD POST process_form.php
    text1
    text2
    radio
    PHP echo [ img src= sha1(session_id()) . '.png?' . time() ] /PHP
    submit 
/HTML

0 Cevap