Jump to content

g_p_java

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

g_p_java's Achievements

Member

Member (2/5)

0

Reputation

  1. if i use mysql_query('SET NAMES utf8 ') instead of mysql_set_charset, is that the same??
  2. Hello, i use MySQL with PHP. My php version is 5.2.0. After i connect to the db i use mysql_set_charset in order to change the system variables (character_set_client , character_set_results ,character_set_connection). i do: if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); mysql_set_charset('utf8',$$link); } else { $$link = mysql_connect($server, $username, $password); mysql_set_charset('utf8',$$link); } I take the error: Fatal error: Call to undefined function mysql_set_charset(). In the manual page for mysql_set_character says: 1."(PHP 5 >= 5.2.3)" --> that means that i have an old php version?? 2."Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended. " What shall i do in order to solve my problem?? thanks, in advance!
  3. Hello i have the following code $out = db_fetch_row($q); $new_array = array(); if($out[1] != NULL) $new_array = explode(" ",$out[1]); #I GET THE ERROR HERE!!! WHY??? else #do nothing I get the following error Parse error, unexpected T_OBJECT_OPERATOR Thanks, in advance!
  4. Well, in my php files i refer to hyperlinks like <a href="<? echo $site_root?> or <a href="categories/search_category.php"> or <a href="<? echo $site_root.$root_content."my_images/".$_SESSION['opi'][$y-1]['FILENAME'];?>"> Well i use headers and requires, i don't know if they cause a problem require '../my_inc/user_auth.inc'; require '../my_inc/init.inc'; require 'my_inc/categories_files.inc'; In my init.inc files i have defined $root_site = "http://XXX.XX.XX.XX/site/"; $root_content = "eshop/content/" I cannot understand what causes the problems, Thanks
  5. Thanks for replying, well in my code sometimes i refer to an image like ../../images etc. I'm sorry for asking but i didn't quite understand the question. Where am i supposed to find the code of the hyperlinks???
  6. Hello guys, i would like to make a question related to aliases. I have configured my http.conf file and i have placed NameVirtualHost 127.0.0.1:80 <VirtualHost 127.0.0.1:80> ServerAdmin admin@mail DocumentRoot "C:/project/www/site/e-shop" ServerName eshop.local Alias /manager "C:/project/www/site" </VirtualHost> <Directory "C:/project/www/site"> Options Indexes FollowSymlinks MultiViews Includes AllowOverride None Order deny,allow Allow from all </Directory> Well, when i type in the browser "eshop.local/manager" it's working. My problem is that when i clink somewhere else, the browser reveales the true path. That's a problem, e.g. my browser shows "http://XXX.XXX.XXX.XXX/site/multi.php" and even eshop.local is not there. What option shall i place in the <Directory> here</Directory> in order to hide in the browser the true path and show only eshop.local/manager path???? As i can see, the site it's working, but the fact that it reveales the truth path, it's something i wouldn't like to happen. Thanks, in advance!
  7. Hi, i have a web application which consists of php files and images. In my php files i have references to image files like this "../".$my_root_site."images/thumbs/". etc ... The problem is that i changed the path for my images folders and i have to replace each line of my php files with this "../../".$my_root_site."images/thumbs/". I have to add a ../ , because the php files cannot "see" my new path!!! I have a lot of files and i cannot modify all of my php files!!! I'm studying the apache documentations for alias and redirect but i don't know what i shall use. May you please advise me? Thanks, in advance!!!
  8. Hello, i would like to make a program which is going to take as input the client's IP and output a string related to that IP. That program has to tokenize every IP and produce a specific and unique string for that IP , that means that i have to produce for every token a specific string.So, i have to convert every number to a string The algorithm i'm thinking is: have an array of characters like $arr_codes = array(); $arr_codes["0"] = 'j'; $arr_codes["1"] = 'a'; $arr_codes["2"] = 'b'; $arr_codes["3"] = 'c'; $arr_codes["4"] = 'd'; $arr_codes["5"] = 'e'; $arr_codes["6"] = 'f'; $arr_codes["7"] = 'g'; $arr_codes["8"] = 'h'; $arr_codes["9"] = 'i'; e.g. input: 97.172.1.2 Tokenise 97 172 1 2 Output ig_agb_a_b The code i have is: $encoding_ipPart = array(); $array_with_all_ipParts = array(); $j = 0; $ip = $_SERVER["REMOTE_ADDR"]; $splitIp = explode(".", $ip); foreach($splitIp as $ipPart){ for($i=0;$i<strlen($ipPart);$i++){ $charArray[] = $ipPart[$i]; $int_char = $arr_codes[$ipPart[$i]]; $encoding_ipPart[] = $int_char; } $array_with_all_ipParts[$j] = $encoding_ipPart; echo "Array with all ipParts : " . "<br />"; var_dump($array_with_all_ipParts); $j = $j + 1; $encoding_ipPart = array(); } echo "PHP PHPH PHPH HELP " . "<br />"; $new_array = implode(" ",$Whole_String); print $new_array; May you please help me? The program has to take the IP of the client and convert it into a string. But it doesn't output the string as i desire, Also what about the algorithm?Is it a good choice for converting an IP into a unique string, so that everytime a specific IP visits the site, the same string is going to be generated.
  9. Well i need to display what $all_arrays_in_one outputs: e.g. adjikl , to print a whole string I mean not like this * => string(1) "b" [1]=> string(1) "b" [2]=> string(1) "d" } } etc
  10. I would like to take the values of an array and not the keys and implode them. Usually the examples i have seen are : <?php $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); echo $comma_separated; // lastname,email,phone ?> The difference is that in my code, when i do vardump i get : In my example here i have an array which consists of {key = id, key = ga,key = ajf,key = bbd } array(4) { [0]=> array(2) { [0]=> string(1) "i" [1]=> string(1) "d" } [1]=> array(2) { [0]=> string(1) "g" [1]=> string(1) "a" } [2]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "j" [2]=> string(1) "f" } [3]=> array(3) { [0]=> string(1) "b" [1]=> string(1) "b" [2]=> string(1) "d" } } Also i did that: $implodedArray = implode(" ",$all_arrays_in_one); print $implodedArray; but i get that error : Warning: implode() [function.implode]: Invalid arguments passed in
  11. $all_arrays_in_one = array(); $ar0 = array(); $ar1 = array(); $ar2 = array(); $ar3 = array(); $j = 0; for($j = 0; $j <= 3 ;$j++) { if($j == 0) $all_arrays_in_one[$j] = $ar0; //$ar0 has a string "My" if($j == 1) $all_arrays_in_one[$j] = $ar1; // $ar1 "name" if($j == 2) $all_arrays_in_one[$j] = $ar2; //$ar2 "is" if($j == 3) $all_arrays_in_one[$j] = $ar3; //$ar3 "g_p" } //for var_dump($all_arrays_in_one); //it prints all the the elements //i then do print implode(" ",$all_arrays_in_one); //add a space //Then i would like to output in the page using echo "My name is g_p" The problem is that print implode(" ",$all_arrays_in_one); doesn't print "My name is g_p" What shall i do? Thanks
  12. well i have already posted my array in another thread ... but noone has replied
  13. Hello, i have an array and i assign it in a variable : $str = $arr; i then do echo "Str : , $str " . "<br />"; and it doesn't print anything! Do you know what's going wrong? Thanks
  14. $arr_codes = array(); $arr_codes["0"] = 'j'; $arr_codes["1"] = 'a'; $arr_codes["2"] = 'b'; $arr_codes["3"] = 'c'; $arr_codes["4"] = 'd'; $arr_codes["5"] = 'e'; $arr_codes["6"] = 'f'; $arr_codes["7"] = 'g'; $arr_codes["8"] = 'h'; $arr_codes["9"] = 'i'; var_dump($arr_codes); //Print arr_codes to see if everything is inserted well $encoding_ipPart = array(); //Create new array echo "NEW NEW NEW NEW CODE" . "<br />"; $ip = $_SERVER["REMOTE_ADDR"]; $splitIp = explode(".", $ip); foreach($splitIp as $ipPart){ //echo "SplitIp : , $ipPart " . "<br />"; //SplitIP for($i=0;$i<strlen($ipPart);$i++){ //echo "Take each Character : , $ipPart[$i] " . "<br />"; $charArray[] = $ipPart[$i]; $int_char = $arr_codes[$ipPart[$i]]; // e.g. int_char maybe '9' //echo "Hm... : , $int_char " . "<br />"; $encoding_ipPart[] = $int_char; } echo "Print $encoding ipPart .<br />"; var_dump($encoding_ipPart); //Here prints : e.g. if we have $ipPart = 97 , then $encoding_ipPart shall print id //$array_with_all_ipParts shall store every $encoding_ipPart e.g. it shall look like this $array = array('ab','cd','ef','gh'); $array_with_all_ipParts[] = $encoding_ipPart; $encoding_ipPart = array(); //clear array } var_dump($charArray); print implode("_",$array_with_all_ipParts); //$array_with_all_ipParts shall print di_jk_lo Hope you understand! It's just that my program shall take as input an ip and output a specific string related to the ip that visits the site. Thanks in advance!
  15. Thanks for replying! I have the array $charArray and i do print $charArray; and it doesn't print anything!
×
×
  • 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.