Uutiset:

Join the Facebook Fan Page.

Main Menu
Advertisement:

referer

Aloittaja ryanbsoftware, maaliskuu 01, 2005, 01:51:33 IP

« edellinen - seuraava »

ryanbsoftware

ok i got this code in register.template.php

<tr>
   <td width="40%"><b>Refered By: </b><br \> <div class="smalltext">use member name, NOT displayed name, leave empty if not refered by anyone.</div></td>
<td><input type="text" name="default_options[profile_refered_by]" size="30" value="', $_GET['rf'], '" /></td></tr>


ok so first, will that make its value whatever rf is in the url, i don't know if the synatx is right also it so will this work the same way

<input type="hidden" name="default_options[profile_refered_by]" size="30" value="', $_GET['rf'], '" />

then if i show it in the profile, this returns the userid, when it shows who refered them in their profile can i have it instead of displaying the id, figure out the members current display name and show that and make it a link to their profile, i also want to show that on the registeration page too, like this

LainaaRefered By: (member display name as link to profile)

and if an id is not valid when registering don't save a value, when viewing the profile, if an invalid value is specified, ie account was deleted show, "User No Longer existant".

ryanbsoftware

so is this stumping eveyone else?  :-\

ryanbsoftware

can anybody help i want to get his done.

ryanbsoftware

is my question really that hard  ???

lol, someone please help, i am still new to php

Oldiesmann

If the account was deleted, the information would no longer be in the database, so it would be better to just display it as no referrer... Just have it look for the ID_MEMBER value in the database, and if it can't find it, then just display it as no referrer, something like this:

$query1 = db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$context['user']['default_options']['profile_referred_by']'", __FILE__, __LINE__);
$query2 = mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName']))
echo 'Referred by: <a href="' , $scripturl, '?action=profile;u=', $context['user']['default_options']['profile_referred_by'], '">', $query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';
Michael Eshom
Christian Metal Fans

ryanbsoftware

Lainaus käyttäjältä: Oldiesmann - maaliskuu 15, 2005, 07:21:14 IP
If the account was deleted, the information would no longer be in the database, so it would be better to just display it as no referrer... Just have it look for the ID_MEMBER value in the database, and if it can't find it, then just display it as no referrer, something like this:

$query1 = db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$context['user']['default_options']['profile_referred_by']'", __FILE__, __LINE__);
$query2 = mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName']))
echo 'Referred by: <a href="' , $scripturl, '?action=profile;u=', $context['user']['default_options']['profile_referred_by'], '">', $query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';


ok finally i get some help, thanks.  ;D

3guk

Did you manage to get this to work ?

Wouldreally like a refer script :)

umiya

would be nice to see if this worked

ryanbsoftware

LainaaTemplate Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.

You can also try refreshing this page.
when i got to register to test it out, without defining a referer in the url and also when i use userid 1 as the referer, here is a block of code around where i edited in register.template.php

<form action="', $scripturl, '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td>
</tr><tr class="windowbg">
<td width="100%">
$referer = $_GET['rf']
$query1 = db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$referer'");
$query2 = mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName']))
echo 'Referred by: <a href="' , $scripturl, '?action=profile;u=', $referer, '">', $query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" maxlength="18" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[69], ':</b>
<div class="smalltext">', $txt[679], '</div>
</td>
<td>
<input type="text" name="email" size="30" />';


what did i do wrong?

also is this code right?

echo '<input type="hidden" name="default_options[profile_refered_by]" size="30" value="', $_GET['rf'], '" />';

[Unknown]

<form action="', $scripturl, '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td>
</tr><tr class="windowbg">
<td width="100%">


<?php // <-- you forgot this.

$referer = (int) $_GET['rf']; // <-- semi colon and cast missing.
$query1 db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$referer'");
$query2 mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName'])) // <-- these two clauses mean the same thing.
echo 'Referred by: <a href="' $scripturl'?action=profile;u='$referer'">'$query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';

?>
<!-- <-- and this one. -->

<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" maxlength="18" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[69], ':</b>
<div class="smalltext">', $txt[679], '</div>
</td>
<td>
<input type="text" name="email" size="30" />';


-[Unknown]

ryanbsoftware

#10
Lainaus käyttäjältä: [Unknown] - maaliskuu 22, 2005, 05:25:28 IP
<form action="', $scripturl, '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td>
</tr><tr class="windowbg">
<td width="100%">


<?php // <-- you forgot this.

$referer = (int) $_GET['rf']; // <-- semi colon and cast missing.
$query1 db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$referer'");
$query2 mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName'])) // <-- these two clauses mean the same thing.
echo 'Referred by: <a href="' $scripturl'?action=profile;u='$referer'">'$query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';

?>
<!-- <-- and this one. -->

<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" maxlength="18" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[69], ':</b>
<div class="smalltext">', $txt[679], '</div>
</td>
<td>
<input type="text" name="email" size="30" />';


-[Unknown]

lol i though the whole template file was php  :-\

edit yeah the first line of register.template.php is <?php and the last line is ?> and add int the ; gives me the same error.

ok now i saw a couple of error and fixed them so now its

<form action="', $scripturl, '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td>
</tr><tr class="windowbg">
<td width="100%">';
$referer = $_GET['rf'];
$query1 = db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$referer'");
$query2 = mysql_fetch_assoc($query1);
if($query2['realName'] != '' && !empty($query2['realName'])){
echo 'Referred by: <a href="' , $scripturl, '?action=profile;u=', $referer, '">', $query2['realName'], '</a>';
}
else
{
echo 'Referred by: <i>Nobody</i>';
}
echo '<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" maxlength="18" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[69], ':</b>
<div class="smalltext">', $txt[679], '</div>
</td>
<td>
<input type="text" name="email" size="30" />';


and now it displays this error:

LainaaRegister - Required Information
An Error Has Occurred!
Missing argument 2 for db_query()

[Unknown]

Sorry, I didn't really look at the code; I assumed this was outside a template.  Inside a template, you need to close the echo:

Lainaus käyttäjältä: [Unknown] - maaliskuu 22, 2005, 05:25:28 IP
<form action="', $scripturl, '?action=register2" method="post" name="creator" onsubmit="return defaultagree();">
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="tborder">
<tr class="titlebg">
<td>', $txt[97], ' - ', $txt[517], '</td>
</tr><tr class="windowbg">
<td width="100%">';

$referer = (int) $_GET['rf'];
$query1 = db_query("SELECT realName FROM {$db_prefix}members WHERE ID_MEMBER = '$referer'", __FILE__, __LINE__);
$query2 = mysql_fetch_assoc($query1);
if (!empty($query2['realName']))
echo 'Referred by: <a href="' , $scripturl, '?action=profile;u=', $referer, '">', $query2['realName'], '</a>';
else
echo 'Referred by: <i>Nobody</i>';

echo '
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr>
<td width="40%">
<b>', $txt[98], ':</b>
<div class="smalltext">', $txt[520], '</div>
</td>
<td>
<input type="text" name="user" size="20" maxlength="18" />
</td>
</tr><tr>
<td width="40%">
<b>', $txt[69], ':</b>
<div class="smalltext">', $txt[679], '</div>
</td>
<td>
<input type="text" name="email" size="30" />';


-[Unknown]

ryanbsoftware

#12
ok copying your code now i get this error:

LainaaRegister - Required Information
Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

but only at the register screen, it must have to do with the db query.  :-\

edit: or acctually does register.template.php connect to the db before that code?

ryanbsoftware

Lainaus käyttäjältä: RyanB - maaliskuu 22, 2005, 06:45:09 IP
ok copying your code now i get this error:

LainaaRegister - Required Information
Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

but only at the register screen, it must have to do with the db query.  :-\

edit: or acctually does register.template.php connect to the db before that code?

edit: i don't seem to see where it would...unless it does because of the code in index.php
if so...then do you know what is wrong with the code...if not how do i get it to connect?

ryanbsoftware

any help, suggestions, i am seeing several requests for this as a mod and i would like to get it done before 1.1 comes out, lol.  :D

ryanbsoftware


ryanbsoftware

Lainaus käyttäjältä: RyanB - maaliskuu 23, 2005, 11:31:51 AP
Lainaus käyttäjältä: RyanB - maaliskuu 22, 2005, 06:45:09 IP
ok copying your code now i get this error:

LainaaRegister - Required Information
Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

but only at the register screen, it must have to do with the db query.  :-\

edit: or acctually does register.template.php connect to the db before that code?

edit: i don't seem to see where it would...unless it does because of the code in index.php
if so...then do you know what is wrong with the code...if not how do i get it to connect?

well ok that one was a stuopid question, lol, obviously it connects to save the other info, lol, but what is causing that error then?

Advertisement: