php

Make array of all GET-variables

Hey. I'm trying to get an array of all GET-variables passed to a PHP document. Is this possible? Thanks. :) ...

How to get the child directory and file names of the website

If we know the URL, can we access the names of the files inside the parent directory. Like we do in dos, when we enter a folder we can view the list of files inside that directory by giving command DIR For Eg., If we have URL like http://www.ahilam.com . I want to know what are the files and folders inside the ahilam.com such as htt...

How can I use clippy to copy an iframe embed code without the iframe displaying

I have an embed code that users will use to display content hosted on my website on their own site (e.g. <iframe src="mysite/feed"></iframe>). I want to use clippy to allow them to copy the embed code to their clipboard but in firefox this results in the iframe actually getting embedded in the page beside the clippy icon. My site is w...

mysql dump generating a blank sql file

Please help, I got this code from googling on how to use mysql dump on php. But its just generating a blank .sql file. I already tried putting the mysqldump.exe on the same directory as the php file but doesn't work. <?php system('mysqldump -uroot -pmypassword test > C:\wamp\www\test\test.sql'); ?> I'm trying to do this, but I am run...

Merging XML documents with PHP

I have these two xml documents: XML 1: <outer> <foo> <foo-child name="fA" special="true"> content of fA </foo-child> <foo-child name="fB"> content of fB </foo-child> </foo> <bar> <bar-child name="bA"> content of bA </bar-child> <bar-...

How to delete many records at a stretch?

Hello, In Php as we all know, there are no inbuilt controls by itself like Asp.Net's GridView etc. I am using Html's <table> to build up the grid and keep the row's id in one hidden field. I've also placed one checkbox at the beginning of each row and a delete button at the bottom of the grid. The problem i face is, how do i get all the...

Read POST request parameters properly in PHP for request more than 1450 B?

I receive POST request on my api.php script. The content red using this code: $fp = fopen('php://stdin', 'r'); $all = ""; while($line = fgets($fp, 4096)) { $all .= $line; } echo $all; looks like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHF...

supplied argument is not a valid Image resource in php codeigniter

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '') { $defaults = array('word' => '', 'word_length' => 6, 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration'...

Checkeach array item has a value

I am trying to error check a form that on submitting creates an array, however no value in that error can be empty, how can I check this using PHP, the array looks like this, Array ( [campaign_title] => [campaign_keyword] => [introduction] => [position] => left [campaign_headline] => Array ( [...

What is a good way to produce a random "site salt" to be used in creating password retrieval tokens?

I would like to create a site-wide hash to be used as salt in creating password retrieval tokens. I have been bouncing around stackoverflow trying to get a sense of the best way to do this. Here's the reset process: When a user requests a password reset email the code generates a retrieval token: $token = hash_hmac('sha256', $reset_h...

Need help understanding Doctrine many to many self referencing code

i am having trouble deciphering this block of code from doctrine documentation /** @Entity */ class User { // ... /** * @ManyToMany(targetEntity="User", mappedBy="myFriends") */ private $friendsWithMe; /** * @ManyToMany(targetEntity="User", inversedBy="friendsWithMe") * @JoinTable(name="friends", ...

Set a cookie to never expire

Looking at the php documentation on setting a cookie I see that I can set an expiration date for the cookie. You can set the cookie to expire at the end of the browser session or at some time in the future but I do not see a way to set the cookie to never expire. Is this even possible and how is this accomplished? ...

How to parse raw POST data into array?

I have a raw form-data that look like this: ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="intro" O ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="title" T ------------V2ymHFg03ehbqgZCaKO6jy Content-Disposition: form-data; name="apiKey" 98d32fdsa ------------V2ymHFg03ehbqgZCaKO6jy C...

Store dynamic form fields in database

Hello. I have read other answers on this (or at least near to this) subject but I couldn't get a clear view of it so I'm asking for help again. I have a complex dynamic HTML form that I would like to submit to database using PHP. The form is split into multiple tabs and in each tab I got checkboxes that trigger other parts of the form. ...

Decoding XML with base64_decode works fine in PHPUnit but returns UTF-16 encoded data in browser

I'm having some strange issues with decoding an XML snippet, contained with a cookie, with PHP's base64_decode function: In our PHPUnit tests, we can decode the XML and echo it out to the console and it prints XML as you would expect (all unit tests pass as well). As soon as we try running the same code in the browser, the decoded XML ...

HTMLPurifier - adding to ignore list

I am trying to pass some XML tags (abcdef>) through htmlpurifier. Since the tags itself are not supported, I am trying to add an element first and then adding it to allowedElements. However this is not working, i'm just getting a blank page. Any ideas please on what I am doing wrong, or if there is an easier way to achieve what i am look...

How can I move XML elements with PHP's SimpleXML?

How can I move an xml element elsewhere in a document? So I have this: <outer> <foo> <child name="a"/> <child name="b"/> <child name="c"/> </foo> <bar /> </outer> and want to end up with: <outer> <foo /> <bar> <child name="a"/> <child name="b"/> <child name="c"/> ...

ftp_put uploads an empty file

I'm trying to upload a file via ftp_put to a windows server. my code is as follows: $date = date('ymd'); $file_name = $date.'.csv'; $file_location = 'D:/inetpub/wwwroot/website.com/html/assets/'.$file_name; //set up basic connection $conn_id = ftp_connect(FTP_HOST, FTP_PORT); // login with username and pas...

Retrieving a file name to attach to an email with SwiftMailer and PHP

I asked the question yesterday and got an advice, and used it, but it doesn't work for some reason. So, I need to retrieve the name of the file that was uploaded to my server from an HTML form by a user. I need this file to be attached to an email that is to be sent by PHP/SwiftMailer. Here is my code, the file upload portion: //F...

Form with file input field wierdness

Ok. I'm probably just to tired to spot an issue here. The problem is when I submit this form, the attached file does not get submitted. $_FILES array in PHP is always empty. Here is HTML form: <form enctype="multipart/form-data" method="post" action="navigator.php?kam=editovatElearningKurz&id=-13"> <dl> <dt> <label for="docume...