php

Adding functionality to a custom tinymce button

I Have created custom tinymce button using the code setup : function(ed) { ed.addButton('Tittle', { title : 'Tittle', image : './images/T.jpg', onclick : function() { ed.focus(); ed.selection.setContent('<tittle>' + ed.selection.getContent() + '</tittle>'); } }); }); When i click ...

PHPMailer with gmail (can i send emails from [email protected])

Quick question. I have a gmail account ie/ [email protected] i have associated my website email to it ie/ [email protected] Is it possible to use PHPMailer to send email via gmail (for reliability, less likely to get flagged as spam etc..) but have "[email protected]" as my sent email??? I'm using the code found here: http...

implementation of relations between classes in oop php

I am new in PHP with classes. I am coding an network ip-mac-user logging system integrated with dhcp. I have users, subnets, units. I created classes for each and created parameters and functions to fill the parameters and some mysql codes about what they do. but there are relationships among these classes. where can I put these relation...

How can I delete the contents of a folder with PHP?

I can't seem to get this function to delete all my files and folders in a specific directory can someone help me fix this problem? Here is my code. $apps = 9; $dirname = './members/' . $apps . '/'; function delete_directory($dirname) { if (is_dir($dirname)) $dir_handle = opendir($dirname); if (!$dir_handle) return fal...

Parsing HTML to return CSS rules from ids and classes attributes with PHP

Hi, I hate to have to write down a lot of CSS rules and then enter my styles in it, so I'd like to develop a tiny php script that would parse the HTML I'd pass to it and then return empty CSS rules. I decided to use PHP's DomDocument. The question is: How could I loop through the whole structure? (I saw that for example DomDocument on...

How to self-initialize Doctrine_Record (as if Doctrine_Query would)?

Hi, I have models that extend Doctrine_Record, and are directly mapped to one specific record from the database (that is, one record with given a given id, hardcoded statically in the class). Now, I want the specific record class to initialize itself as if Doctrine_Query would. So, this would be the normal procedure: $query = new Doct...

Statistical analysis for PHP

I am trying to write a reporting system for a project I'm working on that analyzes people's pre and post test scores and does some analysis on it. I have searched to the best of my ability, but cannot find a PHP Class / set of functions that seems to do the analysis I need. Currently, I am dumping the dataset to a CSV, and one of my co...

There is no return value from ldap_connect() php

Hello, Currently, I'm working on PHP web application on wamp environment. I'm quite new with ldap and right now, I have a pretty simple problem about it. After I enabled LDAP support in PHP. I have tried to call ldap function with the following code: <?php // LDAP variables $ldaphost = "ldap.example.com"; // your ldap servers $ldap...

Multiuser web-based calendar based on php, mysql, javascript

Hi there, I'm searching for a multiuser web-based calendar system that supports multiple users. I'm looking for these features: Multiple users Two user groups: First group is allowed to see events, the second group can create and edit events The events should be stored in a mysql database or a file The system has to be (very) easy to ...

Cookies & mulitple domains with PHP

Hey, I have a website which creates a cookie and I want to use this cookie in my application on Facebook. is it possible? if not, any idea how to recieve information from my website and pass it to Facebook? Thank you. ...

PHP Function with Optional Parameters

I've written a PHP function that can accepts 10 parameters, but only 2 are required. Sometimes, I want to define the eighth parameter, but I don't want to type in empty strings for each of the parameters until I reach the eighth. One idea I had was to pass an abstracted function with an array of parameters which passes it along to the r...

How to do a jQuery $.ajax or $.get request on a distant/other server? No Json or JSONP

Hello there, I'm working on a little widget that will allow to embed like an iframe (but with a jQuery plugin) a part of my website. I've successfully made a search.php API that produces in JSONP what I need to retrieve. It works! (thx to this community ;) ). I had difficulties to understand and use right callback request to allow a di...

Mysql Multiple querys

im currently running multiple mysql querys but want to just run one and loop through it. how can i improve this $query = mysql_query("SELECT productid, code, size, quantity, sizechart, rprice, price, weight FROM inventory WHERE code = '$productcode1'"); while ($rows1 = mysql_fetch_array($query)) { $productids1 = $rows1['productid']...

try to make a control page

I need some help to build a control page using php & mysql edit - update - delete - insert data anyone can help me in that? ...

PHPUnit configuration (phpunit.xml) -- loading in a bootstrap?

Situation We're using PHPUnit in our project and are using a phpunit.xml to ensure things like backupGlobals is turned off. To further ensure the include path is set and autoloading is active, we also cascade our test bootstraps. That is to say, every test and alltests-suite has a require_once(__DIR__ . '/../bootstrap.php'); at the top...

shell_exec slow with php

Hi all I have a curl script multi that helps index my site every 10 minutes it pushes to a mysql db so I can search my site for users The script uses 2 MB per instance (which isn't bad) however every time I run the script it slows apache down ( i have a UNIX server) so badly it takes 30 seconds to search... I keep the mysql db conn...

MySQL multi-server tasks fall-back mechanism

I have two web servers. Server 'A' and server 'B'. Both are exact duplicate of the other and are connected to a load-balancer for serving clients. I have a tasks (cronjob) that is executed at every hour, every day. This task is currently running only on server 'A'. The problem is that this tasks is really important and if server 'A' cra...

PHP & SQL: Best way to protect this query from SQL injections NOT using PDO

Hi, I have a query which is run against a mssql database and I'm not using PDO drivers. Is there something like prepared statement i can use? Here is the query: $tsql = "INSERT INTO cplinktable (liferayid, bmsid, autotaskid, waspdb, cpid) VALUES ($liferayid, $bmsid, $autotaskid, '$waspdb', $cpid)"; thanks, Jonesy ...

Zend Framework Widget Tutorial question

I try to follow this tutorial, but I can't get it to work: http://weierophinney.net/matthew/archives/246-Using-Action-Helpers-To-Implement-Re-Usable-Widgets.html I did everything as described, but I don't know how to make it available in my controllers. My filesystem looks like this: - application - controllers - IndexCont...

How to have PHPUnit do something if an assertion fails

I'm testing that a function properly adds data to a db, but I want the test data removed after the test is finished. If the test fails, it quits at the failure and never gets the chance to delete the test rows. It's the only test that hits the db, so I don't really want to do anything in the tearDown() method. I'm testing an $obj->sav...