MDGM 22 Posting Whiz in Training

What do you mean by:
2) It does bring back everything from the table

As for bringing it back in a table, use this:

<?php

//do your query
$result = mysql_query("SELECT * FROM bookings WHERE bookingID='".$last_insert_booking_id."'");

//because your query uses a primary key, we only have one result and so don't have to use the while function. instead, save all the query results into an array.
$result_array = mysql_fetch_array($result);

//setup your table
echo '<table>';

//for each piece of information saved in the array, display it to the user.
foreach($result_array as $key => $value)
{
	if( !is_int($key) )
	{
		echo '<tr><td>';
		echo $key;
		echo '</td><td>';
		echo $value;
		echo '</td></tr>';
	}
}

//cloes your table
echo '</table>';
MDGM 22 Posting Whiz in Training

Iv editted the code. Use this instead:

<style>
<!--
body{
background-color:#FFFFFF
}
div#Navigation{
width:115px;
font-family:verdana, arial, helvetica, sans-serif;
}
div#Navigation ul{
list-style:none;
margin:5px 0;
padding:0;
}
div#Navigation ul li{
display:block;
border-style: single;
background-color: #FF0000;
padding-right: 5px;
text-align: right
}
div#Navigation ul li:hover{
display:block;
padding-right: 5px;
text-align: right
}

div#Navigation ul li a{
color:#000000;
text-decoration:none;
display:block;
}
div#Navigation ul li a:visited{
color:#333333;
text-decoration:none
}
div#Navigation ul li a:hover{
color:#000000;
background:#FFFFFF;
text-decoration:none
}

-->
</style>
</head>
<body>
<div id="Navigation">
<ul>
<li><a href="lessons/6th/6th_main.htm" target="mainFrame">6th Grade</a></li>
<li><a href="lessons/7th/7th_main.htm" target="mainFrame">7th Grade</a></li>
<li><a href="lessons/8th/8th_main.htm" target="mainFrame">8th Grade</a></li>
</ul>
<ul>
<li><a href="RC/rc.htm" target="mainFrame"><strong>Rachel's Challenge </strong></a></li>
</ul>
<ul>
<li><a href="lessons/8th/high_school_opportunities/high_school_opportunities.html" target="mainFrame"><strong>High School Classes (8th)</strong></a></a></li>
</ul>
<ul>
<li><a href="keyboarding/keyboarding2.htm" target="mainFrame">Keyboarding</a></li>
<li><a href="http://www.gaggle.net" target="mainFrame">Gaggle.net</a></li>
<li><a href="http://ps.ksd.org/public/Home.html?Choose=false" target="mainFrame">GRADES</a></li>
<li><a href="http://www.google.com/calendar/embed?src=tt6er5ta7fmajrv0j8b9h74lh0@group.calendar.google.com&amp;ctz=America/Los_Angeles" target="mainFrame">CALENDAR</a></li>
<li><a href="about_mr_larsen/about_mr_larsen.htm" target="mainFrame">About Mr. L</a></li>
<li><a href="policies/policies.htm" target="mainFrame">Class Policies</a></li>
<li><a href="Contact/contact.htm" target="mainFrame">Contact</a></li>
</ul>
</div>
</body>
</html>

the problem is where you said

div#Navigation ul li:hover{
display:block;
background-color:#999999;
padding-right: 5px;
text-align: right
}

padding of 5px revealed the #999 background color.

Hope that helps

Max

MDGM 22 Posting Whiz in Training

yeah sure. assuming you understand arrays, the foreach function cycles through each array segment and runs a specific piece of code for that segment. The segment's title is saved in the $key variable, and it's contents is saved in the $value variable.

So from your mysql query, the $result_array would be filled with each columns value. The $key will be the column name, and the value of it will be the value of that column in the query.

So doing this:

echo $result_array;

would write that user's booking id.

doing this:

echo $result_array;

would write that users first name (providing that information was saved in the database of course...)

Hope that helps. Max

MDGM 22 Posting Whiz in Training

mysql_query("DELETE FROM user_notifications WHERE username='".$acc."' AND notification='".$note2."' "); that should be fine. if its not, try checking your $acc and $note2 variables...

MDGM 22 Posting Whiz in Training

try this:

<?php

//do your query
$result = mysql_query("SELECT * FROM bookings WHERE bookingID='".$last_insert_booking_id."'");

//because your query uses a primary key, we only have one result and so don't have to use the while function. instead, save all the query results into an array.
$result_array = mysql_fetch_array($result);

//for each piece of information saved in the array, display it to the user.
foreach($result_array as $key => $value)
{
	if( !is_int($key) )
	{
		echo $key.' | '.$value.'<br />';
	}
}

?>

That will write all the results nicely to the page with titles for the user. You can organise it nicely into tables by changing the code echo'd in the foreach section if you want.

Max

MDGM 22 Posting Whiz in Training

Hi all,

I need to do a query like this:

SELECT * FROM table1 WHERE ( SELECT COUNT(*) FROM table2 WHERE fbid = *current primaryKey*) > 150

How do I get the *current primaryKey* in order to do the second section of the query?

Max.

MDGM 22 Posting Whiz in Training

Thanks for all the replies, I can tell that in future ill be referring to all this info, so thanks :)

Iv gone with floatval(), it seems like the simplest and at the moment does exactly what I want.

Thanks again

Max

MDGM 22 Posting Whiz in Training

okay, so if I wanted to echo 10.000 as 10, I would have to just shave off the appended 0's?

How would I do this? Can anybody post a simple script to remove the appended 0's?

Max

MDGM 22 Posting Whiz in Training

I have tried decimal, but it always adds 0's onto the end of my number.

I want it to only add the exact number I enter in, so for example at the moment if i enter in 10, it changes it to 10.000 whereas I want it just to save 10...

Max

MDGM 22 Posting Whiz in Training

Hi all,

I need to save a number to 3 decimal points, however I want 10.3 to be saved like this:

10.3

not this:

10.300

varchar will not work because ORDER BY rating treats 10 as being lower than 9... So what datatype should I use?

Thanks,

Max.

MDGM 22 Posting Whiz in Training

****************SOLVED****************

silly mistake, the column `rating` was a varchar, and so when sorting by rating, it treated 10 as being lower than 9. Iv changed it to integer and it works fine.

MDGM 22 Posting Whiz in Training

Hi,

Im having a wierd problem with my mysql query:

I have entries in my database with a rating (out of 10) and a timestamp, and I want to pull out the highest rated entry from the past 30 days. These are the entries I have:

Primary key ----------------- Rating ------------------ Timestamp
1                                3                    979818943
2                                6                    1232277417
3                                9                    2147483647
4                                10                  1232811754

This is my query:

$SecondsInOneMonth = 2629743;
$time = time() - $SecondsInOneMonth;

$result = mysql_query('SELECT * FROM images WHERE `timestamp` > "'.$time.'" ORDER BY ratingav DESC LIMIT 1');

The result from the query pulls out the item with primary key 3.

Any reason why?

Thanks in advance.

Max Mumford.

MDGM 22 Posting Whiz in Training

Hi all,

I'm looking for a tutorial on how to make a dynamic flash photo gallery. I want it to do the following:

  • Automatically detect images in a folder without having to manually list them in an xml file
  • have simple next and previous buttons

I'm not great with flash so I don't want anything too complicated.

If anybody knows of the kind of thing I'm looking for id be very grateful!

Thanks in advance.

Max.

MDGM 22 Posting Whiz in Training

no luck with that post dickersonka :/

Also the problem with this is that google checkout will only accept the information through posted hidden fields with their specific parameters, and as far as I can see I have met all their requirements which is really wierd because it is still not working.

I *think* iv sent them an email about it but theyr crazy support system is ... well ... crazy.

Max

MDGM 22 Posting Whiz in Training

Hi all,

I know it sounds stupid (the title of this thread) but I am using php to write some hidden fields to a form and when the form is submitted some of the hidden fields are not being sent. They currently only work when google chrome, and do not work with IE(6), firefox or safari.

What the hell?!? :P Im stuggling to find the cause of this problem. Does anybody have an insight?

The form script i am using is below:

<form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/*merchantID*" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_blank"> 
<input name="_charset_" type="hidden" value="utf-8"/>

<input name="item_name_1" type="hidden" value="Matt Clay Extreme Style V05"> 
<input name="item_description_1" type="hidden" value="Extreme Matt Clay from V05"/> 
<input name="item_quantity_1" type="hidden" value="1"/> 
<input name="item_price_1" type="hidden" value="5.00"/> 
<input name="item_currency_1" type="hidden" value="GBP"/> 

<input name="item_name_2" type="hidden" value="Polishing Wax Fructis Style Garnier"> 
<input name="item_description_2" type="hidden" value="A polishing style wax from garnier."/> 
<input name="item_quantity_2" type="hidden" value="2"/> 
<input name="item_price_2" type="hidden" value="4.00"/> 
<input name="item_currency_2" type="hidden" value="GBP"/> 

<!-- below are the fields that are not being submitted - google checkout ends up with NO shipping costs unless user is using google chrome -->
<input name="ship_method_name_1" type="hidden" value="Standard delivery"/> 
<input name="ship_method_price_1" type="hidden" value="9"/> 
<input name="ship_method_currency_1" type="hidden" value="GBP"/> 
<input type="submit" value="Continue to Google Checkout"> 
</form> 

<script language="javascript" type="text/javascript"> 
document.getElementById("BB_BuyButtonForm").submit();
//history.go(-1);
</script>

Thanks in advance,

Max.

MDGM 22 Posting Whiz in Training

dont worry, iv figured it out. Do something like this:

explode the cart into an array.
foreach($cart as $pid)
{
if the pid is in the array, do nothing
else: use substr_count to get the QTY
echo
add pid to array
}

MDGM 22 Posting Whiz in Training

Hi all,

I have a shopping basket feature on my website which saves the product's primary key in the session array called 'cart', each one seperated by a comma, so example: '123,456,789'.

Now in order to get each item from my shopping basket to paypal I need to write 2 hidden form fields onto the page containing the product name and price, however if the user has more than one of the same item, I want it to write a hidden field for the quantity instead of simply writting the same product over and over again.

Here is the script i currently have:

$cart = $_SESSION['cart'];
$items = explode(',',$cart);
foreach ($items as $pid) //pid is the product's primary key
	{
		$i = $i + 1;
		$pricequery = mysql_query('SELECT * FROM products WHERE pid = "'.$pid.'"');
		while($price = mysql_fetch_array($pricequery))
		{
			echo'<input type="hidden" name="item_name_'.$i.'" value="'.$price['name'].' '.$price['series'].' '.$price['manufacturer'].'"><input type="hidden" name="amount_'.$i.'" value="'.$price['price'].'"><input type="hidden" name="quantity_'.$i.'" value="'.$qty.'">';
		}
         }

As you can see from the code, $qty has not been set. This is where I am having my difficulty. I was thinking for each product you could add it's PID into an array then check if the pid is in the array before deciding wether or not to write the quantity, however the problem occurs when having to go back and change the quantity field that has been echo'd because another product with the same PID has been found in the cart array.

Sorry for the lenghty description etc! I hope somebody …

MDGM 22 Posting Whiz in Training

.. that will be farrrr to vague. iv looked a lot into this already and havnt got anywhere. anyway if anybody is in the same boat and is looking for some kind of server-side video to .fla converter and flash video player try going here for the serverside converter:

http://www.encoding.com

MDGM 22 Posting Whiz in Training

anybody? :P

MDGM 22 Posting Whiz in Training

ahh fantastic, thanks for the script. I think I just dived in head first without trying to understand whats happening where first which is why my variables were so scrambled.

just incase anybody else wants to use the script I changed the permissions on my files to 755 and it worked great :)

Thanks again, much appreciated.

Max

MDGM 22 Posting Whiz in Training

Hi all!

Im making an upload script that uploads an image file, saves it and saves a thumbnail copy in a different directory.

I have tried a couple of scripts and have found one which I think will work nicely but i cannot get it working.

The script is below:

<?php
//get values for other required vars
$filename = $_POST['uploadfile'];  //origional filename
$filetype = $_FILES['uploadfile']['type']; //uploaded filetype
$filesize = $_FILES['uploadfile']['size']; //uploaded file size
$filenametmp = $_FILES['uploadfile']['tmp_name']; //uploaded file's server side temporary name

$uploaddir = '../images/'; //upload directory
$uploadfile = $uploaddir.$iid.basename($_FILES['uploadfile']['name']); //upload directory + rand + origional name

$size = getimagesize($filenametmp);
$width = $size[0];
$height = $size[1];

//get file extension for validation
$ext = strrchr($file_name,'.');
$ext = strtolower($ext);
$limitedext = array(".gif",".jpg",".png",".jpeg",".bmp");	
$getExt = explode ('.', $filename);
$file_ext = $getExt[count($getExt)-1];

//set width variables
$ThumbWidth = 80;

	if($filesize){
		//keep image type
		if($file_type == "image/pjpeg" || $filenametmp == "image/jpeg" || $filenametmp == "image/jpg")
		{$new_img = imagecreatefromjpeg($filenametmp);}
		
		elseif($file_type == "image/x-png" || $filenametmp == "image/png")
		{$new_img = imagecreatefrompng($filenametmp);}
		
		elseif($file_type == "image/gif")
		{$new_img = imagecreatefromgif($filenametmp);}		
	}//if


		//make width and height array from getimagesize returned array
		list($width, $height) = getimagesize($filenametmp);
		
		//calculate the image ratio
		$imgratio=$width/$height;
		if ($imgratio>1){
		$newwidth = $ThumbWidth;
		$newheight = $ThumbWidth/$imgratio;}
		else{
		$newheight = $ThumbWidth;
		$newwidth = $ThumbWidth*$imgratio;}
		
		//resize image.
		$resized_img = imagecreatetruecolor($newwidth,$newheight);
				
		//the resizing is going on here!
		//error 1 results from the line below:
		imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
		
		//finally, save the image
		ImageJpeg ($resized_img,"../thumbs/".$iid.$file_ext);
		ImageDestroy ($resized_img);
		//error 2 results form the line below:
		ImageDestroy ($new_img); …
MDGM 22 Posting Whiz in Training

okay thanks. I only need to check to see if a single PID is saved inside the cookie so will this work:

if (eregi($pid, $_COOKIE['RATED_PRODUCTS']))
{
	echo 'you have already rated';
}
else
{
	echo $ratingsystem;
}

To make the PID i'm using rand(0,99999); so it is unlikely that one PID will be found inside another one... but is there a possibility that it might?

Max

MDGM 22 Posting Whiz in Training

so each PID would be seperated by a ':' and to check if the user has already rated it I would have to search for the PID within the value of the cookie?

How long can the cookie value be anyway?

Thanks for the help by the way.

Max

MDGM 22 Posting Whiz in Training

hii all,

I have a 5 star rating system which writes a cookie as the following when the user rates a product:

$pid = $_GET['pid']; //product ID (primary key)
$ratepostpone = 300; //5 minutes until it expires and the user can rate again
$cookieroot = '.mysite.com'; //my website's directory including sub domains

setcookie('ms-'.$pid,'ms-'.$pid,time()+$ratepospone,'/',$cookieroot);

However I'm finding that when I vote on two products within 5 minutes of each other it is overwritting the cookie. When I check what cookies I have saved on my computer it lists one cookie (ms-483243) and then if I rate another product and re-check my cookies it has deleted ms-483243 and replaced it with (ms-218572)

any ideas why?

Thanks in advance,

Max

MDGM 22 Posting Whiz in Training

okay, thanks for the advice sDJH and jbennet, I think ill go for the cookie option and use the product ID number (primary key) as the cookie name and ise php's isset function.

Thanks again :)

MDGM 22 Posting Whiz in Training

Hi all,

I'm looking for a flash video player tutorial / open source .fla file with simple features e.g. buffering progress, play/pause, stop & scollbar.

I also need to be able to dynamically load the video file either using a GET method from the address bar or by using PHP to change the parameters of the flash file inside the source code of the file.

Thanks in advance :)

Max

MDGM 22 Posting Whiz in Training

Hi all,

Iv made a simple 5 star voting system and need a way to make sure the user can't vote on the same product again in the next hour.

I'm not a mathmatician and get really confused with the time calculations and have tried quite a few methods now and have not got anywere.

What would be the best way to do this? Cookie? Save their IP and timestamp in a database and work out if they are aloud to vote from that?

Thanks in advance,

Max

MDGM 22 Posting Whiz in Training

Sorted. its probs not the most efficient code but it works. :)

$q = $_GET['q'];

//bit of sanitizing
$qtrim = strtolower($q);
$qtrim = stripslashes($q);
$qtrim = strip_tags($q);

//split values by whitespace into an array, then for each array member stick them together with "OR columnname LIKE '%$arrayvalue%' "
$qtrim = explode(' ',$q);
foreach($qtrim as $value)
	{
		$qtrim = $qtrim."OR fullname LIKE '%".$value."%' ";
	}
//we now have a string which has the following value:
//OR fullname LIKE '%".$value1."%' OR fullname LIKE '%".$value2."%' 

//we now need to remove the first OR, so the string looks like this:
//fullname LIKE '%".$value1."%' OR fullname LIKE '%".$value2."%' 
$qtrim = substr($qtrim,2);

//then we use the string in a mysql query
$query  = "SELECT * FROM products WHERE ".$qtrim;

//execute query
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
      echo $row['fullname'];
}
MDGM 22 Posting Whiz in Training

I want to return all results with EITHER john OR smith in.

Also the query needs to be dynamic, i.e. accept more than 1 / 2 words.

Thanks :)

MDGM 22 Posting Whiz in Training

Hi all,

Iv looked at quite a lot of forums and cannot get the code to work properly for searching multiple search terms. I have tried exploding the search string and then doing a search similar to this:

WHERE fullname LIKE '%$1%' OR fullname LIKE '%$2%'

but it has not worked so I need a quick point in the right direction! Below is the code I am currently using which searches for a record that contains the whole phrase (e.g. john smith, NOT john or smith which is what I want.)

//connect to db
include('../../php/database/connect.php');

$q = $_GET['q'];
$q = strtolower($q);
$q = stripslashes($q);
$q = strip_tags($q);

$query  = "SELECT * FROM products WHERE fullname LIKE '%".$q."%' ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo $row['fullname'];
}

Thanks in advance!! :)

MDGM 22 Posting Whiz in Training

damn. okay thanks anyway :)

MDGM 22 Posting Whiz in Training

hi all,

I'm using dreamweaver templates to make my site, however when I want to use the session_start(); function in php, the headers have already been sent because dreamweaver writes the following into the page:

<!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->

and so I am having to put in the session_start function manually at the top of every page before the above code. Is there any way to get around this?

Thanks in advance!

Max.

MDGM 22 Posting Whiz in Training

Thanks for the help :)

MDGM 22 Posting Whiz in Training

Iv solved it:

save all votes in a longtext field in the database with each number seperated with a comma and use the script below to average the score to the nearest whole number:

#set rating average

//explode ratings into an array
$rating = explode(',',$rating);

//get the total number of ratings
$ratingscount = count($rating);

//add everything within the array
foreach($rating as $value)
{
$ratingstotal = $ratingstotal + $value;
}

//create final rating average
$ratingav = $ratingstotal / $ratingscount;

$ratingav = round($ratingav);

remember, your final rating value is now $ratingav, not $rating.

:) hope this helps people in the same situation as I was.

MDGM 22 Posting Whiz in Training

oh! I didnt realise you could change the type to medium int to increase the limit. I thought it had a 255 character limit. Well thats fine then :) You learn something everyday.


Okay so ill save all the results, explode them all into an array, count the array length, add all the arrays together, add the new vote and increment total votes by one then divide the total votes by total length.

How do I add every section of an array together?

Do you think the following makes a goo starting point?:

$pid = $_GET['pid'];
$newrating = $_GET['rating'];

include('../../php/database/connect.php');

$query  = "SELECT * FROM products WHERE pid = '".$pid."'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
explode(',',$votes);
$votesnumber = count($votes);

Max

MDGM 22 Posting Whiz in Training

Yes I see what you mean. So I would need to store every vote in a database.

I was thinking something similar to this might work:

$pid = $_GET['pid'];
$newrating = $_GET['rating'];

include('../../php/database/connect.php');

$query  = "SELECT * FROM products WHERE pid = '".$pid."'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
explode(',',$votes);
$votesnumber = count($votes);

but I do not know where to go from there. Also there is a problem with the character limit in a MySQL database and eventually I would run out of voting space?

MDGM 22 Posting Whiz in Training

okay, thanks a lot. reply when you have time :)

MDGM 22 Posting Whiz in Training

okay all the images and rollover's are sorted out now. it was just a simple mistake with the php script. try rating an item as 5 star about 5 times and eventually you will see the new rating on the next page decrease instead of decrease

MDGM 22 Posting Whiz in Training

click one of the 5 stars

MDGM 22 Posting Whiz in Training

i got the mysql_query code from phpmyadmin and just left it as is. pid is my primary key so i can take it out..

iv just tried taking out the limit and it still has a problem. Here is a link to a preview page..

http://www.grafax.co.uk/OTHER/zavvex/shop/viewbycat.php?category=all

just vote on any of them a few times and it will start messing up.

MDGM 22 Posting Whiz in Training

Hi,

Im making a 5 star rating system but half the time it has the complete wrong result. I have gone over and over the script and checked the sums with a calculator and it is still doing something wierd. Sometimes when I rate it above it's current rating it moves the overall rating down...

The page that links to the php file just has links to the php file with the appropriate PID (product ID) and user's rating, for example index.php?pid=1234&rating=5. The ratings are between 1-5.

anyway, the code I currently have is below:

(by the way, apologies for the crappy notes, im not a mathmatician so find it difficult to explain what i'm doing.)

//get product id and user's rating
$pid = $_GET['pid'];
$newrating = $_GET['rating'];

//connect to db
include('../../php/database/connect.php');

//get current values from that product in the db
$query  = "SELECT * FROM products WHERE pid = '".$pid."'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
//get current number of rates
$numberofrates = $row['numberofrates'];
$numberofrates = (int)$numberofrates;
//get current rating
$rating = $row['rating'];
$rating = (int)$rating;
//multiply current rating by number of ratings then increment number of rates by 1 to include new rating, and add user's rating to total rates to recreate average
$rating = $rating * $numberofrates;
$newnewrating = $rating + $newrating;
$numberofrates = $numberofrates + 1;
$newnewrating = $newnewrating / $numberofrates;

mysql_query('UPDATE `web163-zavvex`.`products` SET `rating` = "'.$newnewrating.'" WHERE `products`.`pid` = "'.$pid.'" LIMIT 1');
mysql_query('UPDATE `web163-zavvex`.`products` SET `numberofrates` = "'.$numberofrates.'" WHERE …
MDGM 22 Posting Whiz in Training

Hey,

Thanks for the advice. Since it was quite an urgent problem i just went out and got a temporary video card which fixed the problem. Not sure what was wrong with my old one but replacing it has fixed the problem.

thanks again

MDGM 22 Posting Whiz in Training

Hi all,

I wasnt sure wether to put this in the web design forums or here because it contains a bit of both - im not sure if the concept is even possible but its very interesting, possibly difficult and longwinded but potentially very rewarding

First a bit of background knowledge:

I have a reseller business which resells the same products that a hosting company offers. We pay them a certain amount per month and we get completely free unlimited web hosting but we have to pay for domains. However the catch is that registering a hosting package relies on entering the customer's details into the customer details. This can be done automatically using their website templates (lets call these "hostpay"), however we do not have access to change these templates and so they are very restricting. If we decide to use our own website design it all has to be done manually. This obviously takes a lot more time and limits our ability to serve multiple customers immensely.

My idea

What i want to work out how to do, is use our register form to enter the details the user put in, into their hostpay template so it is all automatically registered. Because I want to do this behind the scenes, i thought it would be best to write programs for the server to execute. Here is what i was thinking:

  1. The user submits their information using a form to handle.php
  2. handle.php then …
MDGM 22 Posting Whiz in Training

okay thanks. I was wondering if it is okay to write a page's content using php's include files.

thanks for the help.

MDGM 22 Posting Whiz in Training

That worked fine, thanks for the help.

MDGM 22 Posting Whiz in Training

Hi all,

I am trying to edit this script so that it not only changes offsite targets to _blank, but also changes their href from their original link, to http://www.mydomain.com/externallinks/+origionallink

Can somebody help me find out what is wrong with this script? It is editing the target and href of onsite links as well, even though before i made my changes it was working as i want it.

This section of the code is intact:

//Open offsite links in new window script- http://www.dynamicdrive.com/
//Created: August 28th, 2007'

var ddwindowlinks={
//1)Enter domains to be EXCLUDED from opening in new window:
excludedomains: ["mydomain.com"],

//2) Target for links that should open in a new window (ie: "_blank", "secwin" etc):
linktarget: "_blank",

//3) Specify operating mode ("auto" or "manual"):
mode: "auto",

//4) If mode is "manual", customize checkbox HTML to show to users (Preserve id attribute):
toggleHTML: '<form><input type="checkbox" id="targetcheckbox" checked="checked" /><label for="targetcheckbox">Open off-site links in new window?</label></form>',

//5) If mode is "manual", enable user persistence so the state of the checkbox is remembered?
persist: true,

This part of the code has been edited:

assigntarget:function(){
	var idinc = 1
	var rexcludedomains=new RegExp(this.excludedomains.join("|"), "i")
	var all_links=document.getElementsByTagName("a")
	if (this.mode=="auto" || (this.mode=="manual" && this.togglebox.checked)){
		for (var i=0; i<=(all_links.length-1); i++){
			if (all_links[i].hostname.search(rexcludedomains)==-1 && all_links[i].href.indexOf("http:")!=-1)
				all_links[i].target=ddwindowlinks.linktarget
				var idinc = idinc+1
				all_links[i].id = idinc;
				var activehref = document.getElementById(idinc); // from above code.
all_links[i].href='http://www.mydomain.com/externallinks/?url='+activehref;

This part of the code is intact:

}
	}
	else{
		for (var i=0; …
MDGM 22 Posting Whiz in Training

That worked thanks. (I used the last one)

MDGM 22 Posting Whiz in Training

Hi all,

index.php =

<?php include('1.php'); ?>

when a search engine finds and indexes this page, will it read nothing or will it read the contents of 1.php too?

Im guessing because its a server-side script the document will be merged and then sent to the search engine so it can index it but im not sure.

Thanks

Max

MDGM 22 Posting Whiz in Training

Hi all.

I basically need to know how to get a link's href value using the getelementbytagname code and storing that value in a variable so it can be used later in the same function.

Thanks,

Max

MDGM 22 Posting Whiz in Training

Hi all,

Once every 2 days or so my screen randomly shows images which look like the screen in these photos:

http://www.economizerz.com/other/daniweb/screen/1.JPG
http://www.economizerz.com/other/daniweb/screen/2.JPG

If i leave my computer off for a few hours it fixes itself. I think it is because of a problem with my video card. What do you think?

If yes, could you maybe recommend a replacement? My card is a ATI radeon 9550 and I want something that will also work with a game called Spore (recommended video card is something like an ATI 9800) but i dont have much money.

Thanks all,

Max

(ps. on the screen shots, the small differently coloured box near the centre of the screen is where the mouse is...)