php5

PHP config quark with if statements.

Ok this is weird on my development server if I am running a test on a script and shorthand a if statement like so: if($_GET['cat']){ ... Instead of a more pragmatic way like so: if(isset($_GET['cat'])){ ... I will get errors stating that Notice: Undefined variable: pwdmsg in C:\wamp\www\myfile\decrypt-text.php on line 16 ...

Event Registration

How can I create a site like http://www.eventbrite.com/ in drupal. If its not possible in drupal what should I probably use. More specifics -- Users can add their own events, add pricing. Out of that pricing the website can keep a certain % say 5%, when users purchase tickets. The commission can be on per event basis and cannot be ch...

OO PHP Class method renamed to variables?

Hello fellow PHP geeks, I'm sort of in a weird situation... One of which I've never come into before (It's maybe due to my break from PHP to .Net). Using the framework CodeIgniter. Well here's the situation... I've got a User class which acts as the user object containing username/password/email etc... (shown below): <?php if ( ! def...

Catch and log fatal errors, warnings, notices in Zend Framework

Currently I am using a basic error controller which looks like this: class ErrorController extends My_MyController { public function errorAction() { $errors = $this->_getParam('error_handler'); switch ($errors->type) { case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE: case Ze...

javascript redirecting to main window doesn't take into account http option (&)

hello, i'm triying to use javascript redirect to main window after log in succeed in an iframe. this is my code : if ($_GET['redirect']!='') { $redirect=$_GET['redirect']; $smart->assign('redirect',$redirect); } $redirect=$_GET['redirect']; echo $redirect; if(isset ($_SESSION['user'])&&$_SESSION['user']!='') { $user->...

Convert Object to String

Hello! I have an object which gets a String. I want to compare it with a String and I don't know how to do it. My source is something like it: $field = $this->form->getFieldset('profile'); $website = "Web site"; if ($field->label == $website){ echo "good"; }else{ echo "bad"; } ...

Efficient (PHP?) Filtering from MySQL with 3 Big tables

Hello all, I am working on a filtering section with "large" tables and performance (for SELECT) is of great concern. table_1 has 710,000 records and looks like this: (PK) game_id param_1 param_2 param_3 table_2 has 42,218,503 records and looks like this: (PK) set_id value_1 value_2 table_3 has 56,312,204 records and looks lik...

I have two values in an array when i execute the stored Procedure in php But iam returned wih one array value

$result = $mysql->callSP('STOREDPE1',$in); $arr_tmp=array(); foreach ($result['record'] as $rows) { echo "one value"; if(!empty($rows)){ echo "Two Value"; $arr_tmp[$rows['field1']] = $rows['field2']; } } return $arr_tmp; when i say var_dump($result)it has two values i...

Is regex a good way to test a url

I'm trying to test the validity of a url entered with php5. I thought of using regex, but assuming that it works correctly all the time, it only solves the problem of the url being syntactically valid. It doesn't tell me anything about the url being correct or working. I'm trying to find another solution to do both if possible. Or is i...

Can I change the accepted extensions by PHP?

I'd like to accept other type of files that contains PHP code. For example, it would be nice to read an .aspx file by PHP as if it were .php. Could it be possible? Thank you very much in advance ...

How to get an attribute with SimpleXML?

Hello, I'm using simplexml_load_file($path_xml_file), it works good! If I do print_r($xml) it prints: SimpleXMLElement Object ( [@attributes] => Array ( [Message] => Login Successful [Token] => 11111111111 [DataFormat] => CSV ) ) How Can I get "token" value? Thank you! ...

How to let Apache send 500 in case of PHP error?

Hi! I'm developing a PHP application that uses HTTP response codes for communication as well as response bodies. So this is a typical scenario in the PHP code: try { doSomething(); } catch(Exception $e) { header('HTTP/1.1 500 Internal Server Error'); } ... and the typical code in clients looks like: switch(re...

Is PHP classes an effective solution for listing content?

Hi there I would like to list my portfolio on our website, and I wrote a class, Client for setting and getting parameters about each client's basics, i.e.: the client's name, website, is it featured, is it published, what items did we do for them, etc. It's fairly primitive, but am I correct in assuming it's better to create an object ...

How to loop a SimpleXML object?

Hello everybody! I download a webpage with a XML code: $xml = simplexml_load_file($page); The results are: SimpleXMLElement Object ( [@attributes] => Array ( [Message] => Success [Date] => 0001-01-01T00:00:00 ) [FUNDAMENTALS] => SimpleXMLElement Object ( [FUNDAMEN...

How to get svn revision number using exec() and command in PHP?

Hello, I need svn revision number from PHP script. I have used the following commands with exec(). But it does not return any thing. $value = exec("usr/bin/svn --username myusername--password mypassword info /home/mysite/mysite_www/mysite |grep Revision: |cut -c11-", $output, $status); or $value = exec("svn info |grep Revision: |cu...

Choose & read file in PHP

Hi, In a form in PHP, I have a textarea and a Choose File option. The code for Choose File is as below <input name="upload_file" type="file" id="Browse" title="Browse" value="Browse" /> What I have to do is Choose a file and display its contents in the textarea, as soon as I select the file (No click event to happen). How can I go a...

display duplicate record

I have a table called problemTBL, which contains the fields below problem_id Autoincrement,Pk passenger_id, accept duplicate values problem_name, problem description These are sample records: Problem_id passenger_id problem_name 1 22 NO Air condition 2 22 Dirty Seats 3 24 ...

PHP Page forced download IN ERROR

This is a strange problem but it happens enough that I wanted to ask. For some reason, sometimes the browser will force a php page to download to the browser and it always comes up with 0 bytes. Mind you, I'm not trying to force the download and I'm very familiar with headers and forcing files to download intentionally, what I'm talkin...

PHP DOTNET(): Capturing System.Windows.Forms control events to create a usable WIN gui

I made a Windows GUI through PHP's DOTNET class and System.Windows.Forms. But, I'm stuck on handling button clicks, field updates, form open/close events, etc. I cannot get com_event_sink() working with any events whatsoever. I know of no method to get PHP to fake or sink control event "delegates". The best I can do is hackish - cons...

Best DB abstraction class for PHP

I'd like to start building my own framework. Everything is fine, but I can't build the most important part (from my point of view): DB controller. I've seen so many project codes and some uses ADOdb, others have built its own. I don't want compatibility, just an easy class that obviously filters SQL injections but also allows the user t...