Go Back   CodingForums.com > Search Forums

Before you post, read our: Rules & Posting Guidelines

Showing results 1 to 25 of 239
Search took 1.68 seconds.
Search: Posts Made By: idalatob
Forum: Post a PHP snippet 12-18-2012, 07:19 AM
Replies: 9
Views: 1,064
Posted By idalatob
Its a bit hitched from the Zend Framework. ...

Its a bit hitched from the Zend Framework.

Its not specific to any particular framework or server. (I suppose you would have to have apache and use virtualhosting)

Whats really cool about this...
Forum: PHP 12-17-2012, 03:52 PM
Replies: 53
Views: 1,261
Posted By idalatob
Dont forget to actually connect to the database....

Dont forget to actually connect to the database. Also, setting display errors might also help eg:

//show errors


ini_set("display_errors", "on");



//connect to mssql database
Forum: PHP 12-17-2012, 03:40 PM
Replies: 53
Views: 1,261
Posted By idalatob
<?php /** First thing, we create a...

<?php
/**
First thing, we create a function that will make your data safe!
**/
function mssql_escape($data) {
if(is_numeric($data))
return $data;
$unpacked =...
Forum: PHP 12-17-2012, 03:36 PM
Replies: 53
Views: 1,261
Posted By idalatob
Fou-Lu doesnt take kindly to mistakes. :-P

Fou-Lu doesnt take kindly to mistakes. :-P
Forum: PHP 12-17-2012, 03:32 PM
Replies: 5
Views: 349
Posted By idalatob
Some email clients have actually started blocking...

Some email clients have actually started blocking text too. Now we're at a situation where you have to use whitespace to get your message across.
Forum: PHP 12-17-2012, 03:25 PM
Replies: 53
Views: 1,261
Posted By idalatob
Ok lets sort you out. First of all, I...

Ok lets sort you out.

First of all, I apologize for sending you down the mysql road, when you're clearly using mssql.

So, lets resolve all the mysql related functionality out of your code.

...
Forum: PHP 12-17-2012, 03:03 PM
Replies: 53
Views: 1,261
Posted By idalatob
Bugger it. I wrote all that stuff for mysql....

Bugger it. I wrote all that stuff for mysql. Facepalm.

Same applies generally. Switch to mysql. :-P
Forum: PHP 12-17-2012, 03:02 PM
Replies: 53
Views: 1,261
Posted By idalatob
6.) Do some validation on your code. With the...

6.) Do some validation on your code. With the current mechanism you have, anyone could go hacking in any values. See below example.



if (isset($_POST['any_field_other_than_submit'])) {

...
Forum: PHP 12-17-2012, 02:55 PM
Replies: 53
Views: 1,261
Posted By idalatob
Also, im assuming you are trying to add more than...

Also, im assuming you are trying to add more than one value into the db?

This is the syntax you can follow:



/**
Prevent mysql injection
**/
foreach ($_POST as $key=>$value) {
Forum: PHP 12-17-2012, 02:51 PM
Replies: 53
Views: 1,261
Posted By idalatob
Quite a few suggestions: 1.) Read up on the...

Quite a few suggestions:

1.) Read up on the syntax to insert a record into mysql. http://www.tizag.com/mysqlTutorial/mysqlinsert.php
2.) You arent actually telling mysql to do anything.

$query...
Forum: PHP 12-17-2012, 11:08 AM
Replies: 20
Views: 926
Posted By idalatob
WOOOHOOO! MY TURN! $days = array( ...

WOOOHOOO! MY TURN!



$days = array(
"First" => "a faulty line of code",
"Second" => "a segmentation fault",
"Third" => "a server crash",
"Fourth" => "a newbie programmer junior",
"Fifth" =>...
Forum: Post a PHP snippet 12-17-2012, 10:55 AM
Replies: 9
Views: 1,064
Posted By idalatob
Not that andrew's way isnt awesome! Just chipping...

Not that andrew's way isnt awesome! Just chipping in.
Forum: Post a PHP snippet 12-17-2012, 10:40 AM
Replies: 9
Views: 1,064
Posted By idalatob
Here's a cool way of doing it too: //in your...

Here's a cool way of doing it too:

//in your php config file

defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') :...
Forum: PHP 12-17-2012, 10:10 AM
Replies: 5
Views: 351
Posted By idalatob
You could just change require_once to...

You could just change require_once to file_get_contents... That will 'call' the script like you are doing in your web browser and return the contents. This isn't strictly the correct way of doing it...
Forum: PHP 12-17-2012, 09:48 AM
Replies: 5
Views: 371
Posted By idalatob
You could then get the result of the page like...

You could then get the result of the page like this:



$result = file_get_contents("http://mydomain.com/test.txt");
Forum: PHP 12-17-2012, 09:45 AM
Replies: 5
Views: 371
Posted By idalatob
Im guessing you are checking what output the .txt...

Im guessing you are checking what output the .txt file provides and not the actual contents:

IE:
echo("1"); // you want to get the 1 and not the full string?

If you do, there is another way...
Forum: PHP 12-11-2012, 01:15 PM
Replies: 7
Views: 303
Posted By idalatob
The problem is, the date function expects a...

The problem is, the date function expects a timestamp as the second parameter and not a mysql date.

Try this:


$N_pub_date = strtotime("{$row['pub_date']}");
$N_pub_date = date("m/d/y",...
Forum: PHP 12-11-2012, 11:08 AM
Replies: 4
Views: 303
Posted By idalatob
Maybe a little complex. Absolutely no insult to...

Maybe a little complex. Absolutely no insult to you of course.

But this link here may apply to what you are trying to do:

http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
Forum: PHP 12-04-2012, 10:48 AM
Replies: 3
Views: 350
Posted By idalatob
Although this is already resolved, I thought I...

Although this is already resolved, I thought I would chime in with some advice as to how I would solve it.


/**
* A list of addOns available and the associated price
*/
$addOns = array("ham...
Forum: PHP 10-23-2012, 11:31 AM
Replies: 2
Views: 248
Posted By idalatob
I reckon, store the ip addresses in a temporary...

I reckon, store the ip addresses in a temporary table.

Then, run a cron job, which implements some form of caching to translate the ip addresses into domain names. The caching wont help a...
Forum: PHP 10-23-2012, 09:41 AM
Replies: 5
Views: 295
Posted By idalatob
Heres another more retarded version, utilizing...

Heres another more retarded version, utilizing some amazing typecasting functions from php:



$tmp = (string)$i;
$b = !($tmp{strlen($tmp) -1}) ? "<br>" : ",";
echo($i . $b);
Forum: PHP 10-23-2012, 09:30 AM
Replies: 5
Views: 295
Posted By idalatob
Bored at work... $b = !((bool)$i % 10)...

Bored at work...



$b = !((bool)$i % 10) ? "<br>" : ",";
echo ($i . $b);



I challenge you all to come up with a more convoluted way of doing this.
Forum: PHP 10-23-2012, 09:22 AM
Replies: 4
Views: 372
Posted By idalatob
Couple of small tips: //use 'isset' to...

Couple of small tips:


//use 'isset' to determine if a variable exists
if (!isset($_POST['gameid'])) {
die("No game defined");
}

//escape any content you may be getting from the user...
Forum: PHP 09-14-2012, 02:17 PM
Replies: 8
Views: 496
Posted By idalatob
Bet you fou-lo will give us a bad *** answer...

Bet you fou-lo will give us a bad *** answer...
Forum: PHP 09-14-2012, 02:07 PM
Replies: 8
Views: 496
Posted By idalatob
Cloning doesnt copy internal objects. Whereas new...

Cloning doesnt copy internal objects. Whereas new creates NEW objects. They are not the same.

EG:

<?php

class foo {
private $_bar;

function __construct(){
Showing results 1 to 25 of 239

 
Forum Jump

All times are GMT +1. The time now is 06:02 AM.