php

Image watermarking in php

I want to watermark an image and save it. here is the code i am using for it. Here it is outputing the image and is storing that output to the file. I want to save it without outputting it. How can i do that? // Load the stamp and the photo to apply the watermark to $stamp = imagecreatefrompng('stamp.png'); $im = imagecreatefromjpeg('pr...

How to set php cron job?

I am using windows server 2003. I set a cron job, open IE explorer and run cron.php file. Basically, what the cron.php does is just send email to my own email address. I set it run every 2 minutes and run for 2 hours. I start the cron services, and I received the first email, but after that, I waited few hours, I am still didn't receiv...

how can get whether directory exist in PHP

Hi All I am trying to use is_dir($path) but it is crashing the server Regards Hemant ...

call jquery load on <a > link

i have page in php and all over page i am using < a tag to link for example <?php for($i=1;$i<=5;$++) {?> <a href="abc.php?ref=<?php echo $i ?>"CLick me No. <?php echo $i ?> </a> <?php } ?> what i want to do is once we click on link jquery load function should called, like $('#div1').load('abc.php?ref=1'null, function() { ...

Filtering array values in php?

How can i filter this array values with [category] => 1 [0] => Array ( [link] => index [image] => spot [category] => 0 ) [1] => Array ( [link] => test [image] => spotless [category] => 0 ) [2] => Array ( [link] => differentcat [image] => spotly ...

PHP, Prevent users from accessing a page while not logged in?

How can I prevent a user from accessing a page when they are not logged in? I want him to be redirected to the login page. I know it has something to do with sessions. ...

How can i get the current month and previous three months using PHP

Hi all Will any one tell me how to get the current month and previous three months using PHP For example: echo date("y:M:d"); output will be: 09:Oct:20 But i need: August September October as the Output. Thanks in advance... Fero ...

Call php from javascript and return an array from php to Javascript function

Hi All, I want to write a function in javascript which will call the Getfilename.php and Get the $filesArray that is return in javascript. GetFilenme.php is another file and I am trying to access this from Config.html PHP : Getfilename.php <?php $dir = 'uploads/'; $dir = $_REQUEST['dir'] ; $filesArray = array(); $Counter = 0; $fil...

CSS not working with PHP script:

Here is the code from my style.php script The objective: User should be able to select and input different options for the background color and font. This code snippet with css and php is called stlye.php and is suppose to supply the variables to be used on my outputform.php script. <?php header("Content-type: text/css"); $gray = "#3...

Using Zend Framework with CodeIgniter in XAMPP problem

This article explains how to use Zend in Codeigniter.http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/ I am using XAMPP and having difficulties with path. Could anyone explain the followings please. Q1. I am not sure what is going on here. Why do I need to set this one? ini_set('include_path', ini_get('inc...

What are the different ways of writing "if" conditional statements using PHP?

What are the different ways of writing if conditional statements using PHP? I know for example of the following if($test == 1){ }else{ } and if($test == 1) echo 'asdsa'; else echo 'sdaaa'; ...

Mysql how many search results

Hi. How can I check how many results is returned from mysql db? Im using this code to fill a table with results from the mysql db: $qry_result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($qry_result)) Im want to display how many search results there was on the users search criteria... Thanks ...

mysqli - $stmt->num_rows returning 0

Hello everyone, i am looking to count the number of records returned by the query below using mysqli / prepared statements: $mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database'); $stmt = $mysql->prepare('SELECT id,vcref,jobtitle,jobtype,jobintro,closingdate FROM jobs WHERE...

Facebook FQL user table `sex` field : how to return male/female even the user is using different locale?

Situation: my facebook application ( http://apps.facebook.com/mymagicmirror/ ) needed to detect user's gender, and then query opposite sex or male or female FQL: SELECT uid, name, pic, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user_id.') and sex='male' Problem: When the facebook user is using other locale, th...

Need to take two text field values and add together to another field

<p>First Name <input type="text" name="first_name"> Last Name <input type="text" name="last_name"></p> <input type="hidden" name="screen_name" value="first_name + last_name"> How do I take what was typed into first_name and last_name fields and add them together to the screen_name so when the field is submitted, it inputs the values ap...

How can I alias a path to another without the user knowing that path?

I thought I could do this with rewrite but I can't seem to find any information on it. What I want to do is this. /path/to/my/program/index.php I want to use a link for the use such as. /forum/index.php Is this posible? ...

extract value from web page

Hi I have a website's home page that I am reading in using Curl and I need to grab the number of pages that the site has. The information is in a div:- <div class="pager"> <span class="page-numbers current">1</span> <a href="/users?page=2" title="go to page 2"><span class="page-numbers">2</span></a> <a href="/users?page=3" title="go to...

"how many search results from mysql" help

Hi... I got some help with gettin the number of rows returned from mysql, and it works fine... BUT, how do I get the number of rows with a certain field value? Do I have to make a new Mysql search query? Here is the code where I query mysql and display in a table using fetch_array... Also, Im using mysql_num_rows to get number of rows....

How to compare 2 strings alphabetically in PHP

What the title says. Specifically if I have $array1['name'] = 'zoo'; $array2['name'] = 'fox'; How can I determine that alphabetically $array2's name should come above $array1's? ...

How to update a jointable in CakePHP, manually

I am sort of a newbie with CakePHP. I have two tables: contacts and tags, and an HABTM table contacts_tags. User should be able to add tags as people can do in delicious.com. they get a list of tags as they type. They can also add new tags just by typing them. I want to check the tags table to see which tags are already present and which...