php

Lose the value of $_SESSION[] when redirect

i have a problem, can't understund anyway. i have three files - index.php, admin.php, post.php in index.php i have <? session_start(); $_SESSION['login11_error'] = 'yes'; if(verifying username and password here, if they correct) { $_SESSION['login11_error'] = 'no'; header('Location: admin.php'); } ?> in admin.php i have <...

php curl, link label modifying through proxy website, not fully working

Here is the code <?php $url='http://isrc.ulster.ac.uk'; $var = fread_url($url);// function calling to get the page from curl $i=0; $linklabel = array(); $linklabelmod = array(); $link = array(); $dom = new DOMDocument(); @$dom->loadHTML($var); $xpath = new DOMXPath($dom); foreach($xpath->query('//a') as $element) { $linklabel[] = ...

SimpleXML won't return data properly

I'm using SimpleXML to parse a data file from an external source. I'm trying to pull a thumbnail from the result, which looks like this: <entry> <title>Ball_Punch</title> <author> <name>burningcandle2010</name> <uri>https://www.mochimedia.com/community/profile/burningcandle2010&lt;/uri&gt; ...

Too many frameworks for java web. Scared and Confused :(

I am an experienced Java developer who is trying to learn web development with Java presently. I also had web development experience with ASP.NET (c#) and PHP. I know what basic concepts (JSP, Servlet, Bean) and looking for a framework to go. My question is not "What is the best framework for Java" or something similar. After reading ...

How to avoid opening multiple connections to the DB with OOP PHP.

I've been a procedural programmer for over 4 yrs and it's time to start looking into OOP. With that said, let's say I needed to call two methods in my class. Each method requires a connection to the DB so that's two trips to the DB, which also opens multiple connections. Can this be avoided by having some sort of code in the application ...

Limit number of words on front page posts (on WP 3.0)?

I all, I have a blog with variying lengths of posts, and I want the homepage to only present the first (let's say) 100 words of the post. After which, it should (automatically) add "more". What is a good way for doing this with WP 3.0 ? (I found the "Content and Excerpt Word Limit" plugin: http://wordpress.org/extend/plugins/content-a...

What is a Good General Purpose Open Source IDE that is written natively for Windows?

Sorry to ask such a general question as I'm sure a lot of questions have been asked before about IDE's... but I specifically have major problems running IDE's that are written in non-native languages for Windows (like Java), NetBeans gave me horrible performance and I just tried Aptana and got a similar issue... I have a fast computer (...

Find out what type of form field was used to enter info in a form with PHP

Using PHP; is there a way to check what type of form field was used to enter info in a form. For example: was it submitted via a list/menu, radio button, text field, textarea, or checkbox. I have this info stored in the database; but I'm trying to see if there is a way to do it without querying the database or using hidden form fields ...

What is draw the structure of php application?

I have been asked to make a php application. There is a part in the requirements that says draw the structure of application and scripting as well. What does it mean? I have already done the script. Does it mean that I have to make a diagram of it, like DB diagram in dia or in some other software? If it is like UML design then ...

blocking login after X failed attempts

I'm trying to block login for x minutes after y failed attempts. I'm already planning to log user logins, so I guess I could use the same database to calculate if blocking needs to happen. My questions: does it make sense to use the same logs table to run the logic of the y failed attempts blocking? Some people have a table just for t...

Zend framework caching pagination results for different queries

Using Zend Paginator and the paginator cache works fine, but the same cached pages are returned for everything. Ie. I first look at a list of articles, when i go to view the categories the articles list is returned. How can I tell the paginator which result set i am looking for? Also, how can I clear the paginated results without re-que...

How do I load a view from a specific (shared) path in CodeIgniter?

I'm using CodeIgniter for several projects. What I haven't figured out how to do is have "shared" views across projects. For example, I'd like to be able to do something like this: $this->load->view ("mysharedview"); Where mysharedview.php does not exist in my project's application/views folder, but in a shared location that is used ...

Dear Santa - Storing multi-lingual data in serialised php in mysql!

Dear Santa, I hope you're reading this! I have to insert some data into a MySQL table. The data will be retrieved and then (at present) unserialized at which point the correct display language will be selected... I've managed to munge the data (text encoded with markdown) into a set of PHP statements, roughly along the following line...

Calculate total seconds in PHP DateInterval

What is the best way to calculate the total number of seconds between two dates? So far, I've tried something along the lines of: $delta = $date->diff(new DateTime('now')); $seconds = $delta->days * 60 * 60 * 24; However, the days property of the DateInterval object seems to be broken in the current PHP5.3 build (at least on Windo...

POST Headers being sent, but not recieved on server

In C#, I am working on a project to automatically update a separate server with an image and other form data and such... However, the PHP server isn't getting any of the POST data, it's only getting the headers and I can't figure out why. Here is what I am sending to the server (all new lines have CRLF): POST /new_reply/1 HTTP/1.1 Host...

PHP: Code to check image quality/pixelation (not compression rate but real quality)?

I want to know if its possible (and how) to check for real image quality (.jpg) using the GD library. Obviously we need to check for file size, colors, image size, and number of pixels and compare between them. For example if an 1200x600px image has a size of 60kb probably its in bad quality. But if the image is in grey scale, or uses ...

jQuery pass dynamic element id/value into PHP.

Hi, I want to pass the dynamicLi element id and text into the PHP which look like this. <ul id ='dynamicUL'> <li id='dynamicLi'><div id="fieldname">Field 1</div></li> <li id='dynamicLi'><div id="fieldname">Field 2</div></li> <li id='dynamicLi'><div id="fieldname">Field 3</div></li> </ul> The dynamicLi and the fieldname is ...

Is it bad practice to have PHP conditional statements directly called from the index file (mixed with HTML markup)?

Some people have told me that the following code is bad for HTML validation: index.php: line 1 ~ 5 (this one is OK. Just for reference): <?php include_once 'localization.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html> <head> line 15 (if Chinese is selec...

Zend_Mail sending special characters breaking email in client

I am using Zend_Mail to send an email of a log file, but it is sending dodgy characters that the mail clients don't like. My code: <?php $sBody = "errors.log (>= WARN):\n\n"; $rFile = fopen($sErrorsLog, "r"); while (!feof($rFile)) { $sLine = fgets($rFile); $sBody.= $sLine; } $oMail = new Zend_Mail(); $oMail->addTo($sTo) ...

Manipulate and loop through nested PHP arrays

Ok... I hate array's... I dont understand them and dont like working with them... but im working on a project where I have no control of the data I am pulling, but need a way to sort it into a format I can manipulate... So, the data looks something like this: $arr = Array ( [1] => Array ( [December] => a date here [December (2)] => a ...