My Digital World

C0D3X ! Do we have a C0D3 ?

XML Parser in PHP

June18
  1. $file = 'config.xml';
  2. $stack = array();
  3.  
  4. function startTag($parser, $name, $attrs)
  5. {
  6.    global $stack;
  7.    $tag=array("name"=>$name,"attrs"=>$attrs);  
  8.    array_push($stack,$tag);
  9.  
  10. }
  11.  
  12. function cdata($parser, $cdata)
  13. {
  14.     global $stack,$i;
  15.    
  16.     if(trim($cdata))
  17.     {    
  18.         $stack[count($stack)-1]['cdata']=$cdata;  
  19.     }
  20. }
  21.  
  22. function endTag($parser, $name)
  23. {
  24.    global $stack;  
  25.    $stack[count($stack)-2]['children'][] = $stack[count($stack)-1];
  26.    array_pop($stack);
  27. }
  28.  
  29. $xml_parser = xml_parser_create();
  30. xml_set_element_handler($xml_parser, "startTag", "endTag");
  31. xml_set_character_data_handler($xml_parser, "cdata");
  32.  
  33. $data = xml_parse($xml_parser,file_get_contents($file));
  34. if(!$data) {
  35.    die(sprintf("XML error: %s at line %d",
  36. xml_error_string(xml_get_error_code($xml_parser)),
  37. xml_get_current_line_number($xml_parser)));
  38. }
  39.  
  40. xml_parser_free($xml_parser);
  41.  
  42.  
  43. //print("
\n");
//print $stack[0]['children'][0]['cdata'];
//print_r($stack);
//print("

\n”);

posted under PHP | No Comments »

The happiness

June14

Yes, that fact absent from the minds of many who are looking for happiness and confidence in life, the devil Vslah is clear in his speech, malicious speech in the heart and mind of the believer closer to the truth, and is only trying to convince the scruples of the rights of the devil who leads him astray from the straight path, half of without the co-Jamal our conversation description and expression, forget the promise in God, and trust us with him in all of our, and sitting as a fact only, instead of push us in our belief in the truth and our lives, be an obstacle to the completion of the happiness and life satisfaction.

posted under General | No Comments »

Camp David Summit

June14

In July 15, 1840 signed by the England and Russia, Austria, Russia and Turkey, “the Treaty of London,” the famous, according to which gave the Muhammad Ali and his successors ruled Egypt genetically condition to withdraw its soldiers from the Arab countries, Syria and Crete and other areas seem to say “you govern Egypt as they want, but and pass that you want, but you have to stay within your borders, you and the Arabs or Muslims ”
In 1979, Egypt signed a peace treaty with Israel, based upon recovered Sinai incomplete sovereignty in return for an end to its control of Palestine and withdraw within its borders and outside of the weight, but the struggle against Israel and recognize and establish normal relations with them, that is, recognizing their right in the land of Palestine. Not only that, but has been expressly provided that the treaty priority over any other agreements between Egypt and the Arab States.
So in the Treaty of London 1840 (the first Camp David), the aim was to isolate the Arab world Egypt and the price is the rule of Egypt.
In the Treaty of 1979 (the Camp David II) was again the target is to isolate and neutralize Arab Egypt in the conflict and the price this time is the Sinai.
Different forces and countries have changed, and the transformation of time before the people and the colonial enterprise, but has not changed
Why?
Because of geographical and historical facts have not changed, His mother an Arab-led Islamic Egypt is a major force that can not be allowed by the colonial perspective, and past experience has shown that the isolation of Egypt from the Arab Nation is the only way to customize both.
What happened after the treaty confirms this: After less than fifty years since the Treaty of London Under the texts and their applications Britain succeeded in occupying Egypt, and succeeded in subject and keeping them under control for many years is almost three-quarters of the century, and was placing us in two world wars in which we do not have nothing Abair and unnecessary necessities (the old world order) and the rearrangement of the colonial, and planted Israel during these years and forced the nose in spite of all the Arabs. And even after independence, we have pay the bill for the long years of occupation, and we are trying to hold rallies to try to catch up with growth and development. And surpassed nations and a country we were saluting us with great material and human potential. Tertebena dropped in the rankings to the lower ranks. It was a price mistake.
As for the peace treaty between us and Israel (the Camp David II) Following the signature in the light of the texts, Israel immediately began to rearrange the region Vajtaan Beirut in 1982 and has generated and the expulsion of Palestinian forces them to Tunisia and Yemen, to become, for the first time since the beginning of the conflict away from the borders of their land territory, It is Tsoethm cook, and be forced to finally recognize the sovereignty of most of the land of Israel and Palestine to accept anything offered to them in the rest of them.
The situation becomes as follows: “Egypt is a large and powerful Arabs outside the conflict, and Palestinian authorities agreed to the settlement”
Not be in front of others, but Etwavdoa one after the other to the Committee on U.S.-Israeli peace, and be installed and the blessing of Israel’s existence to all, and lost Palestine.
Continue and events are set to the rhythm of the Arab situation (the new world order) and the United States could control the most important keys to the region and become the official policy of the Arab Muslim, what is not acceptable to bless America and falls under the unrealistic solutions.
Iraq and lost, and Itagol Zionists, and encircling the rest of the valiant Palestinian resistance, and exterminate our people in Gaza, in front of our eyes. And the rest came as no …

Unless the face of aggression from its root causes and not just with its
And we are working to recover Egypt’s Camp David II

posted under General | No Comments »

Communication !

June14

Communication between humans is responsible for the creation of growth
At the individual level and at the level of development of society as a whole
When the work of friends in the outside world
Thus, you establish friendships in your procedure
Within your mind, which always makes you alert of thought, conscience
We are not closed systems with the same
But we are created to be affected are those around us influence us by encouraging us
Lecture, as well as us, and we also
If people love inevitably feel comfortable and spontaneous when you are with them
How beautiful communication

posted under General | No Comments »

Find String Function in PHP

May23

Ready and easy and cool way to find find string in php inside another string :)

  1. function findtxt($start,$end,$str,&$var) {
  2.  if(stristr($str,$start) && stristr($str,$end)) {
  3.   $txt_pos_s = strpos($str,$start) + strlen($start);
  4.   $txt_pos_e = strpos($str,$end,$txt_pos_s);
  5.   $txt_length = $txt_pos_e - $txt_pos_s;
  6.   $txt = substr($str,$txt_pos_s,$txt_length);
  7.   $var = $txt;
  8.   return TRUE;
  9.  }
  10.  else {
  11.   return FALSE;
  12.  }
  13. }

Example Usage :

  1. $str="i search and i find  Address 1: 247 Cairo university St. but i found Address 2: Giza 25 Dokki St.";
  2. findtxt('Address 1:','Address 2:',$str,$s1); //it will return the string between Address 1: and Address 2:  in the string  $s1
posted under PHP | 1 Comment »

Curl Function with POST / GET

May23

This is Curl ready function with post and get functions ,

  1. $random=rand(1, 100000);
  2. $cookie=$random . ".txt";
  3. $agent="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
  4. function doRequest($method, $url, $referer, $agent, $cookie, $vars) {
  5.     $ch=curl_init();
  6.     curl_setopt($ch, CURLOPT_URL, $url);
  7.     if($referer != "") {
  8.  curl_setopt($ch, CURLOPT_REFERER, $referer);
  9.     }
  10.     curl_setopt($ch, CURLOPT_USERAGENT, $agent);
  11.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  12.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13.     curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
  14.     curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  15.     if ($method == 'POST') {
  16.         curl_setopt($ch, CURLOPT_POST, 1);
  17.         curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
  18.     }
  19.     if (substr($url, 0, 5) == "https") {
  20.  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  21.  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
  22.     }
  23.     $data = curl_exec($ch);
  24.     curl_close($ch);
  25.     if ($data) {
  26.         return $data;
  27.     } else {
  28.         return curl_error($ch);
  29.     }
  30. }
  31.  
  32. function get($url, $referer, $agent, $cookie) {
  33.     return doRequest('GET', $url, $referer, $agent, $cookie, 'NULL');
  34. }
  35.  
  36. function post($url, $referer, $agent, $cookie,  $vars) {
  37.     return doRequest('POST', $url, $referer, $agent, $cookie, $vars);
  38. }

Example of usage :

  1. $referer='http://www.somesite.com';
  2. $url='http://www.somesite.com/login';
  3. $str=get($url, $referer, $agent, $cookie);
  4. $url='https://www.somesite.com/webscr?cmd=_login-submit
  5. $vars='login_cmd=&login_params=&login_email='.urlencode($user).'&login_password='.urlencode($pass);
  6. $str=post($url . '&' . $vars, $referer, $agent, $cookie,  ''); //return the string of the CURL
posted under PHP | 7 Comments »

Installing Ubuntu 9.04 ( Jaunity ) Using Wubi Installer

May23

When i started installing Ubuntu 9.04 ( Jaunity ) Using Wubi – it come to Creating Virtual Disks and it stuck for long time . like it go through infinite loop .i tried 2-3 times but no hope ,

Solution :

Reformat the driver you will install the Ubuntu on it using NTFS filesystem . and try re installing :)

It works perfect even the error i got before in 8.10 when i was upgrading my Kernel , all is gone , works great

posted under Linux | 14 Comments »

Welcome Back my blog :)

May23

Whoff , for long time i had no enough time to re-up my site , college exams , projects ,…

Finally i uploaded it , with the new design . and ill put all the old contents soon isa :)

Regards

posted under General | 1 Comment »