php

Access shell methods in controller? Cake PHP 1.3

I wrote a shell method in CakePHP 1.3 that has a return value. I'd like to be able to access that method from within a controller, so that I can pass its return value into the View. I'm not sure how to access those methods appropriately from within the controller. Have I done it wrong? I could easily duplicate the code, but I'd lik...

weird ! and space character while sending mail

So here is my situation : On a godaddy server, I've got a php script which sends periodically html emails (a kind of newsletters). And for a reason I can't explain, in some of the emails I send (always at the same exact spot), a ! character appear, along with an unusual space. Here are some example : "I am ! so certa in" instead of "I...

Click a link to display a value

Hello everyone. I have a shoutbox/ chatroom feature on my site. I have a list of online users on the left. I plan on making a button for each user that when clicked, puts their username into the typing area on the shoutbox. Whats the best way to go about doing this? ...

Getting the last entry of a user from a MySQL table ordered by DateTime

Hello, I have a table who looks something like this: USERNAME DATA DATETIME Jhon text1 2010-06-01 16:29:43 Mike text2 2010-06-01 16:29:22 Silver text3 2010-05-23 06:19:12 Jhon text1 2010-02-01 01:02:00 What is the php command if i want the DATA from the LAST entry made by Jhon ??? Thanks! ...

Sending Variables in Post

I want to send only one variable via the post method. I have queried the database and have to post $row[id] variable to the page along with the form. To send the user's input we simply do dfs. and the value is send. But, how can i send the variable $row[id] to the file. And also, how would I access it? ...

Randomly Losing Session Variables Only In Google Chrome & URL Rewriting

Using Google Chrome, I'm seemingly losing/corrupting session data when navigating between pages (PHP 5.0.4, Apache 2.0.54). The website works perfectly fine in IE7/8, Firefox, Safari & Opera. The issue is only with Google Chrome. I narrowed down the problem. I'm using search friendly URL's, and hiding my front controller (index.php) ...

PHP registration script: verifying and telling the user what went wrong

Hi, I'm building a registration script and I want to insert the user's input (username, mail) ONLY if it's not already in the database. What I usually do in such cases is a request to see if something's already there, something like: "SELECT * FROM things WHERE thing_name = '$treated_user_input'". I have two fields that need to be uniq...

Can I return values to PHP from an anonymous PL/SQL block?

I'm using PHP and OCI8 to execute anonymous Oracle PL/SQL blocks of code. Is there any way for me to bind a variable and get its output upon completion of the block, just as I can when I call stored procedures in a similar way? $SQL = "declare something varchar2 := 'I want this returned'; begin --How can I return the value of 'someth...

My simple PHP is outputting wrong things.

EDIT: I forgot to add semi colons. Now there is another problems. I'm getting a error: Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\useraccess.php on line 12 It outputs: 0){ echo 'si'; } ?> When it should only output 'si' in the body. Here's the code: <html> <head> </head> <body> <? ...

Access denied when trying to access my database.

Here's my code: <html> <head> </head> <body> <?php $user = mysql_real_escape_string($_GET["u"]); $pass = mysql_real_escape_string($_GET["p"]); $query = "SELECT * FROM usario WHERE username = '$user' AND password = '$pass'"; mysql_connect(localhost, "root", ""); ...

Magento - Data is not inserted into database, but the id is autoincremented

I am working on a new payment module for Magento and have come across an issue that I cannot explain. The following code that runs after the credit card is verified: $table_prefix = Mage::getConfig()->getTablePrefix(); $tableName = $table_prefix.'authorizecim_magento_id_link'; $resource = Mage::getSingleton('core/resource'...

system time is different than apache timestamp -- ?

Im on a development server. When i do this in php: echo date('r',time()); response: Tue, 01 Jun 2010 18:10:32 -0400 However, my computer's time is 17:10:32 (im on GMT -5). Where do i configure my apache/php to change this setting? i've looked in php.ini and httpd.conf already. Thanks ...

PHP: Collect all variables passed to a function as array?

Hi everybody, I was thinking about the possibility of accessing all the variables that are passed into an function, and merge them into an array. (Without passing variables into an array from the beginning) Pseudo-code: // Call function newFunction('one', 'two', 'three' ) ;// All values are interpreted as a one rray in some way // Fu...

PHP cron script with twitter (problem with oauth)

Hi guys, I am trying to write an php twitter script which will be run by crontab, what the script does is to get the tweets from a dedicated twitter account. I have looked at some of the php twitter oauth libraries, all of them seem to use redirect to a twitter page to get a token, then goes back to a callback link. In my case I don't ...

mysql and php: setting config variables on start - impact on server?

date_default_timezone_set('America/Guayaquil'); $cnn->execute('SET NAMES utf8'); $cnn->execute('SET GLOBAL time_zone = "-5:00"'); Hi, the code above is run everytime someone enters the website im developing. Does someone know what the impact (in performance) of those commands is? ...

Is directly linking to an image okay for images uploaded to the server with a custom PHP script?

For an image file (JPEG) that has been uploaded to the server via a PHP script (to a directory such as http://www.somedomain.com/images, is it a good idea to allow the client to get the image's direct address (such as http://www.somedomain.com/images/someimage.jpg and paste it into a WYWSIWYG text editor (such as TinyMCE)? I am wonderin...

How can I save content from another website to my database ?

Hello, I want to upload dynamically content from a soccer live score website to my database. I also want to do this daily, from a single page on that website (the soccer matches for that day). If you can help me only with the connection and retrieval of data from that webpage, I will manage the rest. website: http://soccerstand.com/...

How can I accept a hash mark in a URL via $_GET?

From what I have been able to understand, hash marks (#) aren't sent to the server, so it doesn't seem likely that I will be able to use raw PHP to parse data like in the URL below: index.php?name=Ben&address=101 S 10th St Suite #301 I'm looking to pre-populate form fields with this $_GET data. How would I do this with Javascript (or ...

MySQL/PHP Search Efficiency

Hi! I'm trying to create a small search for my site. I've tried using full-text index search, but I could never get it to work. Here is what I've come up with: if(isset($_GET['search'])) { $search = str_replace('-', ' ', $_GET['search']); $result = array(); $titles = mysql_query("SELECT title FROM Entries WHERE title LIKE '%$search%'"...

Django or Drupal, which one should I use that suits best my needs ?

Hello, I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented an...