php

How to properly implement a custom session persister in PHP + MySQL?

I'm trying to implement a custom session persister in PHP + MySQL. Most of the stuff is trivial - create your DB table, make your read/write functions, call session_set_save_hander(), etc. There are even several tutorials out there that offer sample implementations for you. But somehow all these tutorials have conveniently overlooked one...

Sender address rejected

I'm trying to use PHPMAILER, but I keep getting: SMTP -> FROM SERVER:220 smart6.bol.com.br ESMTP SMTP -> FROM SERVER: 250-smart6.bol.com.br 250-PIPELINING 250-SIZE 13312000 250-VRFY 250-ETRN 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250 8BITMIME SMTP -> FROM SERVER:250 Ok SMTP -> FROM SERVER:553 : Sender address rejected: not owned by u...

What's the best way to include external content using php includes? (For web developers who love optimal practices)

I've checked lots of tutorials about including header, navigation and footer using php "include". But I ended up separating my html tags. For instance, my <div id="content"> is in "header.html" while it closing </div> tag is in the footer. This gives me some problem when I use jQuery and looks kinda messy. Is there a better practice to ...

any good php tutorial on how to send sms to phones?

did some google searching on the topic and most of the api's that existed required a dedicated server. ill be trying this on the local machine and am using wamp, would i need to go through a type of merchant (of some type) to be able to send sms's? and if you know of any tutorials list them. thanks ...

Which PHP CMS do you recommend for a website?

I am building a website and need to use a CMS. If I use an already made CMS, I need to be able to extend it easily. Is there a specific CMS that you recommend or should I make my own? ...

Working with Master / Detail SQL Data in PHP

I'm a newbie so bear with me. I'm making a little forum for fun. Check it: Categories: `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `position` int(11) NOT NULL, PRIMARY KEY (`id`) Forums: `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` text NOT NULL, `position...

Conditional SimpleXML possible?

Hi, I am pulling content from a xml file with simpleXML I was wondering if it is possible to display a certain node depending on the contents of the node. eg. <article> <title>PHP</title> <content>yada yada yada</content> </article> <article> <title>JAVASCRIPT</title> <content>yodo yodo yodo</content> </article> can simpleXML find...

Transfering encrypted data server to server, between 2 PHP scripts

I need to transfer data from a PHP script on my local server to a remote API (also written in PHP) on my hosting server. It is basically a primitive version control system, and I use both HTTP GET and HTTP POST to transfer files and strings. I would like the connection encrypted, but my (shared) web host tells me I can't use SSL because...

validation with variable variables not working

$method = 'post'; $method = strtoupper($method); echo $method.'test1'; $method = '_'.$method; echo $method.'test2'; $method = $$method; echo $method.'test3'; Why doesn't this print the content of $_POST between 2 and 3? ...

php's command line option parsing, howto

I'm using Console_Getopt in PHP 5.2, and finding it surprising about how different it is from getopt in other languages (perl, bash, java). Can anyone recommend how to parse the args from the array "$opts" returned? php myprog.php -a varA -c -b varB $o= new Console_Getopt; $opts = $o->getopt($argv, "a:b:c"); print_r($opts); // the p...

Notice: Undefined index

$thread_id = (isset($_GET['id'])); $thread_id = intval($_GET['id']); $q = mysql_query("SELECT * FROM threads WHERE id = $thread_id"); Can't you use two functions on one variable?? As you can see I check if its set but it still gives me: Notice: Undefined index: id in C:\wamp\www\bfhq\thread.php on line 7 ...

Connecting C# (frontend) to an apache/php/python (backend)

Overview: We are looking to write a C# user interface to select parts of our web applications. This is for a very captive audience (internally, for example). Our web applications are written in PHP and/or Python using Apache as the web server. Why? A well thought out native Windows interface can at times be far more effective than li...

How can I test if someones cookies are not working? (PHP)

Can someone show me a simple way I can test if someone's cookies are not enabled in php? I want to create a test script to determine if the user can properly use my site. If they cannot, I will redirect them to a couple screen shots to show them what to change. I am only using $_SESSION[] variables, and I beleive that the only thing t...

Is there a utility that will convert POSIX to PCRE for PHP?

Is there a utility that will convert POSIX to PCRE for PHP? I'm somewhat confused by the PHP manual on PCRE, and while I'll try to find more info on PCRE, I was wondering if anyone had designed such a utility. Or, if anyone would explain how to convert the following, that would also be fine: ereg("^#[01-9A-F]{6}$", $sColor) But pleas...

maintain object state with different pages using PHP

hi guys, how to do this using PHP OOP to maintain object state in different pages. the problem is im always instantiate the object on every page. is there a solution that i instantiate it once and maintain its object on different pages. Thanks in advance ...

Need help about how to retrieve Bangla in PHP from MS doc file

Dear everyone, I want to retrieve bangla data that written in MS word file Using UNICODE.How can I retrieve this data using PHP.I can retrieve english data from doc file using antiword.But i can not retrieve bangla.Pls help me as soon as possible. It is very much urgent for me. ...

Is my authentication encryption any good?

So I've been reading a lot about encryption in PHP. So much that I am not sure exactly what's a really good method to securely store login information. However, the following function is what I came up with: function loginHash($username, $password){ $salt = str_split($password,(strlen($password)/2)+1); $hash = hash('whirlpool',...

dynamically including php scripts

Hello I'm developing own CMS and i want to implement functionality to dynamically include existing PHP script which are located on the server. there is variable called $page_content which contains page contents including HTML and JS code, also it contains some text recognised by regex, recognised text is then processed and replaced wit...

PHP filter for non standard characters

I get text as user input and somewhere in the text there are no standard characters, like this. The text is stored to a database. Everything is in UTF-8 and it works well, only it displays strange signs for the non standard characters. How can I filter these characters in PHP? Edit: I discovered that the text with the wrong charact...

zend not using columns, and selecting everything

Hi, I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when I run it, the entire row is selecte...