Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by etrader

  1. I meant that if someone access the php file directly, he can post spam automatically (whether logged or guest visitor). This is the security issue I can see; otherwise, it is a simple form. What else can be its security risk?
  2. Since I use jQuery for some function; the method seems to be practical. However, I did not get your point about security. This is a simple script and I think there is less space for security holes. Could you please give me some tips to check security issues?
  3. Thanks for your attention. There are two issues: 1. Some features are available to all visitors and I cannot limit by login 2. My concern is about security issue. If it is for posting something on the website. Even logged users can abuse the system to post something by direct access to the php file.
  4. I want to perform a php process initiated by AJAX according to the method described in http://www.w3schools.com/PHP/php_ajax_database.asp with this line xmlhttp.open("GET","getuser.php?q="+str,true); the php process in getuser.php is initiated. But how I can restrict direct access to getuser.php? If someone visit getuser.php?q=something; the process will be started for "something". I want to run the getuser.php process only and only when it is initiated from my main page.
  5. Thanks Nightslyr! You are an excellent teacher and I learned a lot. However, it did not resolve my issue. In this case, I need to include $q in $arr() within the text. I try to keep the format of $arr('some words'). I was looking for a trip to bring the string ($q) into the function; but it seems it is not possible. Maybe it is better to put three functions within the switch cases.
  6. Thanks phpSensei, but switch in your code works with $word not $q I want to switch based on the value of $q The problem is that $q is meaningless within function
  7. I get $q by $q = $_GET['q']; but I am looking for a way to bring it into the function to make the switch based on the value of $q
  8. I use $word. Actually, the array file has a structure of $term = array( "word1" => "modern1", "word2" => "modern2" ); and function will be function arr($word) { switch($q) { case 'modern': include('modern.php'); break; case 'classic': include('classic.php'); break; } echo $term[$word]; } I want to use arra('something') in the text by reading corresponding array file depending on the value of $q.
  9. Let me clarify what I need <?php $q = $_GET['q']; function arr($word) { switch($q) { case 'modern': include('modern.php'); break; case 'classic': include('classic.php'); break; } } arr($word); ?> My problem is how to make switch for $q inside a function for $word.
  10. Yes, but how I can bring $q which is a string into a function. My main problem is that. How to use $q inside function.
  11. Sorry, but it did not resolve the issue. You defined the case by "something", but I want to define it by $q. For example, $q can be "modern" or "classic"; I want to include modern.php or classic.php Indeed, my problem is how to bring $q into the function.
  12. EXACTLY! I was thinking of switch but I was not sure if I can use it within a function. Thanks a million
  13. Thanks, but I do not want to add the second variable into the function, since the function is widely used in the text. I get the string from url as $q=$_GET[[$q]; now I want to include a given file for each value of $q. The text frequently contains $arr('something'). I want to display different message by $arr('something') depending on the value of $q.
  14. I have a simple function reading a two-component array as function arr($word) { include 'array1.php"; echo $something[$word]; } How I can make a condition for this function to load different array files as array1.php or array2.php or array3.php. The name of file comes from a string.
  15. As a matter of fact, perfect solution
  16. Sounds great. I thought that __() only works for mo files as php has a function to get it. However, I did not get your solution echo __('en.welcome_text'); How it can recognize to look into $lang array ?
  17. Thanks, it seems to be a perfect solution. I can call the translations by $lang['word'] BUT how I can write a function to return (or echo) based on this scheme. I mean function language($word) { echo $lang[$word]; } then using language('word') for displaying the translation.
  18. You mean using func_get_arg()? but how I can bring a value from outside the function into it ?
  19. I want to introduce some variable into Wordpress functions, but it does not work when defining the string outside the function. Consider this example function: function bbp_get_topic_edit_link( $args = '' ) { $defaults = array ( 'id' => 0, 'link_before' => '', 'link_after' => '', 'edit_text' => __( 'Edit', 'bbpress' ) ); This does not work when I introduce a string as (when string to replace "edit" with "something") $str="SOMETHING"; function bbp_get_topic_edit_link( $args = '' ) { $defaults = array ( 'id' => 0, 'link_before' => '', 'link_after' => '', 'edit_text' => $str ); But it works when introducing the string within the function as function bbp_get_topic_edit_link( $args = '' ) { $str="SOMETHING"; $defaults = array ( 'id' => 0, 'link_before' => '', 'link_after' => '', 'edit_text' => $str ); How I can make my strings active within functions? I want to store all strings within a reference file and the include it in each page (or through header).
  20. I want to create a multi-language website. For translating the terms, I have two options. For using define() for each sentence; e.g. DEFINE('WORD1', 'word1 in German'); DEFINE('WORD2', 'word2 in German'); ...... and include this php language file. Another option which is more standard is to create a mo file and call it by php. I prefer the first method as everything is just based on php; but I doubt if it is the best way for a website with 1000+ sentences. Any idea?
  21. I want to capitalized the first words in a sentence. This is fairly done by ucwords() but it will consider words after a space. I have a string with the form of $str="word1-word2_word3"; how I capitize it to $str="Word1-Word2_Word3"; ?
  22. There are some indirect download links (e.g. in download.cnet.com), as when clickingon domain.com/download?startdownload; it will start to download a file from domain.com/files/something.zip How to get the actuall download link (the second one) with php and curl? I think it is part of main features of cURL, but I have no idea how to do so. Thanks
  23. No, I cannot run rar_open(), but I can unrar in php by this command $string='unrar e -y /path/to/file'; exec($string); My issue is that I am looking for a way to put the name of rar file in the unrared files. For example: file.rar containing ebooks; I want to unrar it to file-ebook1.pdf file-ebook2.pdf ....
  24. I am on Ubuntu server and have installed unrar-free. In SSH I can successfully unrar with commands like $ unrar e file.rar but how I can unrar in php? DO need to install unrar for php? because I was not able to run commands introduce in php.net
  • 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.