php

Strange Behaviour : unlink not deleting files in php

Somehow unlink is not deleting the file. If you see in the file, am copying from $incoming_file_path to $processing_file_path and than after copying is done. I am trying to delete the file in $incoming_file_path but somehow is it not deleting and I really wonder why it is happening so. Kindly advice. <?php ini_set('error_reporting',0);...

PHP using CURL: is there a way to emulate a cookie instead of saving it to a file?

I access a REST api service that utilizes a variable called session_id. The API calls for this to be stored in a cookie and I accomplish this as follows: $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL, $url); //set target URL curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);// allow redirects...

Using JavaScript to Modify a Page on the Fly based on <select> contents

So, I've got a form and within that form is a <select>. Based on what that select is(what <option> is selected), I want the contents of the form to change on the fly(i.e. before the user clicks anything else). For example, if the user selects the Photo Upload option, a file upload box will appear, and if they select Text Entry, a text b...

How do I use preg_match_all with 2 values and preg_replace to create 2 different links

I have a text file that I am displaying in a table. I am using preg_match_all to find a specific Title with a specific Chapter and I am replacing the Title and Chapter with preg_replace to make it a link.. For example the contents within the text file are as follows: Dec 04 20:15 Naruto 123 Dec 04 17:42 Naruto 98 Dec 04 16:19 D Gray Ma...

Simple question, comma delimited id's to array in php 5.2

I've got a comma delimited string of id's coming in and I need some quick way to split them into an array. I know that I could hardcode it, but that's just gross and pointless. I know nothing about regex at all and I can't find a SIMPLE example anywhere on the internet, only huge tutorials trying to teach me how to master regular expres...

The strangest thing with ob_start and headers

ob_start and all the headers did not work on my webpage. I searched though my whole code and did not find anything wrong. Then I deleted all my code and placed a Header Location at the top of the dokument and it still didnt work so then I simply created a new document copied the code from the old document and then all of sudden it starte...

how to send direct messages uisng oauth?

Hi i am trying to make a twitter application. I have gotten my application to a point where users log in through Twitter's user verification system. I am also able to send status updates using my application. I have this function to send status updates: [CODE] function sendTweet($tx){ $consumer_key = 'MY CONSUMER KEY'; $consumer_se...

Run PHP Script every 5-10 minutes without cron,perl etc..

I know this question is asked about hundred of times, but I want to run a scirpt every 5 minutes on server, I have not any type of administrate privileges to do cron job etc. I am not good php programmer so this question may look strange, but if you understand please tell some solution. Thanks. ...

Make itrader auto fill in URL

I am wondering if it is possible to make a button for Itrader (popular vbulletin extension) on the users post that when you press it, it will fill in the deal url from the page you just left . Example: I got to DP than buy something from someones thread, there is a button that says leave itrader and from there I click it and it takes m...

Image file permission - image resizer

PHP mySQL Hi, i am having an interesting problem. I have a form in my cms that allows the admin to upload images to the server. The script resizes the images to a thumbnail (170px height)and a large image(600px height). The thumbnails are around 16000k in size and the large images are around 160,000k in size. I do not set file permis...

Update in time in MySQL is not working

I am trying to insert date time on the MySQL DB. I have kept the field as VARCHAR(9182) date_default_timezone_set('Asia/Kolkata'); $timestamp = date("m/d/Y h:i:s a", time()); $utimeprocess = "UPDATE tabelconf SET time_of_pstart = '".mysql_escape_string($timestamp)."' WHERE UniqueID = '".mysq...

how to get post element in form in this case( in PHP )

in a form which is handled by php language, how can we get a input elements which are in a kind of array like item1,item2,item3..... (if we only want those items that are having values) example:- <form method="post" action="<?php echo $PHP_SELF;?>"> item1 <input type="text" name="item1"> item2 <input type="text" name="item2"> item3 <inp...

Techniques to speed up Magento on a shared host

I have an established Magento site that is only just starting to get complaints about it's performance. It's on a shared server. The internal server-side cache is also enabled. Some of the problems I have noticed are Many HTTP Requests No minification of CSS or JavaScript. No CSS sprites Shared server isn't recommended for Magento, o...

php boolean TRUE / FALSE question?

i cant figure this out. if i type function myfunction(){ ...... if ... return TRUE; if ... return FALSE; } why cant i use it like this: $result = myfunction(); if ($result == TRUE) ... if ($result == FALSE) ... or do i have to use: $result = myfunction(); if ($result == 1) ... if ($result == 0) ... o...

Using an flash MP3 player (any one) on Codeigniter?

Can someone teach me how to embed a flash MP3 player (step-by-step) using codeigniter? I have been trying for hours now with no success. I am so frustrated. Someone please help me. Thanks. ...

T_STRING error on line that just says <?php

So I'm writing a script in codeigniter, and I get the following error message: Parse error: syntax error, unexpected T_STRING in /home/globalar/public_html/givinghusband.com/system/application/controllers/sizes.php on line 1 the only problem: the only thing on that line is this: <?php So I'm quite mysterified as to what's going on ...

Retrieving and Presenting SQL Joined Table Records with PHP, Sqlite (or MySql), and HTML

Hello: Please bare with me while I try to explain my question. I have a Sqlite database that has a table consisting of company information (Companies) and a table consisting of product information (Products). The Companies table id is Company_Name. It is joined with the Products table by Company_Name. For example, Company "A" can ha...

simple PHP $_GET sanitization question

I have a record edit link that GETs a 7 character alphanumeric text string which is always ZZZZ111 in structure and is then used in a MySQL query to pull all related data for that record id. Is mysql_real_escape_string() all I need in terms of sanitizing this $_GET['id'] ? Or are there more steps to take to protect my database? ...

How to copy few files from one folder to another folder in php and delete them in source folder

How to copy files from one folder to another folder in php and delete them in source folder ? I have two folder $incoming_file_path = /home/xmlcontainer and $processing_file_path = home/process_file. I am looping through all files in $incoming_file_path = home/xmlcontainer and than copying it into $processing_file_path = home/process_...

PHP: How to instantiate a class with arguments from within another class

Hello All, I am in a situations where i need to instantiate a class with arguments from within an instance of another class. Here is the prototype: //test.php class test { function __construct($a, $b, $c) { echo $a . '<br />'; echo $b . '<br />'; echo $c . '<br />'; } } Now, i need to instantiate above class using below cla...