Jump to content

php_guest

Members
  • Posts

    98
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

php_guest's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi everybody, I am wondering if there exist any good compiler or something like that to write code for mobile phones. Is it possible to write a good mobile application with php? Any helpful information will be great. tnx
  2. You mean filter_input_array()? Because if not, than won't solve my problem which is how to pass $method
  3. tnx, but if(empty(${"_$var"}[trim($field)])){ doesn't work. Seems "_$var is not ok because if I put instead of $var a string "GET", than works.
  4. Hi everybody, I need some help about how to convert string to array name. I have the following function which pass $_REQUEST type as parameter. It is not working because I don't know how to convert $method to $_GET or $_POST in a proper way. Do anybody know how? function validateIfFilled($method, $fields) { $exploded=explode(",",$fields); foreach($exploded as $field){ if(empty($method[trim($field)])){ return false; } } return true; }; if(!validateIfFilled('$_GET', "email, password, address")) ... Thank you!
  5. but without class, the only way to access $db object inside function is to use global $db every time in each function, right?
  6. I use $db object to handle database function like $db->get_row for example. Is there any way that I don't need to put into every function global $db or do I actually need to repeat in every function global $db? function example(){ global $db //Do I need to repeat this in each function? }
  7. I have mysql but the question is not how to store variables but how to print them. So to print as option a) as whole html or as b) as closing and opening for each translation php. Regarding JSON, is there any other option since I am not familiar with JSON?
  8. I am developing a multilingual site. I use array to save translations in one file which I include it inside settings.php. //Example of english $LANG['welcome']="Welcome"; $LANG['status']="Status"; I am wondering about two things: 1. How would be the best option to print those arrays? a) Echo all html and inside html I use echo " <body> <div> <p>{$LANG['welcome']}</p> </div> "; b) Close php and write html and inside html I open and close php for each time <div><p><?php echo $LANG['welcome']; ?></p></div> Each one has own downsides. Option a) spends extra resources to print html. Option b) spends extra resources to close and open php each time (could means that single script needs to open and close php even 30 times per script). Is that bad or is the ammount of resources spend for this negligible? 2. Also how do you translate words inside javascript? I was thinking to put all translation that are need for javascript into $LANG['js'] array. Then I would use at the head of the script foreach $LANG['js'] to print html to assign javascript language variables. <script type="javascript"> <?php foreach($LANG['js'] as $keyword => $translation){ echo "var ".$keyword."= ".$translation.";\n"; } ?> </script> Is there any better way? Thank you!
  9. I have a business social network site on hosting server. I am wondering if sessions are enough secure. ini_set('session.use_only_cookies', 1); //this prevent Session Fixation? session_start(); if($_SESSION['loggedIn'] && $_SESSION['userIP']==$_SERVER["REMOTE_ADDR"]) // extra security //user is logged in, assign all data to this profile from session else //user is not logged in, no data are assigned Would you consider that as enough secure?
  10. But in which way are not the same? With values beeing $var=""; $var=0; $var=false; $var="0"; $var=1; $var="string" the following statements output the same if($var)... if(!empty($var))... So in which example would they output different?
  11. Is if($variable) the same as if(!empty($variable)), just different syntax?
  12. I am wondering how Back, Forward browser button works for iframes. Does it bring back/forward iframe or top window? I remember I had before a problem because I wanted to bring back iframe and not top window as it did. But today I tested my Facebook app and was surprised to see it works as I need which means it brings back/forward iframe window and not top. Is it possible that Facebook has some javascript code which does that or is this normall behaviour? Thank you
  13. I am wondering if zend framework is used also in the biggest companies. Is comes to be helpfull or is it more professional to use own framework?
  14. I tried now to use RewriteRule ^/?(.*)/([-a-zA-Z_&0-9&,!]+)$ /article.php?url=$1 [L] www.domainname.com/الشباكيةالمغربية/articleId (articleid as number) instead of www.domainname.com/الشباكيةمربية This is a bit closer and works, but I need then to include article id in url. Than I tried also www.domainname.com/الشباكيةالمغربية/ (no need to include articleId, just /) RewriteRule ^/?(.*)/(.*)$ /article.php?url=$1 [L] which is the nearest solution. This also display a page without error, excepting css (I don't know why). Anyway I am not enough familier to replace second .* with a rule nothing but just /. I hope anybody can help with this. Tnx a lot!
×
×
  • 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.