php

PHP: sorting array - list of ftp files?

hey guys, i'm connecting to a ftp-server and displaying all items in a list. i want that list to be ordered alphabetically. shouldn't that do it? // get contents of the current directory $contents = ftp_nlist($conn_id, $path); sort($contents); that's a part of the script! // get contents of the current directory $con...

Is there a way to generate database by writing PHP?

Is there a way to generate SQLite3 database by writing PHP with no SQL? Somewhat like django's models. ...

Why PHP function `curl_exec ` should be disabled?

As you know there's some php functions to be disabled on shared hosting environments. Searching the Google, I found many lists of these functions. one of these functions is curl_exec, I can't understand why this function should be disabled? How this function could be vulnerable? ...

php rest webservice

how can i get a xml file when i pass a parameterized url ...

How do you escape quotes in a sql query using php?

I have a query $sql ="SELECT CustomerID FROM tblCustomer WHERE EmailAddress = '".addslashes($_POST['username']) ."' AND Password = '".addslashes($_POST['password']) ."'"; // while printing, it will be SELECT CustomerID FROM tblCustomer WHERE EmailAddress = 'test@ab\'c.com' AND Password = '123' if we executing this in a mysql ser...

Code example, what can I write to impress employer?

I'm not a very creative guy. Often employers ask me to write some code and send it with CV. I know it's mainly to check how my code looks like but I also think that it is important what it is. Do you have any propositions? *This question is related with programming. Imagine that you are a person who check code attached with CV and tell ...

Wordpress get posted in category permalink

So each post it will be posted in one category, and for each post I want to get the posted in category permalink, only the URL without markup. How can I do that? //Explained again Well the post is posted in a category, right? Well I need to show that category, but not the name of the category, the url for that category. ...

php classes... validation

hi there im am making a php validation class with sub classes that extend it, eg, mobile, suburb, credit_card, ect so, the idea is you can call $validation = new Validation('mobile'); $valid = $validation->validate($number); $validation->type('suburb'); $valid2 = $validation->validate($suburb); now my idea for doing this is having ...

Displaying custom error page in PHP for errors which can't be caught by set_error_handler

I would like to be able to discard a partially rendered page and show an error page in PHP. I already know about set_error_handler(), but it can only trap certain types of errors. I would like to know how to show an error page when an error type which can't be trapped by set_error_handler() is raised. Unfortunately, it seems that the f...

PHP Checksum before include()

I've been working on an application that will allow for third-party extensions to be built to expand the application's functionality. All this in PHP, of course. I wanted to add a bit of security padding by running files in a certain directory through a checksum function. If the file doesn't pass the checksum, the file isn't "included", ...

PHP get Arabic Content from SQL SERVER

Hi, how can i get Arabic content when i run MSSQL_QUERY? it appears as ???? i tried to do this $res=mssql_query($q); $row=mssql_fetch_row($res) echo iconv("unicode","utf-8",$row[0]) but in this case it shows the value as Chinese letters as 潬穬 any suggestion is highly appreciated ...

Redirect in PHP

Hello, I have a typical mail.php script, which uses the mail() function. After the user inputs information into a typical HTML form, I have the mail() function send the email to the desired email [with mail($email_of_client) etc etc] My question is this: After the email sends, I want the user to be redirected to a ThankYou page (run u...

Fatal error: Cannot redeclare class ProjectConfiguration

Hi, I am trying to clear the cache using command 'php symfony cc' but getting " Fatal error: Cannot redeclare class ProjectConfiguration in /home/dev/project/devz/config/ProjectConfiguration.class.php on line 46 ". Please help me on this. Thanks in advance ...

how to do multiple row edit using jquery + php?

i want to do multiple edit of rows in table using jquery and php ...

php timestamp not logical?

Hi, I loop through an array looking at the date (as key) and if it is before the event date I use the rating value (as value). Basically I'm looking for the closest value in the array before the event date. My code: $ratingData = $player->ratingData; foreach ($ratingData as $ratingDate => $ratingValue) { list($year, $month, $day) =...

Email address validation methods (Subscribe button)

I am coding a site in php and I am currently on the contact us page and I was wondering what was the best way to validate an email address? By sending a validation link to their email? Regex Any other method? Also could you tell me why and a guide along my way to achieving it? I dont want someone to do the code for me because thats n...

php, get some code from text

Hi, how from this text get WORD and WORD2. text tex asad t text [mycode]WORD[/mycode] tex asda [mycode]WORD2[/mycode] asdasdasd I try using preg-match, but i fail ...

Shall I put contact information in a separate table?

I'm planning a database who has a couple of tables who contain plenty of address information, city, zip code, email address, phone #, fax #, and so on (about 11 columns worth of it), a table is an organizations table containing (up to) 2 addresses (legal contacts and contacts they should actually be used), plus every user has the same in...

Passing values to htaccess

i have a htaccess file for redirection the redirected content is RewriteCond %{REQUEST_FILENAME} -location&action=photos&page=$ RewriteRule ^(.*)$ /sitename/view.php?link=$1&action=photos&page=&1 [L,QSA] The page numer is dynamically passing from the page How we can get the page number here pls helpme ...

Hebrew in SMS messages

Hi there, im using Voicetrading to send SMSs via a custom application ive built, english is great, but when it comes to hebrew, i get blank messages. I use this code: $ch = curl_init($smsRequest); curl_setopt($ch, CURLOPT_URL, $smsRequest); curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: application/x-www-form-urlencod...