php

Updating an array before MySQL insert?

Hi, I'm receiving an XML via php://input and after using simpleXML to break the elements down into variables and then what I want to do is append an array, or create an array of the variables every 30 seconds or so. The reason is this script will be getting regular inputs, and rather than doing loads of mySQL updates or inserts, I assu...

Can i get more variables instead of string in jquery $ajax?

I have this script: $.ajax({ url: 'submit_to_db.php', type: 'POST', data: 'name=' + name + '&email=' + email + '&comments=' + comments, success: function(result) { $('#response').remove(); $('#container').append('<p id="response">' + result + '</p>'); $('#loading').fadeOut(500, function() { $(this).remov...

What is the best way to structure a CRM system?

I've built a customer relationship management system in PHP which generates Quotes, Orders and Invoices and I am at a loss on the best way to structure the system. I currently have one table for each type (quote, order, invoice) and about 20 different pages for displaying the input forms and saving the data back to the database. This is...

error on using @fopen

I'm using @fopen to open a file in "rb" mode. the file that im opening here is running with no errors but if i open that file using @fopen then it is giving error. code is something like this--- $file = @fopen("xyz.com","rb") or $flag=1; if($flag==1) { mail($to, $subject, $message, $from); die(); } sometimes it opens up wit...

ServerSide Sessions safe?

I'm using (server side, not cookie) sessions in an application that I writing, if the users has not obtained access to the server can I trust the $_SESSION variable or should I verify it's content on every page load? Note: I'm trying to limit the number of queries to my database and currently I am verifying the data on every page load,...

Client's panel for my website.

As a freelance developer I deal with clients mostly by contacting them via email/im. That isn't working bad, but I'm thinking of a more professional approach with client communication panel for my website. Client basically will be given login/password and access it to see previews and comment them. I'm fine with writing the application ...

Warning on PHP fopen

$file = @fopen("http://ajax.htm","rb"); I am getting this error while using fopen Warning: fopen(xyz.htm): failed to open stream: HTTP request failed! in /home/user/public_html/aaa/ttt.php on line 8 what could be the reason behind this? ...

convert the following code in XML

I am getting the result in browser, but i need this output to be in xml format too. print "<h2>Search results for '".$_POST['keyword']."':</h2>\n"; for( $i = 1; $row = mysql_fetch_array($result); $i++ ) { print "$i. <a href='".$row['url']."'>".$row['url']."</a>\n"; print "(occurrences: ".$row['occurrences'].")<br><br>...

Retrieve Values From the Controller in JQuery

Hi, I m new to Jquery..How to retrieve the values from my controller and compare them with some String inside JQuery..Please suggest me.. $(".select"+increment).change(function () { if("here i need the value from my controller " =='String') { $("<label id=labelstr"+stringinc+" >"+labe...

Sorting JSON Output in PHP

I've got the following JSON: { "row": [ { "sort":3, "type":"fat", "widgets": [ {"values": [3,9] }, {"values": [8,4] } ] }, { "sort":2, "type":"three", "widgets": [ {"values": [3,4] }, {"values": [12,7] }, {"values": [12,7] } ] } ] } And this PHP to output it: foreach ( $value->row as $thero...

Make index.php behave as a directory...

Some sites (for example, certain implementations of mediawiki,) have a uri format of http://example.com/index.php/SOME_PAGE. How is this done? Is index.php just a directory on the server that happens to be named like a php file and that actually contains a file named SOME_PAGE? If so, why name it like that? If not (i.e. it actually...

jQuery - Reload table

I'm trying to reload a table which was also generated by PHP. The table has an ID: #bookmarks After the user pressed a button, the table should reload the content + the data they have just added. I'm a bit confused because I don't know how to send all of the data from a PHP result. Thanks, James ...

How to detect if the user is logout in php?

After the user successfully logged in, I store login = true in database. But how do I check if the user logged out by close the browser without click the logout button? And somemore, how do I redirect user who has been inactive for 10 minutes to login page? I am using php and mysql. Any help would be appreciated. EDIT: Sorry if my ques...

Get all modules, controllers and actions from a Zend Framework application

I want to create a Zend Controller for ACL management so my problem is: Howe can I get all Module names, Control names and Action names in a Zend application to build a ACL Control? I use Zend_Navigation and if the resource don't exist in your ACL Zend_Navigation is thrown a exception. And I want to use a database to deny and allow acce...

PHP: Tell if a file exists?

I need to be able to tell if an image exists in a directory or not. Given the file name and the directory, how can I tell if it exists? Thanks! ...

PHP 5.3 Magic Method __invoke

This topic expands on When do/should I use __construct(), __get(), __set(), and __call() in PHP? which talks about the __construct __get and __set magic methods. As of PHP 5.3 there is a new Magic Method called __invoke. The __invoke method is called when a script tries to call an object as a function. Now on research I have done for ...

Sending GET requests to POST based script?

I have a search feature on my site that's POST based. Now, however, I want to be able to provide links that search for certain keywords, but this isn't of course possible because the form doesn't handle GET requests. Is there a way around this? ...

How to base64-decode large files in PHP

Hi all, My PHP web application has an API that can recieve reasonably large files (up to 32 MB) which are base64 encoded. The goal is to write these files somewhere on my filesystem. Decoded of course. What would be the least resource intensive way of doing this? Edit: Recieving the files through an API means that I have a 32MB string ...

how to run php script in eclipse

I installed Eclipse PDT-all-in-one-win32-2.0.0GA and WampServer 2.0. I try to run as PHP Script in eclipse but I have this error: "The current debugger does not have any defined PHP executable." How do I create this .exe ?? ...

Is my method of auto-redirect-login page correct in PHP?

I have a community site where a user can have many friends. When displaying all of his friends, I want to include whether his friend is online or offline. My method is, when user logs in, create a session and update the users table, on status column "online". If he click the logout button, then i will set the status to "offline". Wha...