Jump to content


trq

Member Since 31 Mar 2005
Offline Last Active Today, 02:13 PM

#1436376 how to load correct php pages for specific users

Posted by trq on Yesterday, 07:14 AM

http://www.tuxradar.com/practicalphp


#1436370 Is it possible to send a different IP address using CURL when you make reques...

Posted by trq on Yesterday, 06:51 AM

What exactly is the point? You would never receive the response.


#1436311 Question about deleting a directory

Posted by trq on 16 June 2013 - 10:24 PM

Surely it would be quicker to try this, and get an answer for yourself?


#1436209 Client Upload.

Posted by trq on 15 June 2013 - 11:31 PM

This is quite simple.

A user submits a form to a php script that saves the forms contents (the link) to a database.

You then have another script that queries that database and displays all this data (links).

If you don't know how work with forms, insert data into a database or how to read data out of a database I suggest you start here and here.

In fact that entire book is a good read for beginners. http://www.tuxradar.com/practicalphp


#1436195 Help Blocking GET Input

Posted by trq on 15 June 2013 - 07:47 PM

A few ways you can do this sort of thing, but one simple way is to create a unique key using a salt that only you know about.

In your program, get all the details you are going to send into one string, eg;

$s = "username=foo&data=bar";
Hash this string along with your salt and append it to the actual string.

$s = "username=foo&data=bar";
$hash = sha1('somesalt' . $s);
$s = "username=foo&data=bar&key=" . $hash;
Now, on the receiving end make sure that the data within $_GET['key'] equals the entire original string.

You can even add a timestamp to this sort of thing so that a request only has a short lifespan before it needs to be regenerated again.

This is how we do all our app to app api calls at work, simple, yet effective.


#1434386 drawin selection from db

Posted by trq on 06 June 2013 - 05:27 AM

Why is this happening??


Because your query is failing and you have zero error checking.

Why is your query failing? Probably because strings need to be surrounded by quotes in SQL.


#1434195 Which PHP Editor do you think is the best? [v2]

Posted by trq on 05 June 2013 - 04:13 AM

I must be the only one that hates code completion.


Not at all. That's why I said I rarely use it.


#1433300 how to inclued more then 10 php file .........in a main php.......?

Posted by trq on 30 May 2013 - 05:35 PM

i have 100 php with same code but deffrent user name

 

Why? This is not how you write software.




#1432452 Output buffering

Posted by trq on 26 May 2013 - 09:39 PM

There are plenty of benefits to using buffers in the context of template rendering. Having the ability to load template data into a specific scope without it displaying there and then is one of them.




#1432315 Real world application of Traits

Posted by trq on 25 May 2013 - 07:50 PM

How do you use traits?


I don't. Ive looked hard for a use case, and have even attempted to force myself to use them in some cases, but they have never felt right. There is always a better way, and IMO, I'd just avoid traits all together.

I really don't understand how things like traits get into the language yet things like property accessors don't.

os and ps: It's great to see you back around these parts John.


#1432160 Smarty

Posted by trq on 24 May 2013 - 07:25 PM

We use smarty at work and it is a bloated unnecessary PITA. I see very little benefit to templating engines in general and Smarty especially.


#1432159 Need help accessing an attribute from parent class

Posted by trq on 24 May 2013 - 07:23 PM

A little of topic but Photograph doesn't sound like a type of database_object, why is it extending it in the first place?


#1431798 how to inclued more then 10 php file .........in a main php.......?

Posted by trq on 23 May 2013 - 06:11 AM

how to inclued more then 10 php file .........in a main php.......?
how to inclued more then 10 php file .........in a main php.......?


There is no limit on file includes. What is the problem exactly?


#1431797 is there any tool for curl scripiting............plz advice.........

Posted by trq on 23 May 2013 - 06:10 AM

is there any tool for curl scripiting............plz advice.........


Curl is a pretty simple tool that follows the typical unix philosophy so can be scripted in pretty much any language available.

You might want to define what exactly you want this "tool" to do.


#1430969 Take Screenshot of a Site without opening browser

Posted by trq on 19 May 2013 - 06:07 AM

This can be done quite easily using the proper libraries. We use phatom.js at work to take screen captures for various reasons. It's an awesome library.




Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com