Jump to content

fluidsharp

Members
  • Posts

    39
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

fluidsharp's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, How to block access to http://domain.com/admin/main/ admin panel via htaccess ? I tried like below, but it is not working. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?/$0 [PT,L] RewriteCond %{REMOTE_ADDR} ^1\.1\.1\.1$ RewriteRule /admin/main [F,L]
  2. Hi, I have issue with deleting data via jquery/ajax. First delete execute and data on page changed. But then when I click on next element for deleting, nothing happens. To avoid complicated code I wrote simple example which demonstrate issue. Controller function test_contr(){ $this->load->model('admin/Product_crud'); $data['query']=$this->Product_crud->test_model_select_data(); $this->load->view('admin/test',$data); } function test_delete($id){ $output = NULL; //var_dump($id); $this->load->model('admin/Product_crud'); $this->Product_crud->test_delete($id); $data['query']=$this->Product_crud->test_model_select_data(); foreach($data['query'] as $row){ $output .= $row->id."<input class='del_picture' type='button' value='".$row->id."' name='id'>"; } echo json_encode($output); } Model not needed as there simple select id from database and delete View <!DOCTYPE html> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="/script/jquery-1.9.1.min.js"></script> </head> <body> <div class="result_table"> <?php foreach ($query as $row){ echo $row->id."<input class='del_picture' type='button' value='".$row->id."' name='id'>"; } ?> </div> </body> </html> <script> $(".del_picture").on("click", function(){ var id = $(this).attr("value"); var myurl = '<?php echo base_url()."admin/main/test_delete/"?>'; var url = myurl + id; $.ajax({ url: url, type:'GET', dataType: 'json', success: function(update_html){ $(".result_table").html(update_html); } }); }); </script>
  3. I mean identical by structure(fields) but not by data. Table record will contain an info about recorded interview, short description, etc. And table article of course contains articles and additional info.
  4. Hi all, I have two tables: article and records (haven't create but will be same as article) article: +-------------+------------- ----+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+------------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | title | varchar(255) | NO | | NULL | | | description | text | NO | | NULL | | | article | text | NO | | NULL | | | review | int(11) | NO | | NULL | | | author | varchar(255) | YES | | NULL | | | date | date | NO | | NULL | | So I must output data (news) from both tables and result should be ordered by date. First idea putted all in one table but it is so stupid. Second is creating some intermediary table but how I haven't imagined yet. Thank you in advance!
  5. true, i missed this originally, in order for the mail function to work, a from header must be specified, either in the header parameter or in the php.ini file. Your first step will be to add that to the function it helped thanks! but why it works on an another server?
  6. error.log I didn't find. But example from http://php.net/manual/en/function.mail.php (Example #4 Sending HTML email) works. I think if I change $message = $clientMessage; to $message = "Test"; it will work. I will check. PS $clientMessage gets data from POST <textarea>.
  7. Hi all, I cannot send mail from one paid hosting, but from another I can (it is some free hosting) How to debug or find out why it doesn't send mails? <?php error_reporting(E_ALL); if (isset($clientName) && isset($clientEmail) && isset($clientMessage)) { $to = "first@mail.ru";//. ", "; //$to .= "second@mail.ru"; $subject = "test mail from site"; $message = $clientMessage; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $l = mail($to, $subject, $message, $headers); if ($l){echo "true";}else echo "false"; echo $l."<h3>Mail was sent</H3>"; print_r(error_get_last()); error_log("error ", 1,"first@mail.ru"); } ?> Thank you in advance!
  8. I ask support, here is answer: Thank you for contacting us. Unfortunately the PEAR package is not installed and cannot be installed on the shared hosting environment.
  9. Hi all! I have installed PEAR, mail and sendmail on localhost and everything works fine and I was so happy. But when I moved code to server I found out that I cannot use PEAR there. Could you give me advice ? What php function I should use to write own script to send mail via SMTP? Thank you in advice.
  10. I've read it before posting, but not all was clear for me. I moved code from add_formats.php to adminka_wrapp.php and it works on remote server. Is there others ways to solve this issue? Thanks.
  11. Hi all, I have two issue with script. 1. It works in PhpEd and with apache but doesn't work at remote server with apache. Error is well known - "Warning: Cannot modify header information - headers already sent " 2. when I added more than 20 records like $var = $_POST['var']; it stops work local. Error is same. adminka_wrapp.php <?php $addFormatName = $_POST['addFormatName']; $addFormatDes = $_POST['addFormatDes']; $page = $_GET['page']; if (isset($addFormatName) && isset($addFormatDes)) { $page = 'add_formats'; } else if ($page == NULL) { $page = "user_access_log"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="../style/adminkaview.css"> </head> <body> <div class="col-wrap1"> <div class="col-wrap2"> <div class="col1"> <div class="content" id="c1"> <p><a href="?page=view_add_format">Format and extensions</a></p> </div> </div> <div class="col2"> <div class="content" id="c2"> <?php require("$page.php");?> </div> </div> <div class="clear"></div> </div> </div> </body> </html> view_add_format.php <?php require_once "../function.php"; $q = connect("SELECT `formats`.* FROM `xxx`.`formats` "); echo "<form method='post' action='adminka_wrapp.php'> <table> <tr> <td>id</td> <td>Formats Name</td> <td>Description</td> </tr>"; while($rowResult = $q->fetch_assoc()) { echo "<tr>"; $id = $rowResult["id"]; $formatName = $rowResult["f_name"]; $description = $rowResult["description"]; echo "<td>".$id."</td>" ."<td>".$formatName."</td>" ."<td>".$description."</td>"; echo "</tr>"; } echo " <tr> <td> <input type='submit' value='AddFormat' name='submitAddFormat'> </td> <td> <input type='text' name='addFormatName' maxlength='20' size='5'> </td> <td> <input type='text' name='addFormatDes' maxlength='20' size='5'> </td> "; echo "</table> </form>"; ?> add_formats.php <?php require "../function.php"; if (isset($addFormatName) && isset($addFormatDes) ) { $q = connect("INSERT INTO `xxx`.`formats` (`id` ,`f_name` ,`description` ) VALUE (NULL ,'$addFormatName' ,'$addFormatDes' ) "); header("Location: adminka_wrapp.php?page=view_add_format"); exit(); } ?> function.php <?php function connect($query) { $db = new mysqli('127.0.0.1', 'xxx', 'xxx', 'xxx'); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $result = $db->query($query); $db->close(); return $result; } ?>
  12. Hi guys! Could you give me advice about this issue: index.php <?php $page = $_GET['page']; if ($page == NULL) { $page = "main"; } ?> <div>Header</div> <div> <?php require("view/$page.php");?> </div> <div>Footer</div> main.php <?php require "func.php"; ?> <form method="post" action="view/add.php"> <input type="text" name="from" value=""><br /> <input type="submit" value="Add"> </form> add.php <?php require "../func.php"; $from = $_POST['from']; $a = add($from); echo $a; ?> func.php <?php function add($a) { $c = $a+100; return $c; } ?> I need output result (echo $a) in new windows (target= _blank) and output must be same like with main.php. In other words content of add.php output in index.php This code is just simplified of real code. Thank you in advice
  13. Hi, Thanks for reply. I wrote simple other code with has the same issue. I cannot interrupt executing code in result_found.php. Cannot run Stap Over (F8). It works only for index.php index.php: <?php some code ?> <form method="post" action="view/result_found.php"> Enter input format: <input type="text" name="from" value="" maxlength="5" size="30"> <input type="submit" value="Find enterd formats"> </form> result_found.php: <?php $a = $_POST['from']; echo $a; ?>
  14. Hi everybody! Could you help me with debugging. Exactly from index.php I call result_found.php through <form method="post" action="view/result_found.php"> and cannot debug code in this file. When I've tried set up breakpoint it doesn't help. Just show me result of executing code in result_found.php Thank you in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.