Jump to content

PHPSpirit

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by PHPSpirit

  1. Try this code: index.php [code] <?php /* * Modules */ include("language.php"); $language = new language(); unset($language); ?> [/code] language.php [code] <?php class language {   function language()   {     if( isset($_GET['lang']) )     {       $lang = $_GET['lang'];       $lang = $this->set_language($lang);     }     elseif( isset($_COOKIE['lang']) )     {       $lang = $_COOKIE['lang'];     }     else     {       $lang = $this->set_language();     }     $this->load_language($lang);   }     function set_language($lang = "en")   {   switch($lang)   {   case "de": $lang = "de"; break;   case "en": $lang = "en"; break;   case "pl": $lang = "pl"; break;   default: $lang = "en";   }     setcookie("lang", $lang , 0);     return $lang;   }   function load_language($lang = "en")   {     //include_once("languages/" . $lang . ".inc");     echo "include: ".$lang;   } } ?> [/code]
  2. You need use a FILE PATH for outfile no URL. $export="SELECT * INTO OUTFILE '/home/user/spreadsheet.xls' FROM survery";
  3. Google and hotmail send your emails to spam, if the ip of the sender not equal to the MX of the domain.
  4. 1 .Yes. 2. Read this: http://www.php.net/manual/en/function.setcookie.php
  5. [quote author=christophe link=topic=116568.msg475026#msg475026 date=1164713206] Hi there, Right O.K I have this code [code] include_once("includes/config.php"); $query="SELECT letter,id,word,description FROM dictionary"; $result = mysql_query ($query); echo "<select name=word=''">Word</option>"; while($nt=mysql_fetch_array($result)){ echo "<option value=$nt[id]>$nt[word]</option>"; } echo "</select>"; ?> [/code] so my question: how do i make this script so when a user selects an option from the drop down box it pulls information from the description field in my database and displays this information on the same page? ive been stuck on this for ages now so any help will be much appreciated Thanks Alex [/quote] You need use AJAX. http://www.w3schools.com/ajax/default.asp
  6. [quote author=ali_kiyani link=topic=116557.msg474996#msg474996 date=1164701746] Hello, I have an application in PHP where users upload different files to server. Q1. Is there a way I can check those files for virus when user uploads? Q2. If a virus is found in some file, how can I display message to the user? Q3. Let's say if I have a dedicated server with antivirus installed, what do I need to do to integrate it with PHP? Q4. Can this be done on shared hosting environment? Thanks [/quote] A1. Yes, after the user upload. A2. Return a message: [code] echo "Go to hell !\n"; [/code] A3: You can use the command "system()" for execute commands lines and check the files, like this: [code] $check = system("antivirus file"); if($check ... [/code] A4: Yes.
  7. Nice code printf. There is other option with javascript: index.php [code] <?php   if( isset($_GET['var']) )     print_r( split(",", $_GET['var']) ); ?> <html> < script language="javascript"> function getInputsInOne(id) {   x = "";   e = document.getElementById(id).getElementsByTagName('input');   for(i in e)     if(e[i].checked) x+= e[i].value+",";   return x; } function getNewSubmitForm(){   var submitForm = document.createElement("FORM");   document.body.appendChild(submitForm);   submitForm.method = "GET";   return submitForm; } function createNewFormElement(inputForm, elementName, elementValue){   var newElement = document.createElement("input");   inputForm.appendChild(newElement);   newElement.name = elementName;   newElement.value = elementValue;   return newElement; } function createFormAndSubmit(id){   x = getInputsInOne(id);   var submitForm = getNewSubmitForm();   createNewFormElement(submitForm, "var", x);   submitForm.action= "index.php";   submitForm.submit(); } </script> <body> <div id="options"> <input type="checkbox" value="a" id="opt_0"> <input type="checkbox" value="b" id="opt_1"> <input type="checkbox" value="c" id="opt_2"> </div> <input type="button" value="Send" onclick="createFormAndSubmit('options')"> </body> </html> [/code] I take some code from: here http://experts.about.com/q/Javascript-1520/create-form-submit-fly.htm here http://www.codingforums.com/showthread.php?t=65531 here http://www.onlinetools.org/articles/unobtrusivejavascript/chapter2.html and here http://javascript.internet.com/buttons/check-all.html
  8. If your uploader use php you can implement a code, read this: http://php.net/function.mail
  9. Perhaps the account does not have the permissions, or the syntax is incorrect. Try this: [code] INSERT INTO `pms` (`subject`, `message`, `recipient`, `from`, `status`) VALUES('$subject','$recipient','$message','$from','unread');" [/code]
  10. Read the file "install.txt" in the directory of PHP, all information is there.
  11. In case that bandwith is entered on manual way, you can use this: [code] $timeseconds = (filesize("filename.zip")*8)/$bandwith; // bandwith always in bits echo $timeseconds; [/code]
  12. Put all your data in a database is the better way.
  13. JJ You need configure the apache (httpd.conf) for php. Open the file httpd.conf and finds these places: ... #LoadModule vhost_alias_module modules/mod_vhost_alias.so #LoadModule ssl_module modules/mod_ssl.so --> LoadModule php5_module php/sapi/php5apache2.dll <-- ... <IfModule mime_module>     --> AddType application/x-httpd-php .php <--     --> AddType application/x-httpd-php-source .phps <-- </IfModule> ...
  14. "pong"  :D Declare your database and remove the comments ( // ).
  15. Read this: http://www.php.net/features.file-upload
  16. Use the preg_match(); Read this: http://www.php.net/preg_match
  17. Use this to see the information of your file: print_r($_FILES); Maybe you can find the problem or perhaps you do not have permission to write in the directory.
  18. But the proble is this: [code] /a+ (.htaccess)   |   +-/a1+ (affect)   |      |    |      +-/a11 (affect)   |      +-/a2(affect) [/code] The htaccess affect all directories, I only need affect the directory "a". Is posible ?
  19. Take this: [code] <?php $string = "id=666 msg=getajob"; list($a0, $a1, $b0, $b1) = split("[ =]", $string); $$a0 = $a1; $$b0 = $b1; echo $id.": ".$msg; ?> [/code]
  20. Hi    ;D I have a htaccess with this code:  [code] AddType text/html .shtml AddHandler server-parsed .shtml [/code] The problem is the code affect all directories but I need only affect this directory. What can I do ?  ???
×
×
  • 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.