Forum

Questions and discussions

Manually Add Credits

Script's setup and configuration

Manually Add Credits

Postby User21444 » Fri Apr 29, 2011 1:40 pm

Is there any way to manually add credits to a buyer's account?

Thanks!
User21444
 
Posts: 45
Joined: Tue Sep 14, 2010 10:23 pm

Re: Manually Add Credits

Postby funmediapicture » Wed May 04, 2011 5:14 pm

You found more infos to this topic here:
http://www.cmsaccount.com/forum/viewtopic.php?f=29&t=481
funmediapicture
 
Posts: 73
Joined: Tue Apr 27, 2010 2:45 pm

Re: Manually Add Credits

Postby admin » Thu May 05, 2011 6:58 am

Hello Eric,

I just sent you modified files.
admin
Site Admin
 
Posts: 1458
Joined: Sun Mar 07, 2010 5:55 pm

Re: Manually Add Credits

Postby funmediapicture » Thu May 05, 2011 9:55 am

Anton has sent the new files to me. I have the file new.php
a little bit modified.

I have replaced the input field: User with a select field.
So it's easier to select a user. The query search only the buyers
from the database: utype=buyer

You see in the select field the login, name and lastname.

Here the new code:

Replace this:

Code: Select all
<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<input type='text' name='user' style='width:400px' class='ibox' value=''>
</div>


With this:

Code: Select all
<?php
/*
Original entry

<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<input type='text' name='user' style='width:400px' class='ibox' value=''>
</div>
*/
?>



<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<select name="user" style="width:400px" class="ibox">
<option value="">Please select...</option>
<?php
$sql="select login,name,lastname from users where utype='buyer'";
$rs->open($sql);
while(!$rs->eof)
{
?>
<option value="<?=$rs->row["login"]?>"><?=$rs->row["login"]?>&nbsp;&nbsp;&nbsp;&nbsp;(<?=$rs->row["name"]?> <?=$rs->row["lastname"]?>)</option>
<?
$rs->movenext();
}
?>
</select>
</div>


Greetings
Alfred
funmediapicture
 
Posts: 73
Joined: Tue Apr 27, 2010 2:45 pm

Re: Manually Add Credits

Postby funmediapicture » Fri May 06, 2011 9:29 am

I have now insert both fields. So can I select.

Changed files:

1.) languages/english.php

2.) admin/credits/new.php
3.) admin/credits/add.php


You can now select which user field you will fill out. If you have
filled out both fields you recieved a error message.


1.) languages/english.php

Insert:

$m_lang["please_select"]="Please select ...";
$m_lang["manual_input"]="manual input";
$m_lang["error_fill_out_only_one_user_field"]="Error!!! Please fill out only one user field.";


2.) admin/credits/new.php


Replace this:

Code: Select all
<?
if(isset($_GET["d"]))
{
echo("<p><b>".word_lang("error")."</b></p>");
}
?>


With this:

Code: Select all
<?php
// Freddy BOF
if(isset($_GET["d"]))
{
if($d==1){echo("<p><b>".word_lang("error")."</b></p>");}
if($d==2){echo("<p><b>".word_lang("error_fill_out_only_one_user_field")."</b></p>");}
}
// Freddy EOF
?>



Replace the user field:

Code: Select all
<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<input type='text' name='user' style='width:400px' class='ibox' value=''>
</div>


With this:

Code: Select all
<?php // Freddy BOF ?>
<div class='admin_field'>
<span><?=word_lang("user")?> ( <?=word_lang("manual_input")?> ):</span>
<input type='text' name='user' style='width:400px' class='ibox' value=''>
</div>



<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<select name='user_select_field' style='width:400px' class='ibox'>
<option value=''><?=word_lang("please_select")?></option>
<?php
$sql="select id_parent,login,name,lastname from users where utype='buyer'";
$rs->open($sql);
while(!$rs->eof)
{
?>
<option value="<?=$rs->row["login"]?>"><?=$rs->row["login"]?>&nbsp;&nbsp;&nbsp;&nbsp;(<?=$rs->row["id_parent"]?> <?=$rs->row["name"]?> <?=$rs->row["lastname"]?>)</option>
<?
$rs->movenext();
}
?>
</select>
</div>
<?php // Freddy EOF ?>



3.) admin/credits/add.php

Insert new and replace the $sql="select login... with this:

Copy from the begin up to if((float)$_POST["quantity"]>0)

Code: Select all
<? include("../function/db.php");?>
<?if($_SESSION['entry_admin']!=1){redirect("../auth/");}



// Freddy BOF
$loginuser="";
if($_POST["user"]!="")
{
        $loginuser=result($_POST["user"]);
}

if($_POST["user_select_field"]!="")
{
        $loginuser=result($_POST["user_select_field"]);
}

// Error message if both fields are filled out
if($_POST["user"]!="" and $_POST["user_select_field"]!="")
{
        header("location:new.php?d=2");
        exit();
}



$sql="select login from users where login='".$loginuser."'";
$dd->open($sql);
if(!$dd->eof)
{
// Freddy EOF

   if((float)$_POST["quantity"]>0)


Thats all.

Greetings
Alfred
funmediapicture
 
Posts: 73
Joined: Tue Apr 27, 2010 2:45 pm

Re: Manually Add Credits

Postby erikger » Sun Jan 06, 2013 9:20 pm

is this allready included in version 12_10 ?
erikger
 

Re: Manually Add Credits

Postby funmediapicture » Mon Jan 07, 2013 10:23 am

I have made this modification for me. My script version is still 11.03. I have at the moment not updated to the new versions. Anton does not mark the changes. I must make all modification from hand.

I think anton has integrated this modification in the new version or general not. He makes his own modification.

I think it's not a problem this modification to integrate in the new version. The files are identical. The only new field are: Days till expiration.

If you have trouble to integrate this let me know.

Greetings
Alfred
funmediapicture
 
Posts: 73
Joined: Tue Apr 27, 2010 2:45 pm

Re: Manually Add Credits

Postby erikger » Mon Jan 07, 2013 1:33 pm

thank you alfred

but as you thought my question was about the new version from anton

so i will try to do it bymyself
erikger
 

Re: Manually Add Credits

Postby funmediapicture » Mon Jan 07, 2013 7:29 pm

I have made the changes for the version 12.10

Files:
new.php
add.php

We must insert in new.php the error message and the new select field.

We must insert in add.php the query for the error messages and
a little change in the mysql query.

I have marked all changes so you can easily copy and paste the code
in your own files.

File new.php

Code: Select all
<? include("../function/db.php");?>
<?
//Check access
admin_panel_access("orders_credits");
?>
<? include("../inc/begin.php");?>
<? include("../function/show.php");?>
<? include("../function/upload.php");?>


<div class="back"><a href="index.php"><b>&#171; <?=word_lang("back")?></b></a></div>

<h1><?=word_lang("Add")?> <?=word_lang("Credits")?>:</h1>


<?php
// Freddy BOF
if(isset($_GET["d"]))
{
        $d=(int)$_GET["d"];
        if($d==1){echo("<p><b>".word_lang("error")."</b></p>");}
        if($d==2){echo("<p><b>".word_lang("error_fill_out_only_one_user_field")."</b></p>");}
}
// Freddy EOF
?>

<form method="post" action="add.php">

<div class='admin_field'>
<span><?=word_lang("title")?>:</span>
<input type='text' name='title' style='width:400px' class='ibox' value='Credits bonus'>
</div>

<?php // Freddy BOF ?>
<div class='admin_field'>
<span><?=word_lang("user")?> ( <?=word_lang("manual_input")?> ):</span>
<input type='text' name='user' style='width:400px' class='ibox' value=''>
</div>

<div class='admin_field'>
<span><?=word_lang("user")?>:</span>
<select name='user_select_field' style='width:400px' class='ibox'>
<option value=''><?=word_lang("please_select")?></option>
<?php
$sql="select id_parent,login,name,lastname from users where utype='buyer'";
$rs->open($sql);
while(!$rs->eof)
{
        ?>
        <option value="<?=$rs->row["login"]?>"><?=$rs->row["login"]?>&nbsp;&nbsp;&nbsp;&nbsp;(<?=$rs->row["id_parent"]?> <?=$rs->row["name"]?> <?=$rs->row["lastname"]?>)</option>
        <?

        $rs->movenext();
}
?>
</select>
</div>
<?php // Freddy EOF ?>

<div class='admin_field'>
<span><?=word_lang("quantity")?>:</span>
<input type='text' name='quantity' style='width:100px' class='ibox' value='1'>
</div>

<div class='admin_field'>
<span><?=word_lang("days till expiration")?>:</span>
<input type='text' name='days' style='width:100px' class='ibox' value='0'>
</div>

<input type='submit' value='<?=word_lang("add")?>'></form>
<br>
<p>* You should set <b>"<?=word_lang("days till expiration")?>"=0</b> if you don't want to have the expiration date.</p>


<? include("../inc/end.php");?>


File add.php

Code: Select all
<? include("../function/db.php");?>
<?
//Check access
admin_panel_access("orders_credits");


// Freddy BOF
// Error message if both fields are filled out
if($_POST["user"]!="" and $_POST["user_select_field"]!="")
{
        header("location:new.php?d=2");
        exit();
}
// Freddy EOF

// Freddy BOF
$loginuser="";

if($_POST["user"]!="")
{
        $loginuser=result($_POST["user"]);
}

if($_POST["user_select_field"]!="")
{
        $loginuser=result($_POST["user_select_field"]);
}
// Freddy EOF


// Freddy BOF
$sql="select login from users where login='".$loginuser."'";
// Freddy EOF
$dd->open($sql);


The rest remains the same


The query is at the moment for utype='buyer'.
This we can change.

Greetings
Alfred
funmediapicture
 
Posts: 73
Joined: Tue Apr 27, 2010 2:45 pm

Re: Manually Add Credits

Postby erikger » Mon Jan 07, 2013 10:34 pm

thank you very much. i will try it. where do i have to place the two new files ?
erikger
 

Next

Return to Configuration

Who is online

Users browsing this forum: No registered users and 3 guests

cron
  Photo Store Script

Professional php photo stock script and WordPress plug-in for photographers and video producers.

  Support
  CMSaccount Inc.