I have the following script (it looks long, but well commented). Problem is, i get errors when i try to upload a png or gif image. What can i do to adjust this (easy if possible) so that it can either work with png's and gif's or convert them before trying to work with them.
This is the error that i recieve
Warning: imagecreatefromjpeg...
I'm trying to get nginx + php-fpm +wordpress to serve some pages from my site while acting as a proxy to other pages.
ie:
host/foo -> proxy to another www server
host/bar -> wordpress (via fpm)
the proxy part works fine, but the nginx -> wordpress part just keeps redirecting to the root page.
When i strace the php-fpm process, i ...
I'm developing PHP apps that leverage several frameworks (though not the Zend Framework yet...) and I make good use of Javascript (mostly jQuery). All mark-up is XHTML, of course, with CSS, etc. I'm looking to move beyond the beautiful simplicity of Notepad++. I'm using Windows Vista. I'm trying to decide between Zend Studio 7 or Dre...
I read that you do not need to validate or sanitize user's input if you use prepared statements.
This however does not make sense to me in the following example.
The user gives his email address.
I normally run this
Validation code
// to validate data
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
header("Location...
Below is my friend table,
I included 2 entries to show how it works, When a user adds a person as a friend it inserts 2 entries into the DB with this code;
<?PHP
//status 0=approved 1=declined approval 3=pending approval
$sql = "insert into friend_friend (userid,friendid,status,submit_date)
values
('$_SESSION[auto_id]','$frie...
if ($row['active'] == 1) echo '<a href="prof?id=$id">'.htmlspecialchars($row['username']).'</a>'; else echo htmlspecialchars($row['username']);
Could I write this shorter and cleaner somehow?
...
I develop my project at ~/Dropbox/db/. I need to move the folder continuously to /var/www to be able to see the result in Firefox because it is the only place where I have Apache.
My filetree is at ~/Dropbox/db/
.
|-- handlers
| |-- login.php
| |-- question.php
| |-- question_answer.php
| `-- register.php
|-- index.php
|-- form...
Hey all,
I'm messing with using AJAX to fetch "partial templates" from the server and echoing them back to the browser. This will cause all this HTML to have to be sent back to the browser. I was wondering if there is a way to simply change the variables but leave all the html there. Something like this:
$smarty->assign("fruit", "apple...
I got some idea from the posts before are talking about making a hash value on for each $array[$i], and then compare the hash to get the unique array, but I don't know what exactly I can do.
My sample array Data:
$arr[] = array(0,1,2,3);
$arr[] = array(4,5,2,1);
$arr[] = array(0,0,0,0);
$arr[] = array(0,1,2,3);
I expected to return
...
Help my write a function.
function reportThread() {
global $id;
$result = mysql_query("SELECT is_checked FROM reports WHERE url = '?threadID=$id'");
$r = mysql_fetch_assoc($result);
if ($r['is_checked'] == 0) {
echo "<script type=\"text/javascript\">alert(\"A moderator has been notified.\");</script>";
mysql_query("INSERT INTO repo...
I would like to get session list from the localhost.So, I wrote
session_start();
print_r($_SESSION);
currently access person is two.one is from another PC and the last one is hosted pc.But the on shown only hosted pc session.Actually I would like to get all session user list.
...
Hello, my configuration:
Windows 2008
IIS 7
PHP 5.2.10 / FastCGI
Memcache as a Windows Service
I tried to use the php_memcache extension for PHP but it doesn't load. This extension comes with PECL 5.2.6
Any idea? Do you know if exist a php_memcache"d" extension for PHP on Windows?
BR Santiago
...
Is there a simple way of dynamically scaling an image in php?
Id like to specifically use some kind of function where i can insert it into my heml such as
<img src=image.php?img=boss.jpg&width=500>
and of course it would then scale the image to whatever height constrains it to 500px wide
i appreciate all input, thanks.
EDIT does ne...
I have a PHP script that doesn't seem to work when it contains a // type comment. I mean, the script just doesn't seem to execute beyond the // style comment. E.g.
<?php header('Content-type: text/plain');
// some comment
echo "OK";
doesn't work, no output. but:
<?php header('Content-type: text/plain');
echo "OK";
does work. I se...
I have an array that looks like this:
Array
(
[0] => Array
(
[0] => 1
[id] => 1
)
[1] => Array
(
[0] => 2
[id] => 2
)
)
What I would like to do is compare an int value against what's in the id value field. So, if I were to pass in say a 1, I'd lik...
This was working a few moments ago, not sure what changed.
error log reads
[08-Aug-2009 02:09:20] PHP Warning: readfile(/images/32321249694312.JPG) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: No such file or directory in /home/public_html/viewimg.php on line 82
[08-Aug-2009 02:09:24] PHP Warning: Divisi...
Hello,
I've been trying to find the perfect php framework for me that integrates with dojo smoothly.
I am trying to avoid creating my own framework and I don't want to use the Zend Framework since I don't like it and I have a choice since it's my project.
I really like the Recess! framework. It looks easy to get started with a easy to de...
Here is my problem. In my game I am trying to implement this leveling system where once you reached a certain amount of experience that you advance to a higher level. I am using php 5.0 and the Latest MYSQL. My problem is that i cannot get my scripts to execute properly.
SO here are some dummy stats followed by my code Any information t...
Hey all,
Just wondering if there is anyway to have PHP just run a certain class given the name of the file (controller.php)?
I don't want to require, include or see any signs of it in the controller.php. I just want it to be there.
EDIT: Ok. What I mean by run is in some file hidden away from me I say something like... $class = new Cl...
I created this code:
$statement = $db->prepare("SELECT * FROM phptech_contact");
$statement->execute();
$result = $statement->result_metadata();
$object = $result->fetch_object();
print_r( $object );
When I run it, it doesn't work. Can anybody tell me why it doesn't work?
I have 20 rows in this table so data should be returned.
...