Jump to content

aliento

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by aliento

  1. I am building an application , a directory for auctions. For SEO i made a script which copies a php file to all the directories paths that it creates. I made it work and into all the php files into each directory it includes the base file which shows the code with some variables to recognize the file. Its time now to make the user access and make the sessions. I read that session_start(); should be at the top of the code but this means that should change all the files in all directories. Can i put the session_start(); at the header.php of my script will it work or should i put it onto every php file at the top? Thank you
  2. I want the server to compile all html pages as php with an .htaccess code i found. Where should i put it ? into the root directory or into all directories?
  3. i found solution. Ajax can't send multybyte utf-8. I use a pregmatch on serverside to convert it to utf-8. $retval = utf8_encode( preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;",urldecode($retval)) );
  4. Is a form submit script with ajax and i cant make it UTF-8 , do you have any idea? function xmlhttpPost(strURL,formname,responsediv,responsemsg) { var xmlHttpReq = false; var self = this; // Xhr per Mozilla/Safari/Ie7 if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // per tutte le altre versioni di IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { // Quando pronta, visualizzo la risposta del form updatepage(self.xmlHttpReq.responseText,responsediv); } else{ // In attesa della risposta del form visualizzo il msg di attesa updatepage(responsemsg,responsediv); } } self.xmlHttpReq.send(getquerystring(formname)); } function getquerystring(formname) { var form = document.forms[formname]; var qstr = ""; function GetElemValue(name, value) { qstr += (qstr.length > 0 ? "&" : "") + escape(name).replace(/\+/g, "%2B") + "=" + escape(value ? value : "").replace(/\+/g, "%2B"); //+ escape(value ? value : "").replace(/\n/g, "%0D"); } var elemArray = form.elements; for (var i = 0; i < elemArray.length; i++) { var element = elemArray[i]; var elemType = element.type.toUpperCase(); var elemName = element.name; if (elemName) { if (elemType == "TEXT" || elemType == "TEXTAREA" || elemType == "PASSWORD" || elemType == "BUTTON" || elemType == "RESET" || elemType == "SUBMIT" || elemType == "FILE" || elemType == "IMAGE" || elemType == "HIDDEN") GetElemValue(elemName, element.value); else if (elemType == "CHECKBOX" && element.checked) GetElemValue(elemName, element.value ? element.value : "On"); else if (elemType == "RADIO" && element.checked) GetElemValue(elemName, element.value); else if (elemType.indexOf("SELECT") != -1) for (var j = 0; j < element.options.length; j++) { var option = element.options[j]; if (option.selected) GetElemValue(elemName, option.value ? option.value : option.text); } } } return qstr; } function updatepage(str,responsediv){ document.getElementById(responsediv).innerHTML = str; }
  5. Yes it will be like this but the entries at this table will be a lotttt. Is this a problem?
  6. what makes me trouble is the number of the pms which will be a lot. So the db will need a lot of time to pick the correct pm message.
  7. Hi, I need to have pm at my php application , the pms will be a lot between the members. I dont know how to build the db ? One table for all pms
  8. You have users id so add to the db to the table users add a long text entry called friends. At this add friend id separate with ; and make a function to explode this entry and take care.
  9. a ok i didnt study php on school to know everything. I post it here to show you the logic i use to create a all directory application easy just with one file, i know the code is pure.
  10. i didn't know this 'indentation' It came from a hard thought through years to me. I am not disappointed i feel rather more excited to go on ...
  11. I always ask now is time to give. THE ONE FILE BELLOW : From 2 arrays it creates the directories and a subcategory at the filesystem . It stores into every directory the infos into an nfo file it adds the categories to the db with there ids At every folder i include a index.php which inside takes the data i need from the data.nfo and includes the main and one index.php will be used <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Language" content="el, en" /> </head> <body> <?php include "nomoi.php"; // it includes 2 arrays , the names of the categories it should create function dwrite($i,$nomoi_el,$nomoi_en) { $id = $i ; $mysql_id = mysql_connect('localhost', 'root', ''); mysql_select_db("lefta"); mysql_query("SET NAMES 'utf8'"); $sql = "INSERT INTO `nomoi` (id, nomoi_el, nomoi_en ) VALUES ('".$id."' , '".$nomoi_el."' , '".$nomoi_en."' ) ;"; mysql_query($sql) or die(mysql_error()); } function index_nomoi($nomoi_en,$nomoi_el,$nomoi_id) { $text = $nomoi_en.";"; $text .= $nomoi_el.";"; $text .= $nomoi_id; return $text; } function index_mere($nomoi_en,$nomoi_el,$nomoi_id) { $text = $nomoi_en.";"; $text .= $nomoi_el.";"; $text .= $nomoi_id.";"; $text .= "subdirectory"; return $text; } function write($path, $content) { $path=$path."/info.dir"; if (file_exists($path) && !is_writeable($path)) { return false; } if ($fp = fopen($path, "w")) { fwrite($fp, $content); fclose($fp); chmod($path,0777);} else { return false; } return true; } function copyindexnomoi($path) { $old = './build/nomos.php'; $new = $path.'/index.php'; copy($old, $new) or die("Unable to copy $old to $new."); chmod($new,0777); } function copyindexsubdirectory($path) { $old = './build/nomos.php'; $new = $path.'/index.php'; copy($old, $new) or die("Unable to copy $old to $new."); chmod($new,0777); } for ($i=0;$i<count($nomoi_en);$i++) { mkdir("./dir/".$nomoi_en[$i]); // directory creation for directory chmod("./dir/".$nomoi_en[$i],0777); write("./dir/".$nomoi_en[$i], index_nomoi($nomoi_en[$i],$nomoi_el[$i],$i+1)); // write info for the directory copyindexnomoi("./dir/".$nomoi_en[$i]); // copy index.php for the directory of directory dwrite($i+1,$nomoi_el[$i],$nomoi_en[$i]); // copy to mysql the dyrectory mkdir("./dir/".$nomoi_en[$i]."/subdirectory"); // make subdirectory directory chmod("./dir/".$nomoi_en[$i]."/subdirectory",0777); write("./dir/".$nomoi_en[$i]."/subdirectory", index_mere($nomoi_en[$i],$nomoi_el[$i],$i+1)); // write info for the subdirectory copyindexsubdirectory("./dir/".$nomoi_en[$i]."/subdirectory"); // copy index for subdirectory } echo 'Done! Check it out'; ?> </body> </html>
  12. Alright i want to make Greek Greeglish i mean make Greek string to LAtin characters. (Sorry for the title of the thread i was more than confused)
  13. with firefox The file makes a lot of work creates directories,files and stores to mysql data i have changed all the server (./opt/server) to 777 permission except phpmyadmin maybe this is the problem could you please guide me?
  14. I am noob on linux and i try to make a script. I have a server installed with xampp the xampp php scripts runs well but mine when i execute it, it request linux to open it with bluefish which i am writting the code?? Could any guy explain me? Thanks
  15. I need to convert all characters from Greek to English taken from a string. I have no idea! Any help? I found the VB code which is : Chr(Asc(Mid(str, i + 1, 1)) - 127)
  16. Great with your guidenes i found this s encodeURIComponent(html) which is for UTF-8. Thank you
  17. The problem now is that it doesnt parse utf-8 characters (Greek)
  18. If you dont want to involve with loops and checks you can have : <table> <tr> <td><table><tr><td>1</td><td>2</td></tr></table></td> <td><table><tr><td>3</td></tr></table></td> </tr> </table> i dont know what you need but my idea is to put a base table with the players and show them into a seperate table inside.
  19. Hi! I am posting html source through POST with ajax. But when into the source i post appears the symbol & it recognize it as variable separator and doesnt load all the html source. ajax : function preview(){ var http = new XMLHttpRequest(); var url = 'preview.php'; var html = document.getElementById('html_source').value; var params = 'html='+html; http.open("POST", url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", params.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = function() { if(http.readyState == 4 && http.status == 200) { Shadowbox.open({ content: 'temp/preview.htm', player: 'iframe', title: 'Preview', height: 600, width: 800, options: {} }); }; } http.send(params); } If it finds & it load all the string after as another variable. I think this is generic problem. Is there any solution? Thank you
  20. MrAdam thank you, and thank you for the correction , now its perfect. I always called regex as php magic, today i learned that is called regex! I am very interesting to learn it and i am very curious of it. It seems to me that is a program language inside php. Do you have in mind any php book bible that has even regex in it?
  21. Great, i have read how to post a question in Regex forum so : What i want is to load the page from another directory than pages directory this needs the src's to be src="http://domain.com/page.htm" and not src="page.htm" . I have a string with an html page in it and a string with the sites domain. So i want to change every src into the page that it doesnt include domain with the http://domain+page. Thank you
×
×
  • 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.