Problems with plugin
-
Hi. I’m write plugin. My plugin is intended send information from form to tables in mysql.
When i write information field in the form and click sumbit sent, plugin nothing do.
I don’t now when is problems.<?php /* Plugin Name: PaymentRomb Version: 0.1 Description: Paymnet for Romb Author: DoktorPress */ define( 'payment_PATH', plugin_dir_path( __FILE__ ) ); require payment_PATH.'payment/logicPayment.php'; //register_activation_hook(__FILE__, 'payment_install'); add_action('admin_menu', 'payment_menu'); // serwer $mysql_server = 'localhost'; // admin $mysql_admin = 'root'; // has?o $mysql_pass = 'SqlDoktor'; // nazwa baza $db = 'wordpress'; // nawi?zujemy po??czenie z serwerem MySQL @mysql_connect($mysql_server, $mysql_admin, $mysql_pass) or die('Brak po??czenia z serwerem MySQL.'); // ??czymy si? z baz? danych @mysql_select_db($db) or die('B??d wyboru bazy danych.'); function payment_menu() { add_menu_page('Payment', 'basePayment', 'administrator', 'Payment_set'); add_submenu_page('Payment_set', __('Payment'), __('Payment'), 'edit_themes', 'Payment_settings', 'Payment_settings'); } function Payment_settings() { $payment=new logicPayment(); if (isset($_POST['Payment_settings'])) { foreach ($_POST['Payment_settings'] as $img) { $payment->add(array('zob' => $img['zob'], 'wpl' => $img['wpl'], 'n' => $img['n'],'y' => $img['y'], 'd' => $img['d'],'Wykonaj' => $img['Wykonaj'])); } } $results = $payment->add(); echo'<form action="?page=Payment_settings" method="post"> <table class="list" style="width:auto;" cellpadding="10"> <tr><td> $strona: <input type="radio" name="strona" value="zob" id="radio-zob" %{if !Access($cur_level,A_SKAW)}disabled%{/if} onclick="UpdateEkwiwalent(this);"><label for="radio-zob" accesskey="z">Zobowi?zanie</label> <input type="radio" name="strona" value="wpl" id="radio-wpl" %{if !Access($cur_level,A_SKAM)}disabled%{/if} onclick="UpdateEkwiwalent(this);"><label for="radio-wpl" accesskey="w">Wp?ata</label> </td></tr> <tr><td id="ekw" style="display: none;"> Typ wp?aty: <input type="radio" id="ekwn" name="ekw" value="n" checked="checked"><label for="ekwn" accesskey="1"> wp?ata</label>, <input type="radio" id="ekwy" name="ekw" value="y"><label for="ekwy" accesskey="2"> ekwiwalent</label>, <input type="radio" id="ekwd" name="ekw" value="d"><label for="ekwd" accesskey="3"> darowizna</label> </td></tr> <tr><td> <label for="tytul" accesskey="t">Pole "tytu?" z przelewu</label><br /><input type="text" id="tytul" size="30" name="tytul" /><br /> <span class="hint-small"><i>Rozpoznawane formaty:</i> <strong>1234/110,05</strong> <i>lub</i> <strong>[email protected]/110,05</strong></span> </td></tr> <tr><td> <label for="data_wplaty" accesskey="a">Data wp?aty</label><input type="text" id="data_wplaty" onchange="ocDataUr(this)" onkeypress="/*return okpDataUr(event, this)*/" class="data datepicker" size="8" name="data_wplaty" /><br /> <span class="hint-small"><i>Rozpoznawany format daty:</i> DD-MM-RRRR</span> </td></tr> <tr><td> <input type="submit" name="$wyslij" style="float: right;" accesskey="s" value="Wykonaj"> </td></tr> </table> </form>'; }
And
<?php class logicPayment { public function add(){ if(isset($_REQUEST['wyslij'])&&isset($_REQUEST['tytul'])&&isset($_REQUEST['data_wplaty'])&&isset($_REQUEST['strona'])) { // Walidacja stron $strona = $_REQUEST['strona']; if(!Access($lusr,A_SKAW)&&($strona=='zob')) die('-'); if(!Access($lusr,A_SKAM)&&($strona=='wpl')) die('-'); if(preg_match('/^([0-9]+)\\/([-]{0,1}[0-9]+,[0-9]{2})$/i',$_REQUEST['tytul'],$matches)) { $insData['user_id']=$matches[1]; $insData[$strona]=preg_replace('/,/','',$matches[2]); } else if(preg_match('/^([a-zA-Z0-9._%+-]+@[^\\/]+)\\/([-]{0,1}[0-9]+,[0-9]{2})$/',$_REQUEST['tytul'],$matches)) { require_once('req.email.php'); if(($insData['user_id']=CheckEmail($matches[1],$db))==0) die('no email found'); $insData[$strona]=preg_replace('/,/','',$matches[2]); } if(isset($_REQUEST['ekw'])) { $insData['ekw']="'${_REQUEST['ekw']}'"; } $insData['data_wplaty']="STR_TO_DATE('".$_REQUEST['data_wplaty']."', '%d-%m-%Y')"; $insData['skarbnik'] = $lusr->user['user_id']; $idx = 0; foreach($insData as $key => $data) { $insC[$idx] = $key; $insD[$idx] = $data; $idx++; } $query = 'SELECT (SUM(<code>wpl</code>)-SUM(<code>zob</code>)) AS <code>saldo</code> FROM <code>wplaty</code> WHERE <code>user_id</code> = '.$insData['user_id'].' GROUP BY <code>user_id</code>'; $rset = mysql_query($query,$db) OR die('#1 '.mysql_error($db)); $row = mysql_fetch_assoc($rset); mysql_free_result($rset); if(!$row) $row = array('saldo' => 0); if($strona=='zob') $row['saldo'] -= $insData['zob']; else $row['saldo'] += $insData['wpl']; // Zapisz w bazie. $query = 'INSERT INTO <code>wplaty</code> ('.implode(',',$insC).',<code>stan_saldo</code>) VALUES('.implode(',',$insD).','.$row['saldo'].')'; mysql_query($query,$db) OR die('#2 '.mysql_error($db)); // Wy?lij email if($strona=='wpl') { $tUser = new User($insData['user_id']); $email_subject = $cfg['msg']['odnotowanawplata_subject']; $typWplaty = ''; switch($_REQUEST['ekw']) { case "n": $typWplaty = 'wp?ata'; break; case "y": $typWplaty = 'ekwiwalent'; break; case "d": $typWplaty = 'darowizna'; break; } $email_body = preg_replace(array('/%KWOTA%/','/%TYP%/'), array(money_format('%!i', $insData['wpl'] / 100),$typWplaty), $cfg['msg']['odnotowanawplata_body']); $sem->SendEmail($tUser->user['email'],$tUser->user['imie'].' '.$tUser->user['nazwisko'],$email_subject,$email_body,true); } } } }
I think that is must stupid problem.
Thanks ??
- The topic ‘Problems with plugin’ is closed to new replies.