I'm currently in charge of setting up a polling system (using PHP).
Now for it to be as secure and objective as possible, it's important that a visitor can only vote once. I'm thinking of validating the polls by visitor's IP (there can be only one vote from one IP), and maybe throw in a captcha test to be sure that no bots can get in o...
I have a varbinary(MAX) field in a SQL Server 2005 database. I'm trying to figure out how to insert binary data (ie. an image) into that field using PHP. I'm using ODBC for the connection to the SQL Server database. I have seen a number of examples that explain this for use with a MySql database but I have not been able to get it to work...
I've done some dabbling in Rails, but I see a lot more jobs wanting/using PHP than I do Rails. I really know neither of these that well (most of my "professional" experience has been hacking around with Classic ASP and some minor dabbling with ASP.NET; I'm comfortable with OOP and C#/VB.NET), but to maximize my job opportunities I'm hig...
Hi,
I have been unsuccesfully attempting to upload an encrypted file to an FTP server, without writing it to the filesystem first (which has security implications)
I have been attempting to use proc_open and then ftp_fput but to no avail, I guess because the stream created in proc_open isn't fstatable
Here is the code
<?php
$ciphert...
Hi,
I would like to run a query that returns the first word only from a particular field, this field has multiple words separated by spaces, I assume I may need to carry out some regex work to accomplish this? I know how to do this using a few ways in PHP but this would best be carried out on the database side. Any ideas much appreciate...
Why when I call this file with x.php?cmd=deleterec&pk=111 does the html header get output? This should only be output if the file is called with cmd=GetRecordSet or cmd=GetCategorieSet
<?php
if (isset($_GET["cmd"]))
$cmd = $_GET["cmd"];
else
die("Invalid URL");
$pg = 1;
if (isset($_GET["pk"]))
{ $pk = $_GET["pk"];}
$con = mysqli_con...
Okay, so my database is as follows by this order:
id (primary - auto_increment), username (unique), password, fname, mail
I have it so that users register a username and password and it adds it to the database, first of all. No username can be the same, and when it does add the data to the database it auto increments the ID. All of tha...
I am having some strange issues with mysqli connections.
I was working on a page with mysqli, and it has been working fine all day. I then made a copy of this page, and stripped it down to debug a problem, and tested it as a different file. It worked fine connection wise. Upon trying to request the original file I was working on, I get ...
A system I am writing uses Markdown to modify links, but I also want to make plain links active, so that typing http://www.google.com would become an active link. To do this, I am using a regex replacement to find urls, and rewrite them in Markdown syntax. The problem is that I can not get the regex to not also parse links already in Ma...
Hi guys, my proble is to avoid that users upload some malicious file on my web-server.
Im working on linux environment (debian).
Actually the uploads are handled via php by this code:
function checkFile($nomeFile, $myExt = false){
if($myExt != false){ $goodExt = "_$myExt"."_"; }else{ $goodExt = "_.jpg_.bmp_.zip_.pdf_.gif_.doc_.xls_.csv...
I am having the following difficulties:
Three servers A,B,C : A,B in the same network domain; C in another.
PHP scripts executing on server A write to a shared folder on server B.
The same scripts executing on server C fail to write to server B.
PHP looks something like this:
oject->Output('\\\\serverB\\sharedfolder\\file.dummy');
Is...
I found myself needing this function, and was wondering if it exists in PHP already.
/**
* Truncates $str and returns it with $ending on the end, if $str is longer
* than $limit characters
*
* @param string $str
* @param int $length
* @param string $ending
* @return string
*/
function truncate_string($str, $length, $ending = ".....
Doing some SOAP calls to a 3rd party application. They provide this soap header as an example of what the application expects. How can I create a SOAP header like this in PHP?
<SOAP-ENV:Header>
<NS1:Security xsi:type="NS2:Security" xmlns:NS1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:NS2="...
I'm planning a collaboration platform that will be used by academics from twenty different countries collaborating within the same field of research. Ideally I'd like to base my work on an existing open-source platform that can be extended to meet all the requirements.
The final platform has the following requirements:
Integrated mess...
Looking for a way to enable someone to upload a single file which will be series of image files (all gif) merged together as one big file. Here is what I need to do:
Using VB6, want to merge the image files (potentially dozens of them) into a single file
Upload file to a PHP Script (easy enough)
Have PHP break apart the single file and...
Let's say I've got a PHP function foo:
function foo($firstName = 'john', $lastName = 'doe') {
echo $firstName . " " . $lastName;
}
// foo(); --> john doe
Is there any way to specify only the second optional parameter?
Example:
foo($lastName='smith'); // output: john smith
...
What are the benefits of using multiple MySQL queries in a statement, other than to minimize code.
How do you execute, retrieve, and display the results of multiple MySQL queries sent in one statement using PHP (and preferably PDO).
...
I have run into a problem using pdo because an error was not caught.
The code is simple and works just fine, I´ll just include a sample to avoid confusion:
$sql = 'INSERT INTO somedatetable (something) VALUES (:something) ON DUPLICATE KEY UPDATE something=:something'
try {
$stmt = $dbh->prepare($sql);
$values = ...
Hi all,
I was wondering what you guys think about these two frameworks.
I'm going to build a turn-key solution for a vertical market and would like to offer both options: software as a service and give them the opportunity to host the app on their own. In other words I'd aim at having similar deployment options as Joel's FogBugz.
I'm ...
How do I get the values of php checkboxes in a form to show when emailed to the recipient?
I am learning how to use php but I can't figure this one out with the form i have generated.
Below is the checkbox code from the form itself:
<input type="checkbox" value="Please send me a Travel Planner" name="options[]">
<input type="checkbox" ...