php

Retrieving "likes" tied to users from a database

I'm new to database structure. I'm trying to create an app that allows users to like certain entries, but I want to be able to tie likes to users so that I can change the visuals before/after the like action. I think from research that I should have an 'entries' and 'users' table and then have a 'likes' table that ties the two to each o...

PHP memory_get_usage

Hello! I came across the PHP's memory_get_usage() and memory_get_peak_usage(). the problem is that I found that these two functions do not provide the real memory used by the current script. My test script is: <?php echo memory_get_usage(); echo '<br />'; $a = str_repeat('hello', 100000); echo '<br />'; echo memory_get_usage(); ...

php, preg_match, regex, extract specific text

I have a very big .txt file with our clients order and I need to move it in a mysql database . However I don't know what kind of regex to use as the information is not very different . ----------------------- 4046904 KKKKKKKKKKK Laura Meyer MassMutual Life Insurance 153 Vadnais Street Chicopee, MA 01020 US 413-744-5452 lmeyer@massm...

PHP MySQL Query to get most popular from two different tables

Hi all, I have two tables afrostarprofiles and afrostarvvideos created as shown below. artistid field in afrostarvideos is the primary id of afrostarprofiles. I want a single query that will return for me most popular afrostarprofile based on sum of views(afrostarvideo) and views of afrostarprofiles. i basically need an algorithm or ...

Loading a page that sometimes 'hangs' via PHP (Curl)

Hi, I'm trying to get information from a site by parsing/scraping it via PHP & Curl. But sometimes the current page doesn't finish loading, so the script runs without anything happening. It's a simple script like this... ... curl_setopt($curl, CURLOPT_URL, $url); $page = curl_exec($curl); ... Is there a way to simply retry the loa...

Login/Registration System with php and mysql

I would like to make a simple user login/registration system using php and mysql. I don't need to get any information beyond what is necessary for the user to log in and out. I want to make sure that the system is secure. The way that I currently understand how it should work is: Registration User enters their email address and passwo...

How do I get the list of mutual friends on Facebook using their API?

I am trying to get a list of mutual friends of myself and another user but none of the API I found in the documentation works. Either I get some weird permission errors that I can only get my friends list and no other user or I get the following error: Fatal error: Call to a member function friends_getMutualFriends() on a non-object in ...

passing data from javascript to php using Jquery.

Hi everyone. Maybe this question has been asked before but I am struggling in doing this. I have got a php file which does not include any piece of php code (might be in the future),it includes just javascript and some html. What I want to do is clicking a button in this php file to send some amount of data to another php file. put it ...

How can i extend PHP functionality beyond functions & classes libraries ?

Hello guys, I wanna know how to extend PHP functionality beyond frameworks, functions or classes libraries ? An example about what I am trying to achieve is to be able to create my own operators, make language constructs myself (like foreach, while .. etc). Also there are a lot of built in functions, they are just available globally not ...

how to get php to read in a string of words from a dropdown box?

Can any one please help me? I am new to php, currently I am trying to use $_POST['item'] to obtain a string (consists of many words) from a dropdown box and then process it. However, when I use $_POST['item'], only first word is returned, the rest of words are missing. I have a dropdown box, something like: echo "<form action='process_...

How do I configure PHP + Apache on Amazon EC2?

I am new to this of course. I am trying to configure PHP and Apache on a new Amazon EC2 AMI. This is a very lightweight server so the Micro instance fits the bill. I just need Apache PHP I ran sudo yam install apache2 sudo yam install php I copied info.php to /var/www/html info.php only contains <? phpinfo(); ?> when i brow...

Facebook Application post to wall

Hello there, I'm looking for a simple way to add a post to a user's wall when this one just allowed my application. I have the publish_stream & status_update enabled in the below code. 'req_perms' => 'email,publish_stream,status_update' Now I'm just looking how I could make a simple Wall post like "'username' is now using xxx applic...

Regex in preg_replace to detect url format and extract elements

I need to replace certain user-entered URLs with embedded flash objects...and I'm having trouble with a regex that I'm using to match the url...I think mainly because the URLs are SEO-friendly and therefore a bit more difficult to parse URL structure: http://www.site.com/item/item_title_that_can_include_1('_etc-32CHARACTERALPHANUMERICGU...

Package Manager Web UI Workflow: Does something for this exist?

NOTE: Unsure if this belongs on Server Fault at this stage... please move as necessary! I'm working on a project that has its own package management software and have come to a stage where I need a centralised and simple mechanism for creating new packages in a master repository. The following are my requirements: Front-facing web UI...

HTML/PHP - I need to create a 10 by 10 grid with a 100 boxes, each needs to be selectable

I've created the grid using tables, but can't seem to figure out how to allow the user to select a specific box in the grid. (i.e. user selects 3 boxes, each having xy coordinates, which I would need to store in a database) Maybe I should not be using tables and instead using divs? Any help would be appreciated. NOTE: I'm a newbie to...

How do I post XML?

How do I post a XML and get the response status from the response? I want to post <myExampleRequest><myValue>xyz</myValue></myExampleRequest> to http://domain.com/GetStatus.aspx The page responds with <myExampleResponse><status>True</status><Message></Message></myExampleResponse> ...

Secure Cookies?

I am slowly moving my (unreleased) CMS from $_SESSION to $_COOKIE. Content on the internet seems to be biased more towards $_SESSION (I assume because ease of use). I am looking for security tips on saving cookies. Currently, I am storing (somewhat similar WordPress) a cookie in the format: 'logged_in_%hash_key%' => "username | %hash_p...

Setting privacy control for the files to be played in embedded Quicktime player

Hello, I tried to find the player to play gsm file on my site. After searching on google, it seems quicktime player is the only ready to use player available. However, I have to provide the location of the gsm file to the quicktime plugin in order for it to play. I worry about the security issue that may cause by this since some files a...

How to use PHP CURL with frames?

I've been working with php curl to create a login script for my school's network, but I've hit a snag. I got my script to login, but the home page is made up of frames. The content isn't showing up for either frame, saying the url was not found on the server. The urls for each of the frames are relative, so the browser is looking on my s...

How to load data using jquery and json?

Hi i want to load data from mysql database to php page using jquery and json. When user choose the name from select box, it load the person data into the text field. this is my html code (select) <select name='name' id='name'> <option value='1'>John</option> <option value='2'>Marco</option> <option value='3'>Charles</option> </...