karker Posted May 6, 2011 Share Posted May 6, 2011 how can i set cookie like a*dm*n@**t*r*c**.*c** ?? $cookkiee = $islem_1['mail'] ; $sayisi = strlen($cookkiee)-1 ; $cok = $islem_1['mail'] ; for($i=0;$i<=$sayisi;$i++) { $sifr = rand(0,2); if($sifr ==0) { $cok[$i]= '*'; } $dizik = $cok[$i]; setrawcookie("kayip",$dizik,time()+(60*30),"/"); $_COOKIE['kayip'] = $dizik; echo $dizi // etc . a*dm*n@**t*r*c**.*c** } echo $_COOKIE['kayip']; // etc. just one char being like random a Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/ Share on other sites More sharing options...
fugix Posted May 6, 2011 Share Posted May 6, 2011 i honestly have no clue what you are asking Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211566 Share on other sites More sharing options...
karker Posted May 6, 2011 Author Share Posted May 6, 2011 i want create a cookie like a*s*das**as@*as*e**sd.c** with upses codes Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211600 Share on other sites More sharing options...
xyph Posted May 6, 2011 Share Posted May 6, 2011 Do you want that to be your cookie value? Or cookie name? You should simply be able to use setcookie('cookie_name', 'a*s*das**as@*as*e**sd.c**'); Assuming output hasn't been sent to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211605 Share on other sites More sharing options...
karker Posted May 6, 2011 Author Share Posted May 6, 2011 $cookkiee = $islem_1['mail'] ; // mail in here example@hotmail.com $sayisi = strlen($cookkiee)-1 ; $cok = $islem_1['mail'] ; for($i=0;$i<=$sayisi;$i++) { $sifr = rand(0,2); if($sifr ==0) { $cok[$i]= '*'; } $dizik = $cok[$i]; setrawcookie("kayip",$dizik,time()+(60*30),"/"); $_COOKIE['kayip'] = $dizik; echo $dizi } echo $_COOKIE['kayip']; Cookie setting like "m" or a char"" didnt be cookie like "as*asd*@as*as*.co*" why for ? can everybody help me? Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211611 Share on other sites More sharing options...
karker Posted May 6, 2011 Author Share Posted May 6, 2011 ?? Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211630 Share on other sites More sharing options...
wildteen88 Posted May 6, 2011 Share Posted May 6, 2011 You are not making any sense at all. Please explain what you are trying to do. Are you trying to set a cookie so it stores an email address? Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211638 Share on other sites More sharing options...
xyph Posted May 6, 2011 Share Posted May 6, 2011 I see what's going on here. I suggest using whitespace to help you organize your code. Also, rewrite it to make it easier to understand. <?php $mail = 'someemail@domain.com'; $mail_obs = ''; foreach (str_split($mail) as $chr ) { if( mt_rand(0,2) === 0 ) $chr = '*'; $mail_obs .= $chr; } echo $mail_obs; ?> Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211641 Share on other sites More sharing options...
karker Posted May 6, 2011 Author Share Posted May 6, 2011 i did but $mail = 'someemail@domain.com'; i must do strlen($mail)-1 and for incoming mail witdhs are dynamical ? how can we upgrade it ? Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211661 Share on other sites More sharing options...
xyph Posted May 6, 2011 Share Posted May 6, 2011 str_split( $string ) will split a string into an array, and will be dynamic. If you wanted to be ultra-efficient, you would use: $mail = 'someemail@domain.com'; for($i=0;$i<strlen($mail);$i++) { if( mt_rand(0,2) === 0 ) $mail[$i] = '*'; } echo $mail; But the difference is MINIMAL. You are also permanently changing the $mail variable. Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211663 Share on other sites More sharing options...
karker Posted May 6, 2011 Author Share Posted May 6, 2011 thankx xyph for helping Quote Link to comment https://forums.phpfreaks.com/topic/235718-set-cookie/#findComment-1211680 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.