• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Need a little PHP help please.

cuemasterfl

Supreme [H]ardness
Joined
Jul 5, 2001
Messages
4,181
Ok, consider this page:

http://www.studcow.com/newsites.php

The drop down at the bottom, where you choose the company - when you choose one it's supposed to open a new URL, which will vary upon the choice selected.

Example: If you choose Quixtar, it's supposed to redirect to http://Quixtar.maxoutnow.com, etc. Instead, you get an About:blank page.

Here's the snippet of PHP code I believe is responsible:

function URLjump() {
windowopen = window.open();
var Current = document.Companies.URL.selectedIndex;
windowopen.location.href = 'http://' + document.Companies.URL.options[Current].value;




windowopen.focus();

}



And here's the PHP code for the drop down:

<select name="URL" onChange="URLjump();">
<?
// $sql = "select c.name, m.ID, m.CompanyInfo_ID from c companies, m members where m.CompanyInfo_ID = c.id and m.Email = 'MsStud@studcow.com' order by c.name asc";


$sql="select id, name, URL from companies where url != '' order by name asc";

$result=$db->query($sql);
echo("<option value=\"\">Is your company in yet? Click on the arrow.");


while ($data=$db->fetch_object($result)){

if($data->URL==""){
$data->URL="studcow.com/whatyouget.html";
}
if ($data->name) {
echo("<option value=\"$data->URL\">$data->name");
}
}
?>
</select>

Any help would be appreciated.
 
There's nothing wrong with your php, it's a problem with the url getting passed to the javascript function. for some reason document.Companies is not being recognized as a valid reference (according to mozillas JS debugger). You could try document.forms[0].URL instead of docuement.Companies.url or use a local reference like this:
Code:
onChange="URLjump(this.form.URL.options[this.form.URL.selectedIndex].value);"

function URLjump(uri) {
windowopen = window.open();
    windowopen.location.href = 'http://' + uri;

windowopen.focus();

}

hope this helps
 
Originally posted by cuemasterfl
Many thanks - the document.forms[0].URL bit worked.

:)
of course that wouldn't work (presumably) if you added another form before that on the page. you may not ever need to, but just something to keep in mind
 
Back
Top