Is strcmp() appropriate for comparing ICU collator sort keys in PHP?
The sort keys I'm asking about are from collator_get_sort_key() which are described in ICU documentation.
I want to create my own RSS/XML feed. I fetch data from the database to display, but keep getting invalid character errors. If the string has an ampersand or other strange characters in it, the XML will be invalid.
I tried using urlencode and htmlentities, but these don't capture all possible characters which need to be escaped. Does anyone know of a PHP function which will prepare a string for XML output?
I'm using PHP 5.2.11. I've seen that 5.3 version has several backward incompatibility issues and because of that some code might require changes.
Since my website is hosted on shared server, many have suggested that those server won't upgrade to 5.3 in near future (probably due to incompatibility issues for many shared users).
Would it be wise to develop a new project in 5.3 which would be hosted on shared server?
How can I encode strings on UTF-16BE format in PHP? For "Demo Message!!!" the encoded string should be '00440065006D006F0020004D00650073007300610067006'. Also, I need to encode Arabic characters to this format.
I can't seem to get the correct Unix epoch time out of this PHP DateTime object.
$startingDateTime = "2005/08/15 1:52:01 am";
$foo = new DateTime($startingDateTime, new DateTimeZone("America/New_York"));
echo $foo-format('U');
which gives
1124085121
Which is Mon, 15 Aug 2005 00:52:01 GMT -500 (according to http://www.epochconverter.com/) but that's incorrect by an hour.
It SHOULD be 1124088721 and spit back at me as Mon, 15 Aug 2005 01:52:01 GMT -500
Any help would be appreciated.
I have always been confused that .e,g in php i have sql statement
$qry = "select * from table where id = $id";
now can i insert "$" directly inside the quotes or i have to use
$qry = "select * from table where id =".$id." ";
or
$qry = 'select * from table where id = $id';
or
$qry = 'select * from table where id = '$id'';
Which is correct
Hi there just wondering;
How do i deny direct access to files in a specific folder. I have an upload script that uploads to /uploadedFiles and currently i just have an index.php which redirects the user to the login page however how do i stop users from accessing a file directly such as;
www.myurl.com/uploadedFiles/thisFile.jpeg
Thanks in advance :)
Hello,
I have:
$page_file_temp = $_SERVER["PHP_SELF"];
which will output: /templates/somename/index.php
I want to extract from that path only "/templates/somename/"
How can I do it?
Thanks!
I'd like to "grab" a few hundred urls from a few hundred html pages.
Pattern:
<h2><a href="http://www.the.url.might.be.long/urls.asp?urlid=1" target="_blank">The Website</a></h2>
i'm developing an iPhone app which communicates with a remote DB.
for that purpose I'm looking for a web hosting service which inclues the following specs:
latest PHP
cUrl
SSL support
mySql
cron
live support
Max uptime
great money per value ratio
The main functionality is communication with the DB and displaying some info on the app.
It is important that the web hosting provider will be highly reliable.
Are there any providers who give some free usage before starting to pay?
Thanks
Hello,
I want to be able to read any random RSS/ATOM XML file. That would mean I would not not know the tags, start the loop and the fields. How do I go about doing it in PHP.
Thanks
Jean
I have a database online that I would like to be able to load into an NSArray in my app. I can use arrayWithContentsOfURL with a static file, but I really need to go to a url that generates a plist file from the database and loading it into the array. I can use ASP or PHP. I tried setting the response type to "text/xml", but that doesn't help.
Any thoughts?
I'm looking for a PHP CMS which can let me to:
1-Uploade and manage files ( pdf, words..) between users by allowing to view, to print or to download.
2-Know who accessed what and when, who download what and when... who do what and when.
Hello,
I'm still quite new to CodeIgniter and I was wondering, where should I place my PHP functions that has nothing to do with Controllers and Views, for example, a function that access a local file.
Thank you.
I have two Fedora-based apache webservers making the same SSL PUT/POST calls with php/cURL. One works fine, but with the other the call succeeds but takes a VERY long time to return a response (~10 min). (GETs don't seem affected)
The working server's cURL uses OpenSSL for SSL, while the non-working version uses a later version of cURL that uses NSS for SSL
I know nothing about SSL implementations or their effect on cURL. What would cause such a significant delay in SSL PUT/POST responses?
Any suggestions appreciated- Thanks--
I've been using CodeIgniter for some quite time, and I've been extremely happy with its Active Record stuff. It's great to query the database with it.
Recently I've started a new project and I can't use such a framework anymore.
Is there a simple PHP Active Record library that does its job and gets out of the way (similar to CodeIgniter's version)?
I have looked over the PHP list of supported timezones, but the whole list is a little long to include in a drop-down menu, for the user to select his or her timezone. Is there a list with the main city/area on that can be used?
My geography is terrible and add that to not knowing all the area and which timezone they fall into it could be a long day to construct the list my self!
Thanks in advance
I need a regular expression which replaces a string like this
"Myname _MySurename" with "Myname"
that means i just need Myname, so _MySurename should be cut.
i tryed something like "/_*/" but that replaces just the _ (underscore)
how can i do that in PHP ?
And from the client side, which request type (GET or POST) is better to use, to send JSON data if I use XmlHTTPRequest?
My application use this stream of data for either retrive data form database and execute some functionality in PHP.
hi
is there any php classes or functions, which will gives us all the days from specific duration? for example, if i want a list of dates from 25/03/2010 (25th march 2010) to 15/05/2010 (15th May 2010), it will give me:
25/03/2010
26/03/2010
26/03/2010
....
....
....
14/05/2010
15/05/2010
thanks a lot for any help!
I would like a php framework that:
Is simple and lightweight
It work in shared hosting (free hosting)
I'll be nice if it saves the preferred language using cookies (not necessary)
I'll be nicer if it detects user's preferred language from the browser (not necessary)
I want to build a page that displays 3 different languages. I came out with a mini localization framework but I think is kinda buggy.
Any suggestions?
Ok I wrote my own version of SALT I call it salty lol don't make fun of me.. Anyway the registration part of my script as follows is working 100% correctly.
//generate SALTY my own version of SALT and I likes me salt.. lol
function rand_string( $length ) {
$chars = "ABCDEFGHIJKLMNOPQRSTUWXYZabcdefghijklmnopqrstuwxyz1234567890";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
$salty = rand_string( 256 );
//generate my extra salty pw
$password = crypt('password');
$hash = $password . $salty;
$newpass = $hash;
//insert the data in the database
include ('../../scripts/dbconnect.php');
//Update db record with my salty pw ;)
// TESTED WITH AND WITHOUT SALTY
//HENCE $password and $newpass
mysql_query("UPDATE `Register` SET `Password` = '$password' WHERE `emailinput` = '$email'");
mysql_close($connect);
However my LOGIN script is failing. I have it setup to TEST and echo if its login or not. It always returns FAILED. I entered the DB and changed the crypted salty pw to "TEST" and I got a SUCCESS. So my problem is somewhere in this LOGIN script I assume. Now I am not sure how to implement my $Salty in this. But also be advised that even without SALTY (just using crypt to store my pass) - I was still unable to perform a login successfully. And if you're gonna suggest i use blowfish - note that my webhost doesn't have it supported and i don't know how to install it.
here's my login script:
if (isset($_POST['formsubmitted']))
{
include ('../../scripts/dbconnect.php');
$username = mysql_real_escape_string($_POST['username']);
$password = crypt(mysql_real_escape_string($_POST['password']));
$qry = "SELECT ID FROM Register WHERE emailinput='$username' AND Password='$password'";
$result = mysql_query($qry);
if(mysql_num_rows($result) > 0)
{
echo 'SUCCESS';
//START SESSION
}
else
{
echo 'FAILED';
//YOU ARE NOT LOGGED IN
}
}
So what's wrong with this login? Why isn't it working just using the crypt/storing only crypt?
How can i make it work storing both the crypt and randomly generated SALTY :) ?
Ty advance
I need to remove the '&' character from each property of a php object
I tried the code below but it's not working...what am I missing?
thanks dudes
foreach($query_item as $key => $value)
{
$key = str_replace(' & ',' & ',$value);
}