php

when to choose ASP.NET and When PHP?

I am not here to add another subjective question. I know that many developers are using only ASP.NET and others Only PHP...... in my case where my team uses both, of course more advanced in one, I like to know the keys to choose one ? can you guys list all the Pros, and cons for those language? I know both are good, Dont be BIASED. ...

Using PHP, Kohana 3, and the Auth module, how to structure database for additional user info beyond username, email and password.

I'm building the next Facebook!! No, kidding. I'm building a simple site to help me learn. It will allow users to log in with an email and password. There will be other information collected from the user that is pertinent to the sites functions. Using the supplied Kohana Auth module, should I store the separate data in another table...

How can I create a Crypt::RSA object from modulus, exponent, and private exponent?

I'm trying to port the following php functionality over to perl: public function loadKey($mod, $exp, $type = 'public') { $rsa = new Crypt_RSA(); $rsa->signatureMode = CRYPT_RSA_SIGNATURE_PKCS1; $rsa->setHash('sha256'); $rsa->modulus = new Math_BigInteger(Magicsig::base64_url_decode($mod), 256); $rsa->k = strlen($rsa-...

Strange PHP that has got me stumped.

I'm looking at this code and thinking I can't see the error because there is somethign wrong but I just can't see it... I'm hoping someone here can see it as staring at it for the last half an hour hasn't made it clear to me. The code: if (!empty($_SESSION['email_notifications'])) { print '<br>SESSION[email_notifications] = ['.$_SE...

how to send emails via cron job usng php mysql.

hi, i managed to send multiple emails (check here).i am stuck with sending automated emails via cron. This is what i need - while the admin send emails, i store the message, emails, event date in the database. now i am trying to set a cron job to send emails to all these ids from the table with the message i have as a reminder. i am ...

Using cookies with php

I'm just trying to set and use a cookie but I can't seem to store anything. On login, I use: setcookie("username", $user); But, when I use Firefox and the Web Developer plugin Cookies -> View Cookie Information There is no username cookie. Also, when I try to access the value from a subsequent page using $_COOKIE["username"] It is...

Does the spiders indexing your website (google bot...) have a "culture" ?

Hello, This is a SEO question : i've the choice to display a page's title according to the culture of the visitor. If it's an english : <title> <?php if ($sf_user->getCulture() == 'en') : ?> Hello, this is an english website <?php else ?> Bonjour, ceci est un site français <?php endif ?> </title> Does the bots/spid...

How to skip view/layout in a zf controller.

I am making a controller that will be responsible for a bunch of actions and I don't want to have to create a view file for each one, sometimes i just want to output strings. I could just do echo 'Hello World'; die(); into the action. but is there a more correct way to do this? ...

How to configure PHP apc so that caching is done automatically?

When we include($file) ,caching is done internally,automatically. How to achieve that? ...

PHP UTF-encoded URL-string

When I type in Firefox (in the address line) URL like http://www.example.com/?query=Траливали, it is automatically encoded to http://www.example.com/?query=%D2%F0%E0%EB%E8%E2%E0%EB%E8. But URL like http://www.example.com/#ajax_call?query=Траливали is not converted. Other browsers such as IE8 do not convert query at all. The question i...

Zend lucene : Multiple criteria on search = bad results

Hello, I new to lucene, and i noticed something annoying : In my search bar, if I type "USA" : return all the matches -> OK. If I type "Developper" : return all the matches -> OK BUT, -if i type "USA Developper", it'll not return me all the developper in the USA. It'll return me some developper in UK, DE, FR + Developpers, Sta...

multi-array search query with delimited field

I have a array which store some country names im doing a search module and i wanna to find the db records whether contain the country names or not but since db design problem , those record can own mutil counties and store the countries by delimiter "|" below is a example input: array("Cyprus","Austria") // note that the max input ...

Compile PHP into Java?

...like GWT, but PHP as output (instead of Javascript) So I can code in java while the webserver executes PHP. -- I don't want to mix Java with PHP. In runtime there will be only PHP, but at compile time there should be only Java. It is like GWT does. it takes java and converts it as Javascript for the browser. This is just to take ...

Views or Organic Groups for this use-case

This is related to another question that I asked before. I'm using views to present to the user a list of nodes. The user then has to pick their top 3 choices, which I then save to a sub-list that I need to remember to show to the user later. I was going to use Flags to mark the user's choices. I now realized that this isn't going to ...

php: readfile_chunked not flushing last 2830 bytes of 29353KB file

I am using a variation of the familiar readfile_chunked in attempt of download for larger files: function readfile_chunked($filename) { $chunk_size = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $handle = fopen($filename, 'rb'); if ($handle === false) { ...

regex breaking Chinese string

When i run this code and similar some Chinese the ni (你) character (maybe others) gets chopped of and broken. $sample = "你不喜欢 香蕉 吗"; $parts = preg_split("/[\s,]+/", $sample); var_dump($parts); //outputs array(4) { [0]=> string(2) "�" [1]=> string(9) "不喜欢" [2]=> string(6) "香蕉" [3]=> string(3) "吗" } //in 我觉得 你很 麻烦 //out ...

Please Specify the Correct Regular Expression

I wish to retrieve data between <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EBEBEB"> and </table> using Php.Can any one please specify me the correct regular expression for retrieving data between the given table tags ...

Solving Dual URL Problem..?

I am using cakephp I have 2 links: <a href="#" tabindex="1" onclick="base_load_demo1('http://www.boxyourtvtrial.com/widget/beer/main/');" >beer</a> <a href="#" tabindex="2" onclick="base_load_demo('http://www.boxyourtvtrial.com/widget/cocktail/main/');"&gt;cocktail&lt;/a&gt; With the following JavaScript: var Url1 = "http://www.boxyo...

Sounds stupid but... I need help setting a variable in PHP

I have a config class which gets used throughout my code. One variable within this class is the website URL. Recently, I added SSL to my server and now I need to check for this and assign either 'http' or 'https' as the protocol. The code I tried is: <?php class Test { public static $blah = (1 == 1) ? 'this' : 'or this'; } echo Te...

Regex: Match html tag only if it contains a specific class id

Match an html tag using perl regex in php. Want the tag to match if it contains "class=details" somewhere in the open tag. Wanting to match <table border="0" class="details"> not <table border="0"> Wrote this to match it: '#<table(.+?)class="details"(.+?)>#is' The <table(.+?) creates a problem since it matches the first table tag ...