Wednesday 15 January 2014

scripting - Trying to change a php script from blocking identical ip to blockingidentical ID numbers -


I am very new to PHP and still trying to learn it "ins and outs". (Self-taught) I

This special petition is sent to the offices with multiple signatories using the same IP, hence I am duplicate code blocking duplicate IP "GPL" The signatory to the number needs to be changed. I have a database setup, but I do not know exactly how to coding it will be replaced by the code.

Alternatively, I am trying to send information to the signer at my email address for an additional copy. I know this should be simple, but as I said, I am teaching myself and very new, so any help would be greatly appreciated. Thank you very much for your time.

  & lt ;? Php included ('database / config.php'); ('Database / database.php'); $ Err = ''; If (isset ($ _ POST ['submit'])) {$ first = addlashes (trim ($ _ POST ['first'])); $ Last = added zombies (trim ($ _ POST ['last'])); $ Glvar = addlashes (trim ($ _ POST ['glvar'])); $ Ip = release ($ _ server ['HTTP_X_FORWARDED_FOR'])? $ _SERVER ['HTTP_X_FORWARDED_FOR']: $ _SERVER ['REMOTE_ADDR']; // echo $ ip; If ($ first! = '') & Amp; ($ last! = '') & Amp; amp; ($ glvar! = '')) {$ Database = New Database (HOST, DATEBASE, USERNAME, PASSWORD) ; $ AllUsers = $ Database-> Select ('user', 'ip', '*', 'ip =' ".IP" '' ""); // echo $ ip; $ checkIp = 0; $ CheckIp = count ($ allUsers); $ UserData = Array ('first_name' = & gt; $ first, 'last_name' = & gt; $ end, 'glvar_id' = & gt; $ glvar, 'ip' = & gt; $ ip;); if (! $ CheckIp ) Enter $ Database- & gt; Enter ('user', $ userData); Header ('location: thank you.html');} and $ err. = '& Lt; p style = "Color: red" Gt; Hey! You have already signed the petition & lt; / p & gt; ';} Else {if ($ first ==' ') $ err. =' & Lt; p style = "color: Red "& gt; your first name is not empty & lt; / p & gt; '; if ($ last ==' ') $ err. =' & Lt; p style =" color: red " Gt; Your last name is not empty & lt; / p & gt; '; $ ($ glvar ==' ') $ err. =' & Lt; p style = "color: red"> empty your GLVAR ID Do not have & lt; / p & gt; ';}}? & Gt;    

You should ask the database instead of glvar . IP:

This may look like what the glvar_id columns look like in the database. Select

  $ allUsers = $ database-> ('User', 'Glvar_id', '*', "glvar_id = '". $ Glvar. "' ''); // echo $ ip; $ Checkglow = 0; $ Checkglow = count ($ allUsers);   

If you want to match yourself to success then you want to configure the php mail function for the function and add it here:

  if ( ! $ CheckYou) {$ Database-> Insert ('user', $ userData); Mail ("to@me.com", "subject", "message"); Header ('location: thank you.html'); }    

No comments:

Post a Comment