php

PHP Doctrine: Custom nested set?

Is it possible to have nested set capabilities in this somewhat custom setup? Consider these 4 tables: Object: (oid, name) contains: [1, 'Licence'] and [2, 'Exemption'] Licence: (lid, name) Exemption: (eid, name) Cost: (oid, oid_ref, cost_oid, cost_oid_ref) For: P = Licence with lid [1] R...

String Question. How to count the number of A,a, numeric and special char

I have randomly created strings such as H*P2[-%-3:5RW0j*;k52vedsSQ5{)ROkb]P/*DZTr*-UX4sp What I want to do is get a count of all Caps, lower case, numeric and special characters in each string as they are generated. I am looking for an output similar to Caps = 5 Lower = 3 numneric = 6 Special = 4 Fictitious values of course. I have...

sending email with PHP (preventing from being placed in spam folder)

hello, i am trying to send email using PHP scripts... however, the recipient is receiving it in his/her SPAM folder -this is not the desired result (I would like to have it sent directly to their inbox so that I don't have to warn them to look in their SPAM folder). below is the code I use to send the email using PEAR... what changes ca...

.htaccess twitter or facebook URL naming convention

For my Social Networking Site, I would like to build a facebook, or twitter similar URL rewriting naming convention. Using Twitter as an example, they have pages labeled twitter.com/about and another page labeled twitter.com/{$username} However, how do you differentiate between say a user who has registers on to our site as "about" the...

Moving from php4 to php5

I tried moving to php5, I am getting into lot of issues. This class gives error : Class DatabaseConnection { // error here private $connection; private $result; // public function __construct() { $this->databaseName = $GLOBALS['configuration']['db']; } // ot...

How does this Switch statement know which case to execute? (PHP/MySQL)

Here is a code form a PHP+MySQL book I am reading and I am having trouble understanding this code. This code is about checking a file uploaded into a database. (Please excuse any spelling errors if any, I was typing it in) Q1: How does it know which case to echo? In the whole code, there is no mention of each case. Q2: Why do they ski...

Decoding mysql_real_escape_string() for outputting HTML

I'm trying to protect myself from sql injection and am using: mysql_real_escape_string($string); When posting HTML it looks something like this: <span class="\&quot;className\&quot;"> <p class="\&quot;pClass\&quot;" id="\&quot;pId\&quot;"></p> </span> I'm not sure how many other variations real_escape_string adds so don't want to j...

Which PHP library I should choose to work with CouchDB?

I want to try playing with CouchDB for a new project I'm writing (as a hobby, not part of my job). I'm well versed in PHP, but I haven't programmed with CouchDB at all, and also I have little experience with non-SQL databases. From looking at CouchDB's "Getting Started with PHP" document they recommend using a third-party library or wri...

Plug and play login system?

Does anybody know of a plug-and-play login system that supports existing logins like Google and OpenID? I am looking to implement something similar to that of Stack Overflows. Thanks! RPX is indeed what I was looking for. Are there any other systems like RPX that do a similar thing? ...

Help securing files access with htaccess and php?

I'm working on a site that allows users to purchase digital content and have implemented a method that attempts to serve secure downloads. I'm using CodeIgniter to force downloads like this: $file = file_get_contents($path); force_download("my_file_name.zip", $file); Of course, I make sure the user has access to the file using a dat...

Script working with mysql and php into a textarea and back

I am trying to write a custom script that will keep a list of strings in a textarea. Each line of the textarea will be a row from a table. The problem I have is how to work the script to allow for adding, updating, or deleting rows based on a submit. So, for instance, I currently have 3 rows in the database: john sue mark I want to b...

Inserting an image into sqlserver gives an "operand type clash"

I'm trying to save an image in a sql server 2000 database. The data type of the column is image. I get the following error: Error: Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: text is incompatible with image, SQL state 22005 in SQLExecDirect in C...

What are the characteristics of spaghetti code?

Somebody said that when your PHP Code and application use global variable then it must be a spaghetti code (i assume this). I use wordpress a lot. As far as i know, it's the best thing near a great php software. And it use many global variables to interact between its components. but forget about that, cause frankly, that's the only th...

management users with Zend_Auth and Zend_Session

I want to Zend_Auth and Zend_Session to save user sessions and logins information whats the easy and best way for implements following items: 1-Disallow multiple concurrent logins for the specific user 2-List all of all user currently logged in 3-Admin could logout of specific user or destroy specific session Is there any special ...

Problem with displaying and downloading email attachments using the zend framework

Hi guys I'm trying to display emails in my inbox and their respective attachments. At the same time I also wish to be able to download the attachments however I'm kinda stuck here. Here is the code I use to display the attachments: $one_message = $mail->getMessage($i); $one_message->id = $i; $one_message->UID = $mail->getUniqueId($i); ...

Extending DOMDocument and DOMNode: problem with return object

I'm trying to extend the DOMDocument class so as to make XPath selections easier. I wrote this piece of code: class myDOMDocument extends DOMDocument { function selectNodes($xpath){ $oxpath = new DOMXPath($this); return $oxpath->query($xpath); } function selectSingleNode($xpath){ return $this->selectNodes($xpath)->item(...

how to avoid change in url address in rtl languages

hey guys im working on a task to make my story's links like this http://localhost/mycms/article/test/ i used : $mtitle = str_replace("\"", "'", $title); $slug_title = mysql_real_escape_string($mtitle); and a href link to show story's title in other php file i used two arrays as a moderator for google tab $urlin = array( "'(?...

Issue with my wordpress functions.php script

Hello peeps. Im having an issues when activating my theme in wordpress. I got this error message: Parse error: syntax error, unexpected $end in C:\xampp\htdocs\xampp\wordpress\wp-content\themes\xit\functions.php on line 223 Whats wrong, I totally dont understand. The script of the php is: <?php if ( function_exists('regis...

Facebook Connect - Mobile

I am currently in the process of creating a mobile version of my web app. The app is being developed with Facebook's PHP Client Library. The issue: I am using the following mobile url to allow users to log in using the mobile devices: http://m.facebook.com/tos.php?api_key=APIKEY&amp;v=1.0&amp;next=http%3A%2F%2Ftweelay.net%2Fm.php&amp;...

php form doesnt submit one of the fields

i have bought a template that have built in contact form problem is that it submits every thing except "company" name i messed around with it but cant get to work it. if you can point me to some solution i would be greatful thanks in advance this is php script if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b...