Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Przekazywanie pewnej wartości z urla to formularza
Azz
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


Witam

Jako że kompletnie nie znam sie na js ale potrzebuje cos zrobic z moim fantem

Mianowicie dajmy na to w przegladarce czy to IE czy FF
wyswietli mi sie link
np.
http://domena.com/index.php?&act=shop&func...oney&user=Admin
lub
http://domena.com/index.php?&act=shop&func...money&user=Demo

i aby skrypt pobierał końcówke URLA to jest Admin lub Demo

i wlepiał ją do pola w formularzu

Czy takie coś jest możliwe ?
Go to the top of the page
+Quote Post
revyag
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

Ostrzeżenie: (0%)
-----


Żeby w przeglądarce pojawił się taki link to wcześniej trzeba coś kliknąć, więc to o co pytasz można banalnie zrobić w php. Jaki jest powód tego że chcesz to zrobić korzystająć z js ?


--------------------
-------------

------
Go to the top of the page
+Quote Post
ikioloak
post
Post #3





Grupa: Zarejestrowani
Postów: 416
Pomógł: 0
Dołączył: 8.01.2004

Ostrzeżenie: (0%)
-----


Google zamkneli?
http://www.google.com/search?client=opera&...=utf-8&oe=utf-8

http://adamv.com/dev/javascript/querystring
Go to the top of the page
+Quote Post
Azz
post
Post #4





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


tak klikne link zostane przekierwoany na inna pod strone i koncówka tego linku (nazwa usera) powinna zostać wpisana w jedno poloe formularzu
Go to the top of the page
+Quote Post
revyag
post
Post #5





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

Ostrzeżenie: (0%)
-----


No to ja pytam, dlaczego chcesz to robić przy użyciu js ?


--------------------
-------------

------
Go to the top of the page
+Quote Post
Azz
post
Post #6





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


myslalem ze mozna zrobic to tylko przy JS nie wiedzialem ze za pomoca php tez mozna smile.gif jesli tak to jeszcze lepiej

Edit: Ktos pomoże smile.gif?

Ten post edytował Azz 7.02.2006, 15:06:19
Go to the top of the page
+Quote Post
cadavre
post
Post #7





Grupa: Zarejestrowani
Postów: 472
Pomógł: 7
Dołączył: 7.12.2005
Skąd: Gliwice

Ostrzeżenie: (0%)
-----


  1. <?php
  2. $user = $_GET['user'];
  3. echo "<input type='text' value='$user' />";
  4. ?>


--------------------
Silesian PHP User Group - www.spug.pl
Symfony2, OAuth2, budowanie API - masz pytania? Pisz!
Go to the top of the page
+Quote Post
Azz
post
Post #8





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


tutaj mam kawałek kodu:

Kod
if ($func=="transfer_money")
{
    if ($code=="")
    {
     $templateform = loadtemplate("shop_transfer_money_1");
     eval(template);
     $output = $templateform;
     print_and_exit();
    } elseif ($code=="send")
    {
     global $HTTP_POST_VARS,$ibforums;
     if (!isset($HTTP_POST_VARS["money"]) OR !is_numeric($HTTP_POST_VARS["money"]) OR $HTTP_POST_VARS["money"]<=0)
     {
         shoperror("Sorry, you can't send 0 {$ibforums->vars["shop_currencyname"]}, or a negative amount, nice try though!");
     }
     if ($HTTP_POST_VARS["money"] > $ibforums->member["points"])
     {
         shoperror("You do not have enough {$ibforums->vars["shop_currencyname"]} to send " . currencyformat($HTTP_POST_VARS["money"]));
     }
    
     $money = $HTTP_POST_VARS["money"];

     if (!isset($HTTP_POST_VARS["username"]))
     {
         shoperror("You must enter a member to send {$ibforums->vars["shop_currencyname"]} to!");
     }
     $username = addslashes($HTTP_POST_VARS["username"]);
     $DB->query("SELECT id FROM _ipb_members WHERE name='{$username}' LIMIT 1");
     if ($DB->get_num_rows()==0)
     {
         shoperror("Recipient does not exist, correct spelling?");
     }
     $id = $DB->fetch_row();
     $id = $id["id"];
    
     $DB->query("UPDATE _ipb_members SET points = points + {$money} WHERE id={$id} LIMIT 1");
     $DB->query("UPDATE _ipb_members SET points = points - {$money} WHERE id={$ibforums->member["id"]} LIMIT 1");
        
        shop_addlog(array("type" => "M", "targetmemberid" => $id, "actiontext" => "Transfered {$money} {$ibforums->vars["shop_currencyname"]}" ));
        
        $post = "";
        if (isset($HTTP_POST_VARS["post"]))
        {
            $message = htmlspecialchars($HTTP_POST_VARS["post"]);
        }
        
        $recipient = $username;
        $sender = $ibforums->member["name"];
        global $std;
        $timestamp = $std->get_date(time(), "LONG");
        $servicebotname = $ibforums->vars["shop_botname"];
        $currencyname = $ibforums->vars["shop_currencyname"];
        $currency = currencyformat($money);
        
        $templateform = loadtemplate("transfer_money_pm");
        eval(template);
        $pm = $templateform;
        unset($templateform);
        global $std; $pm = $std->clean_value($pm);

        send_pm(array("recipientid" => $id, "title" => "{$ibforums->member["name"]} has sent you some {$ibforums->vars["shop_currencyname"]}", "message" => $pm, "senderid" => $ibforums->member["id"]));
        redirect("{$currency} sent to {$recipient}", "act=shop");
        exit;
    }
    else    
    {
     shoperror("Contact your board administrator and ask to be banned... no messing with board input :P");
    }
    
}


A tu kawałek skina do tego
Kod
<form name="transfer" method="post" action="<!!URL>&func=transfer_money&code=send">

<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td class='titlemedium' colspan="2">Send <@ibforums->vars["shop_currencyname"]@></td>
</tr>
<tr>
<td class="postfoot" colspan="2">Recipient</td>
</tr>
<tr>
<td class="row1" align="right">Send <@ibforums->vars["shop_currencyname"]@> to:</td>
<td class="row2">

//Tutaj powinien sie wpisywac user
<input type="textbox" class='forminput' name="username" value=''>
///Tutaj

</td>
</tr>

<tr>
<td class="postfoot" colspan="2">Amount of <@ibforums->vars["shop_currencyname"]@></td>
</tr>

<tr>
<td class="row1" align="right"><@ibforums->vars["shop_currencyname"]@>:</td>
<td class="row2"><input type="textbox" class='forminput' name="money" value=""></td>
</tr>

<tr>
<td class="postfoot" colspan="2">Attached Message - included in recipient's PM reciept</td>
</tr>


<tr>
<td class="row1" colspan="2"><textarea name="post" cols="50" rows="6"> </text-area>
</td></tr>

<tr>
<td class='mainfoot' align="center" colspan="2"><input type="submit" name="submit" value="Send Money" tabindex='4' class='forminput' accesskey='s'>
</td></tr>
</table>


Gdy np. mam link taki jak podałem wcześniej w pole "username" powinno wpisać się user z linku

Ten post edytował Azz 8.02.2006, 12:39:57
Go to the top of the page
+Quote Post
cadavre
post
Post #9





Grupa: Zarejestrowani
Postów: 472
Pomógł: 7
Dołączył: 7.12.2005
Skąd: Gliwice

Ostrzeżenie: (0%)
-----


  1. //Tutaj powinien sie wpisywac user
  2. <input type="textbox" class='forminput' name="username" value="<?php echo $_GET['user']; ?>">
  3. ///Tutaj


--------------------
Silesian PHP User Group - www.spug.pl
Symfony2, OAuth2, budowanie API - masz pytania? Pisz!
Go to the top of the page
+Quote Post
Azz
post
Post #10





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


w formie wyswietla sie:

Kod
<?php echo $_GET['user']; ?>


Edit: Skin przechowywany jest w bazie, na innym forum widziałem takie coś
zrobione pisałem do admina jednak nie chciał pomóc

Ten post edytował Azz 7.02.2006, 16:01:18
Go to the top of the page
+Quote Post
cadavre
post
Post #11





Grupa: Zarejestrowani
Postów: 472
Pomógł: 7
Dołączył: 7.12.2005
Skąd: Gliwice

Ostrzeżenie: (0%)
-----


To może całość jest wsadzona pod php. Pokaż całą stronę ze skinem.


--------------------
Silesian PHP User Group - www.spug.pl
Symfony2, OAuth2, budowanie API - masz pytania? Pisz!
Go to the top of the page
+Quote Post
Azz
post
Post #12





Grupa: Zarejestrowani
Postów: 26
Pomógł: 0
Dołączył: 28.07.2005

Ostrzeżenie: (0%)
-----


Pomyslalem i rozwiazalem problem inaczej smile.gif

Ten post edytował Azz 8.02.2006, 12:39:21
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 13:17