php

Ajax request to same page

This question may seem completely stupid, but say i have a PHP page with some form processing at the top in php and a html form underneath with the action of submitting to same page and method of post. How do i get the result via ajax, ie. send form to self without refreshing the page, if that makes sense? Thanks ...

How to Encrypt&Decrypt passwords in PHP?

I want to Encrypt a passwords to this Syntax: CWsodEV5xi9F0D8Vxw1fSZ== I do not know what kind of this encryption for syntax please I want Encrypt & Decrypt Function! thanks ...

grouping by class in groups

Run out of ideas... I need to group all entries form database. There are fields ID, NAME, CLASS, CREATED. Output would look like this: <h2>3. Class</h2> <div class="cont"> 3rd class entries.. </div> <h2>8. Class</h2> <div class="cont"> 8th class entries.. </div> ... and more So if there are entries with class 3, they all go in the...

ajax POST not working, can't figure why

I have a simple AJAX function to send an id of an object to a php page My function looks like this: $(function(){ $("a.vote").click(function(){ //get the id the_id = $(this).attr('id'); alert(the_id); //ajax post $.ajax({ type: "POST", data: "?id="+the_id, ...

Read data from multiple rows PHP MySQL

I have a database to keep track of the services clients have. But need to be able to find all the services (on different rows) and display them in an HTML table. i.e. Service Company Status ------------------------------------- Service 1 Company 1 Complete Service 2 Company 2 Pending Service 3 Company 1 ...

Why is this Twitter API script failing?

I'm getting an error from this Twitter script that is causing the rest of the page to not load. Not sure why suddenly this is happening, where it was functioning properly for quite some time. The script looks like this, and it pulls the users current status: <?php $response = new SimpleXMLElement('http://twitter.com/users/show/tuscar...

Trouble installing PhpMyAdmin on windows 7

Hello all, I saw this to get PHP MySQL Apache configured on my windows 7 and was successful. But when I tried installing PhpMyAdmin as per the link I'm not able to get it installed properly. First it was not able to load mcrypt extension in PHP which i resolved by editing php.ini. But now the problem is when i type http://localhost/pma...

How to hide SQL queries from web browsers (PHP)

Hi, I'm new to this forum and have a dilemma with my MySQL/PHP site. Now I've created a function that will pass a SQL query to it and execute it. What I didn't account for was the fact my SQL query being passed to the function is showing up in the "view source" of all browsers; which is BIG security concern because hackers can see the ...

Using PHP to search a text file.

I'm trying to create a code to download mp3 files embedded in a page. It starts out as a submit form. You input the URL and submit it, and it writes the HTML source of that page to a text file. I also set the script to search the source to see if there is an audio file embedded. I suppose I should include that it's not in the format of f...

dynamic function arguments

I'm passing all my calls to a main mapping function and then it should dynamically call other function based on a string (until this part, things are easy) the problem is that I want to pass arguments to the second function and these parameters may vary. The following is given (should not be changed): function test1($x){ echo $x; ...

PHP Form handling multiple fields

What would be the best way to intercept multiple fields via PHP? Currently I have a login.php file which is pretty simple: <form method="POST" action="auth.php"> Code:<br /> <input type="text" name="code" /> <input type="submit" id="submit" value="Submit" /> <br /> Pass:<br /> <input type="text" name="pass" /> <input type...

PHP class for parsing diffs

Hello, I am writing a PHP script that needs to interpret Diff files as created by Git. How should I proceed if I want to parse the Diff file and basically print it in a completely different format? I have come across the Text_Diff PEAR library, but that one only creates the Diffs itself. Or rather, it only takes two different files as ...

PHP mkdir() and fopen() does not work - permissions problem? umask problem?

The following PHP script fails to create the directory. It will also fail to create the file (when the directory already exists). ini_set('error_reporting', E_ALL); define('ABSPATH', $_SERVER['DOCUMENT_ROOT']); echo ABSPATH . '<br /><br />'; $dir_to_make = ABSPATH . '/aaatest'; $file_to_make = ABSPATH . '/aaatest/aaatest.txt'; echo u...

Query for new replies on a comment table?

I have a standard comment_id/comment_parent_id setup on my mysql comments table (with a created timestamp). My question is what is the least process intensive query to get all NEW replies on a user's comment? Just like with the commenting systems that use a checkbox to email replies to your comment? Do you cookie a timestamp for last ...

PHP - An error occurred on line 100: Cannot modify header information - headers already sent

Before I begin I have 2 headers in my code, it is the last header in my code thats giving me some problems though and I want to know how can I fix my code without having to make major changes to it if possible so that I dont get this error any more? If it helps I have <? ob_start(); ?> already in my header include and <? ob_flush(); ?>...

MYSQL Select to file

I'd like to save the output from a "Select * FROM table1" in console to a file in PHP. What would be the most efficient way to do this in php? Edit: I'd like the output to be like the type in the console ie. +--------+--------+ | thing1 | thing2 | +--------+--------+ | item1a | item2a | | item1b | item2b | +--------+--------+ Also, ...

PHP snippet Code Security

I am writing this in PHP $edit_window = $database_info->timestamp + 86400; $current_timestamp = time (); if ($current_timestamp > $edit_window){ $database_info->editable = TRUE; } else { $database_info->editable = FALSE; } then if ($database_info->editable){ //do some major stuff } Somehow this code is w...

Determine if returning nothing.. PHP MySQL

I have the following code: <table> <thead> <tr> <th>Service</th> <th>Status</th> </tr> </thead> <?php $result = mysql_query("SELECT Service, Status FROM services WHERE Company='Company 1'"); while ($row = mysql_fetch_array($result)) { // ^ must be a single '=' !!!! echo '<tr><td>' . $row["Service"] . '</td...

Splitting a long page into a number of pages

I want to pull a dynamic content, which consists of a long text input with some images, into a div with a fixed width (300px) and height (1000px), the challenge is I cannot use overflow: auto in css when the content's length is exceeding the div's height (1000px), instead, I am asked to split the long content into pages with a pagination...

getting facebook most shared stuff

I was looking at websites like http://itstrending.com/, facediggs.com/ and I'm questioning myself how do they extract the most shared topics from facebook? I would like to build a similar widget for my blog. I searched the API but couldn't find anything. ...