Consider the following PHP snippet:
<?php
class Is
{
function __get($key)
{
$class = __CLASS__ . '_' . $key;
if (class_exists($class) === true)
{
return $this->$key = new $class();
}
return false;
}
function Domain($string)
{
if (preg_match('~^[0-9a-z\-]{1,63}\.[a-z]{2,6}$~i', ...
Ho to make this "simple" xml with php using DOM? Full code will be welcomed.
<rss version="2.0"
xmlns:wp="http://url.com"
xmlns:dc="http://url2.com"
>
<channel>
<items>
<sometags></sometags>
<wp:status></wp:status>
</items>
</channel>
</rss>
i'm so lost. Code will help me more than any explanation.
...
I want to write an email transfer service and need a MTU replacement of sendmail/postfix.
I'm not looking how to deliver to a transmitting SMTP server (like a postfix listing on a SMTP port). I also don't need the receiving part of the server, bounces etc. would go to a different existing postfix.
All of it in pure PHP. SMTP is a pre...
After people pay in our site using paypal they are sent to an address http://www.xyxyxy.com/xyxyx.php where they can access the service we are selling them. The problem is this... when they pay with paypal, the system is working perfectly, but, when they pay with a credit card, they are sent to a page that says... Permission to download ...
I have made a tiny ModX snippet that looks like this
<?php
$theMenu = $modx->runSnippet('Wayfinder',
array("startId" => 0, "level"=>1)
);
echo $theMenu;
?>
but I would like it to pass ALL params it receives to Wayfinder. I will only be modifying the "level" parameter from my snippet.
Is there any way, without naming all the relevan...
What are the adventages and disadventages of storing JSON data in MySQL database vs. serialized array?
...
I have a javascript file that communicates to a controller class, which in turn delegates which function to run to a transactions class.
Is it better to have the transactions class broken up into multiple smaller files and then in my switch statement include which ever smaller file i need? or should i have all my transactions in one fi...
Is there a naming convention or maybe some guideline on how to name function parameters?
Since forever, I have been doing it like this:
function divide( $pDividend, $pDivisor )
{ ... }
That way I'll always know which variables were passed as parameters.
(This one's PHP, but it should be applicable to most programming languages)
Is ...
I need to create a pdf file with the fpdf library and save it in a blob field in my MySQL database.
The problem is, when I try to retrieve the file from the blob field and send it to the browser for the download, the donwloaded file is corrupted and does not display correctly.
The same pdf file is correctly displayed if I send it immedi...
I'm using a Smarty template for my web application Registration / Sign-up form.
The form is slow to load, can I cache the registration form in order to speed up the loading of the page?
On the form page, I use SESSION and do lots of PHP error checking to ensure that the form fields are completely & correctly inputted. If not, I redis...
Hello everybody!
My urls for posts in WordPress looks like this:
http://localhost:8888/blabla/book/yes-vi-testar
Using the_permalink() would generate "http://localhost:8888/blabla/book/yes-vi-testar" but I want to cut the first 34 characters to get a string like "yes-vi-testar". How do I use php substr in a case like this? I'm confused...
I am creating a login script that stores the value of a variable called $userid to $_SESSION["userid"] then redirects the user back to the main page (a side question is how to send them back where they were?). However, when I get back to that page, I am echoing the session_id() and the value of $_SESSION["userid"] and only the session i...
I'm looking around for an open source form building package for PHP, and figured the hive-mob-mind of StackOverflow might be able to tilt me in the right direction.
Specifically, I'm looking for a form/survey builder application. I want something that lets an end user use a web based GUI to create and configure/surveys and web-based fo...
I'd like to store 0 to ~5000 IP addresses in a plain text file, with an unrelated header at the top. Something like this:
Unrelated data
Unrelated data
----SEPARATOR----
1.2.3.4
5.6.7.8
9.1.2.3
Now I'd like to find if '5.6.7.8' is in that text file using PHP. I've only ever loaded an entire file and processed it in memory, but I wonde...
hi,
can somebody explain steps i should follow to implement SSO on php based website. e.g user logs in to www.siteA.com and when he goes to www.siteB.com he should be already logged in. (in my case). how siteB would identify user? does user has to enter openid again?
...
Im using the following code:
function GetTwitterAvatar($username){
$xml = simplexml_load_file("http://twitter.com/users/".$username.".xml");
$imgurl = $xml->profile_image_url;
return $imgurl;
}
function GetTwitterAPILimit($username, $password){
$xml = simplexml_load_file("http://$username:[email protected]/account/rate_limit_status...
How do I cache everything on a Smarty template page except for a small portion of the content (which is truly dynamic)?
...
I have a large complex PHP project made up of many PHP files.
Is there some function I can call in my code that will return a list of all included files?
...
Hello!
I'm trying to parse XML feed with SimpleXML, here is a chunk of the XML tree:
<item>
<game:name>Tetris</game:name>
<game:desc>Way Cool Game</game:desc>
<size>5mb</size>
</item>
Well actually, I can succesfully access 'size' with something like that: $item->size, but how do I get value? Of course I can't call like that: $ite...
When a person registers on my site, or logs in, they are sent to "thanks.php".
The page checks is you're logged in or not and if so, tells you what you can do and if not, gives you a link to the register.php page.
However, anyone can make their own cookie and trick the script like that.
How do I protect myself from this?
One thing I ...