Suppression des droits d'exécution des fichiers.
[auf_paf.git] / includes / tclyit_cam_pc.php
CommitLineData
98ff4c8e 1<?php\r
2//--Veuillez m'aider pour améliorer cette fonction--et envoyer à tclyit@gmail.com\r
3//--------Vos critiques sont bienvenues!!----------------------------------------\r
4//----------Encrypt----------------------------\r
5\r
6function tcly($string, $key) {\r
7$result = '';\r
8for($i=0; $i<strlen($string); $i++){\r
9$char = substr($string, $i, 1);\r
10$keychar = substr($key, ($i % strlen($key))-1, 1);\r
11$char = chr(ord($char)+ord($keychar));\r
12$result.=$char;\r
13}\r
14return base64_encode($result);\r
15}\r
16\r
17/*$key1 = "Chhunly";\r
18$Se = "1@2!3#^&%()-_+=[{}}|\;:,.Chhunly";\r
19$See = encrypt($Se,$key1);\r
20echo "Encrypt: ".$See."<br /><br />";*/\r
21\r
22//----------Decrypt----------------------------\r
23function bbcsr($string, $key) {\r
24$result = '';\r
25$string = base64_decode($string);\r
26\r
27for($i=0; $i<strlen($string); $i++){\r
28$char = substr($string, $i, 1);\r
29$keychar = substr($key, ($i % strlen($key))-1, 1);\r
30$char = chr(ord($char)-ord($keychar));\r
31$result.=$char;\r
32}\r
33return $result;\r
34}\r
35/*$key2 = "Chhunly";\r
36$Sd = "n4OaiaiRyp91kIqZy5CrnuPl8urItIqUj6/UzeOx1OE=";\r
37$Sdd = decrypt($Sd,$key2);\r
38echo "Decrypt: ".$Sdd;*/\r
39\r
40//------------Valider Email Addresse--------------------------------\r
41\r
42function check_emails($email){\r
43 // First, we check that there's one @ symbol, and that the lengths are right\r
44 if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)){\r
45 return false;\r
46 }\r
47 // Split it into sections\r
48 $email_array = explode("@", $email);\r
49 $local_array = explode(".", $email_array[0]);\r
50 for ($i = 0; $i < sizeof($local_array); $i++){\r
51 if (!ereg("^(([A-Za-z0-9!#$%&#038;'*+/=?^_`{|}~-][A-Za-z0-9!#$%&#038;'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])){\r
52 return false;\r
53 }\r
54 }\r
55// Check if domain is IP. If not, it should be valid domain name\r
56 if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])){\r
57 $domain_array = explode(".", $email_array[1]);\r
58 if (sizeof($domain_array) < 2) {\r
59 return false; // Not enough parts to domain\r
60 }\r
61 for ($i = 0; $i < sizeof($domain_array); $i++){\r
62 if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])){\r
63 return false;\r
64 }\r
65 }\r
66 }\r
67 return true;\r
68}\r
69?>