PDA

View Full Version : PHP variable length table



no925
09-24-2006, 07:23 PM
Hi I have created a redirect php page that I use under my links.
The link goes to the php, records the click in a text file and redirects to the actual website.

I have then created a page to view the text file. PHP produces a table containing the information.

I then want other items on my page such as "top of page" etc.
I have put the table php in a html box. If I put my other items on the BV page as normal they appear under the table. So I put them in the HTML box as well.

The drawback is you can not see them and it makes the layout tricky.

http://www.no925.info/varform2.jpg


THE RESULTS


http://www.no925.info/varform1.jpg


Q) Is there a better way of doing this to help with the layout?

Andy128
09-24-2006, 07:46 PM
Do you want it so that every one can see it once the page is clicked on? You could have the info put into a CSV file with link that would open it once clicked. The advantage is that your page layout remains static with respect to size and location of viewable items. It would also make it easier to edit and seperate headers by week, month, day etc....


Just a thought.

Andy

no925
09-24-2006, 07:55 PM
OK thick moment: CSV File??

I only mean easy to view during the design stage in BlueVoda. (For me)

The published page is not for general viewing. (It will not be linked)
Instead the affiliate will have a link e.g www.no925.info/viewlog.php?id=1234

The script in the php loads the text file into an array and only displays the entries with the correct id.

This is only a simple design as I'm not up on SQL yet.

Andy128
09-24-2006, 08:14 PM
Me too (not being into mysql). A CSV file is easy to estabish to collect info from a form or php script and store. It stores it in an Excel type format.

I am at work right now. When I get home after 7 pm I will post back and give the full directions with an example.

Andy

no925
09-24-2006, 08:21 PM
Many thanks.

Andy128
09-24-2006, 08:25 PM
One question- I take it that the link is actually a mini-form? If I assume incorrectly, could you explain the process by which the link goes to a php file and the "click" is recorded.

Thanks-

Andy

no925
09-25-2006, 09:38 PM
First of all apologies for the delay in replying. I had set instant email alert but got nothing.

The link is just a normal link. <a href="www.mysite.com/go.php.......">

for GO.PHP I just opened a blank page in BV opened page HMTL and in the start I inserted the php code below. So there is no form hidden or visible.

The user is unaware of anything.

I add a couple of parameters to the link namely the affiliate 'id' and the 'site' url I want to go to.

So the link will read: www.mysite.com/go.php?id=123&site=www.yoursite.com (http://www.mysite.com/go.php?id=123&site=www.yoursite.com)

The script will add a log entry like this:
123,88.123.12.164,Sun 24-Sep-06 07:24:22,http://www.yoursite.com,http://www.mysite.com/mypage.html

and go to: www.yoursite.com (http://www.yoursite.com)


Clever or what! For my first bit of php I'm impressed. (unfortunately I found the clever part of it on another forum)

<?php #Script to log links to other sites
date_default_timezone_set('Europe/London');
$user = $_SERVER['REMOTE_ADDR'];
$code = $_GET['id'];
$site = 'http://www.' . $_GET['site'];
$log = fopen("links.log", "a");
fputs($log,$code . ',' . $user . date(',D d-M-y H:i:s,') . $site . ',' . $_SERVER['HTTP_REFERER'] . "\r\n");
fclose($log);
header ('Location: ' . $site);
exit();
?>

Any way this is all working fine. I even have a: viewlog.php?id=123 so the affiliate can see who has visited him from my site. This is where the thread started.

As you see the log is just a comma delimited simple file and with php I put it in a table.

I then want to add items to the BV page at design stage but because I do not know how long the table will be you have to put all the other items in the HMTL box.

Hope that clears things up.

Andy128
09-26-2006, 11:44 PM
One solution (easier that what I was proposing earlier) would be to create an I-Frame it the middle of the page. The log would present inside the I-Frame and you could then put items on the web-page where you wish as they would be uneffected buy the lenght of the table as it is in a scrollable I-Frame.

I believe this would be your best bet. I like the log table format you set up.

Andy

no925
09-26-2006, 11:56 PM
BRILLIANT !!!

How simple is that?!!?

Sometimes the answer is so obvious you wonder why you never thought of it. Well done sir.

I guess thread is CLOSED

Many Thanks
Richard

no925
09-27-2006, 12:57 AM
Well I said it was simple.
All done and published in 35 minutes.

I just thought I would show the results in case any one was interested at a later stage.
--------------------------------------


I can now see the footer layout at design stage.

http://no925.info/forumpics/vislog2.jpg


And it looks good when published. I can now have a really long table but keep the page short and easy to view.


http://www.no925.info/forumpics/vislog1.jpg

Andy128
09-27-2006, 01:06 AM
Very nice Richard- glad it all worked out.

Andy