Jump to content

SET $COOKIE ?


karker

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

 

 

 

$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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.