Hi, I was reading through our code base at my company and I saw something that seemed like it could be done better.
$dbRow = $dbh->Execute("SELECT * FROM database.table LIMIT 1");
$tableColumnCount = $dbRow->_numOfFields;
Is this the only way to get a column count using ADODB? It just seems silly to have to execute a query so you can...
Bear with me, I have been only learning PHP for only a few weeks, so example code may confuse me. I think I finally understand salting! It's to protect passwords inside database, if breached.
What I don't understand is, why would a hacker have to crack hashes if they are trying to figure out a user's password (assuming that's their goal...
I have created an php mail script, And in the message of the mail i sent i am using many variables (data). For example i want to sent an mail with this body msg:
Name: Somename
Email: [email protected]
City: Somecity
State: somestate
.........
What i am doing is this:
$msg = "Name: $name (brake) Email: $email (brake).........
Hey guys quick question,
I want to filter my output to make it safer from Cross site scripting (XSS) attacks so I am filtering output with htmlentities. The problem is, I am trying to make my application utf8 compatible so when I enter something like ಠ_ಠ I would like it to be maintained when retrieved from the database. Is there a simpl...
I have a session variable that contains the following string.
a:2:{s:7:"LoginId";s:32:"361aaeebef992bd8b57cbf390dcb3e8d";s:8:"Username";s:6:"aaaaaa";}
I want to extract the value of username "aaaaaa". can anyone suggest easier/more efficient manner?
$session_data = unserialize($_SESSION["SecurityAccess_CustomerAccess"]);
$session_use...
I have about 1 million rows so its going pretty slow. Here's the query:
$sql = "SELECT `plays`,`year`,`month` FROM `game`";
I've looked up indexes but it only makes sense to me when there's a 'where' clause.
Any ideas?
...
What I'm trying to do is I have my tables structured like so:
The Monkees - I'm A Believer
The Monkees - Daydream Believer
The Beatles - Hello, Goodbye
The Beatles - Yellow Submarine
With the artist and title names in the same row and I'm trying to display them like this in the search results:
The Monkees:
I'm A Believer
Daydream ...
$sql2 = "SELECT `id` FROM `saa_game` WHERE `domain_id` = '".$row['id']."' AND `unique_id` = '".s($oGame->unique_id)."' AND `year` = '".$iYear."' AND `month` = '".$iMonth."' LIMIT 1";
$result2 = mysql_query($sql2) or die(mail('[email protected]','SAA Gather Error',mysql_error()));
if(mysql_num_rows($result2) == 1)
{
$row = mysql_fetc...
I have a number of ftp accounts on my website where each account is accessible by a limited number of people. The accounts can be accessed for download by going to ftp.mysite.com in a browser. I would like to make the directory display look like the rest of the site when people goto ftp.mysite.com. Is this possible?
Edit: Not using any...
Now here is my situation: I'm making a CMS. When links are clicked, i would like the pages to load dynamically using Ajax. The problem in the links!
The only way to change the address in the address bar real-time is to use anchor tags. But PHP doesn't get the anchor tags, thus I can't load page content on site load using PHP.
And if i w...
hey guys,
i love working with mamp ( i have the pro version).
i'm currently trying to connect to a ftp server and list the files up there. however the connection is successful but it won't list the files.
$contents = ftp_nlist($conn_id, $path);
returns bool(false)
however the script is working if i run it on my real webserver. is th...
I'm going to use one of the payment gateways and so users from my site will be redirected to gateway hosted page to provide all the CC details. Gateway will return results to the page which I specify (lets call it paymentProcessed.php). But now my worry is that:
someone might fake it. What I mean is that someone might be redirected to ...
I need a method to traverse a multidimensional array in PHP without using function calls itself.
Basically I have an array like this:
$data = array(
'hoge' => 123,
'foo' => 456,
'bar' => 789,
'aaa' => array(
'abc' => 111,
'bcd' => 222,
'cde' => 333
),
'bbb' => array(
'def' => arra...
Hello,
In Zend Framework I'm using the standard FormErrors decorator to output form errors in one place, rather than outputting each error below its corresponding element. The decorator works the way I expect it to, except that I can't figure out how to output the errors at the top of the form instead of at the bottom. Is there a way ...
Hello,
I have a php script with a few errors in. It's impossible to debug since its not showing me the errors!!
I tried:
my first line in my script contains following:
<?php ini_set('display_errors',1); error_reporting(E_ALL); ?>
but its still not giving me any errors, anyone?
/home/cpeasyapache/src/php-4.4.9/php.ini-dist
/ho...
<?php
include "db.php";
$username=$_POST['username'];
$email=$_POST['email'];
$query="SELECT * FROM members where username = '".mysql_real_escape_string($username)."'";
$result=mysql_query($query)or die(mysql_error());
$user = mysql_fetch_assoc($result);
mysql_close();
?> <br /> <p></p>
Welcome back! Your details below: <br /><b...
Hi. I'm trying to integrate the FedEx tracking class into my application. The class takes a SOAP response and puts it into a hierarchical class structure. I access the values like this:
$city = $response->TrackDetails->Events[$i]->Address->City;
This works fine for most cases. The problem I am having is when there is just one eve...
My goal is to have user-uploaded files (mostly PDF) available for download only via a link from the host website.
I've protected user-uploaded files with an .htaccess file that resides in the uploads directory. .htaccess checks the referrer against the hard-coded domain name, and if the referrer matches, it allows access. Otherwise ac...
I'm working on a project that requires me to read values from a file and manipulate them slightly before storing them elsewhere. One of the things I need to do is convert some dates from mm/dd/yy format to mm/dd/yyyy format. Unfortunately for me, I am relatively new to PHP and regular expressions (which I assume is one of the better ways...
I am researching the possibility of porting an application written in classic ASP with ADO record sets and an Oracle database to PHP5 and OCI8. We have lots of stored procedures and queries with bind variables for performance.
My problem is that we have become lazy from using the ADO classes and the EOF and BOF indicators along with Mo...