I'm planning to write an application that should handle incoming mails. Basically it will act more like a ticketing system than a webmail, so I'm only interested in receiving emails, and not sending them.
I have made a simple prototype that downloads mails and displays the text with downloadable attachments in a web page, but handling m...
I'm trying to do something but I can't find any solution, I'm also having some trouble putting it into works so here is a sample code, maybe it'll be enough to demonstrate what I'm aiming for:
$input = array
(
'who' => 'me',
'what' => 'car',
'more' => 'car',
'when' => 'today',
);
Now, I want to use array_splice() to re...
I was seeing today the addslashes and addcslashes in php.net, but did not get the point on what is the difference between them and what are the characters escaped in these two.
<?php
$originaltext = 'This text does NOT contain \\n a new-line!';
$encoded = addcslashes($originaltext, '\\');
$decoded = stripcslashes($encoded);
//$d...
Hey Guys,
I am having a strange problem, maybe you can help:
I'm trying to convert a date to GMT time, and this is what I'm doing:
$date = '2010-05-27 23:02:01';
$gmt_date = gmdate('Y-m-d H:i:s', $date );
but the yield of $gmt_date is this:
1970-01-01 00:33:31
What am I doing wrong?
...
Hi, I'm just wondering how I can retrieve a specific value (only 1 thing will be returned) from a database using php.
My query is
mysql_query("SELECT balance FROM users WHERE username = '". $this->username . "'")
I'm just looking for it to retrieve the data from that row so I can save it directory into a variable.
...
I want to allow users as well as me(the admin) to delete data in mysql.
I used to have remove.php that would get $_GETs from whatever that needed to be deleted such as... remove.php?action=post&posting_id=2. But I learned that anyone can simply abuse it and delete all my data.
So what's the safest way for users and me to delete inform...
I'm trying to understand the MVC pattern. Here's what I think MV is:
Model:
<?php
if($a == 2){
$variable = 'two';
}
else{
$variable = 'not two';
}
$this->output->addContent($variable);
$this->output->displayContent();
?>
View:
<?php
class output{
private $content;
public function addContent($var){
$thi...
Hi all:
I found this thread on StackOverflow about how to get the "Application Root" from inside my web app.
However, most of the approaches suggested in that thread can hardly be applied to my Xampp on Windows. Say, I've got a "common.php" which stays inside my web app's app directory:
/
/app/common.php
/protected/index.php
In my ...
I am using godaddy hosting account with windows hosting. Using PHP I am sending email to customers, how do I use my own email address instead of [email protected]
I would like to use [email protected] for all my out going mails and reply to as well. I did by setting a from header in the PHP headers, but its not working.
Any h...
I have a PHP site with a login system, and am trying to make a feature where only specific usernames can view particular images. I think what I'm trying to do is more involved than merely changing the .htaccess file, because a) this won't help discern between users that are/aren't allowed to view the image, and b) if someone enters the e...
I want to create a simple installation script. Below are simple code.
<ul>
<?php
function check_perms($path,$perm)
{
clearstatcache();
$configmod = substr(sprintf('%o', fileperms($path)), -4);
$css = (($configmod != $perm) ? " class='error'" : " class='none'");
echo "<li".$css.">\n";
echo '<span style="float:left;...
Is there a way to dynamically create constant variables on the fly?
The idea is that upon logging into the system, a user would be asked to upload a small text file that would be fread, and assigned to a var that would be accessible throughout the system.
If this is possible, just to be clear, would this variable then only be accessibl...
My SMF forum contains posts with video and I want to extract them to show on the Wordpress main page. My current regexp (thanks to SO!) extracts the url of the videos, which I embed using AutoEmbed.
Everything works up until a post looks like this:
<embed height="600" width="600" allowscriptaccess="never" quality="high" loop="true" pl...
How do I prevent access to a php script if not called with a comandline application like curl? I'm working on a web application and it uses a cron script to run it's services. I'm using codeigniter so I have to use a url not a file path.
...
I need the form to be submitted at the end of the count down. I am aware of expiryURL, but the form doesnt get processed. Can someone help?
Thanks!
...
hi, i want to partially download a ftp file. i just need to download lets say 10MB, but after skipping 100MB (for example).
In php, http://php.net/manual/en/function.ftp-fget.php this function allows arbitay starting point:
bool ftp_fget ( resource $ftp_stream , resource $handle , string $remote_file , int $mode [, int $resum...
In my goal to have a Many-to-Many relationship in my MySQL database I have arrived at another bridge to build.
Current Tables:
Users (id, name)
Tags (id, name)
User_Tags (user_id, tag_id)
Here is the goal:
I would like to have the ability to take a tag i.e: #fb and insert it into my Tags database which has a unique constraint on name a...
how do i sort this array by the nums...
Array(
[nums] => Array
(
[0] => 34
[1] => 12
[2] => 13
)
[players] => Array
(
[0] => Mike
[1] => Bob
[2] => Mary
)
)
... so that i get this one?
Array(
[nums] => Array
(
[0] => 12
[1] => 13
[2] => 34
)
[players] => Array
(
[0]...
i cant fully understand the ORM models in MVC.
so i am using symfony with doctrine. the doctrine models are created.
does this mean that i don't have to create any models? are the doctrine models the only models i need?
where should i put the code that uses the doctrine models:
eg.
$phoneIds = array();
$phone1 = new Phonenumber();
...
Hi I'm about to type some 500 else if statements into my code (PHP) which have the exact same coding each:
if (color=White);
rgb = 255-255-255;
print rgb;
else if (color=Black);
rgb = 0-0-0;
print rgb;
else if (color=Red);
rgb = 255-0-0;
print rgb;
else if (color=Blue);
rgb = 0-0-255;
print rgb;
[the list keeps g...