Welcome Guest, Not a member yet? Register   Sign In
  _GET array problem...
Posted by: El Forum - 11-18-2008, 11:56 AM - Replies (8)

[eluser]XssLab[/eluser]
Hello, I have a problem with a

Code:
$this->input->get();

method to obtain a _GET value of url in my web site...

For example, the url string is:

Code:
upload_form/?id=11&type=0&image_type=screenshot

And my code is:

Code:
function upload_form()
    {
        $this->logged_in();
        
        if($this->input->get('image_type', TRUE) == 'screenshot')
        {
            $this->load->view('upload_image_form');
            return false;
        }
        else
        {
            $this->load->view('upload_plant_form');
            return false;    
        }
    }

But the conditional if doesn't work!

where is the problem of ->input->get method?


  index.html missing in system directory
Posted by: El Forum - 11-18-2008, 11:34 AM - Replies (2)

[eluser]Alur[/eluser]
Hi!

I'm new to CodeIgniter, so this might be a silly question. I've just realized that the index.html file in the subdirectories (to prevent directory access) is missing in the system directory. Is there any reason why it should be like this?

Thanks in advance!

Alur


  HTTP Error log reader
Posted by: El Forum - 11-18-2008, 10:37 AM - No Replies

[eluser]louis w[/eluser]
I was in the need of a front-end error log reader to help quick debugging of client sites. This script is useful for an easy way to browse the recent error messages without having to ssh in to the server (i have the system folder set at inaccessible to http requests). It's VERY bare bones, and just reads the file and outputs it to screen.

I am sure there is a lot of additional features that could be added to it. I just threw it together and thought i would share.




Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;Error Log&lt;/title&gt;
    &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
    &lt;meta name="MSSmartTagsPreventParsing" content="true" /&gt;
    &lt;style&gt;
        
        BODY {
            color: #666;
            font-family: Lucida Grande, Verdana, Sans-serif;
            font-size: 11px;
            }
        
        PRE {
            background-color: black;
            font-size: 12px;
            line-height: 14px;
            color: white;
            padding: 20px;
            }
    
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php

define("TEXT_FILE", dirname(__FILE__) . '/system/logs/log-' . date('Y-m-d') . '.php');
define("LINES_COUNT", 50);

function read_file($file, $lines) {
    //global $fsize;
    $handle = fopen($file, "r");
    $linecounter = $lines;
    $pos = -2;
    $beginning = false;
    $text = array();
    while ($linecounter > 0) {
        $t = " ";
        while ($t != "\n") {
            if(fseek($handle, $pos, SEEK_END) == -1) {
                $beginning = true;
                break;
            }
            $t = fgetc($handle);
            $pos --;
        }
        $linecounter --;
        if ($beginning) {
            rewind($handle);
        }
        $text[$lines-$linecounter-1] = fgets($handle);
        if ($beginning) break;
    }
    fclose ($handle);
    return array_reverse($text);
}

echo "<strong>".TEXT_FILE."</strong>";

if (file_exists(TEXT_FILE)) {

    $fsize = round(filesize(TEXT_FILE)/1024/1024,2);

    echo "<br/>File size is {$fsize} megabytes";
    echo "<br/>Last ".LINES_COUNT." lines of the file:";

    echo '<pre>';

    $lines = read_file(TEXT_FILE, LINES_COUNT);
    foreach ($lines as $line) {
        echo $line;
    }

    echo '</pre>';

    echo '<div class="refresh_time">Page rendered at:  <strong>' . date('Y-m-d H:i:s') . '</strong></div>';

} else {

    echo '<div style="color: red;">ERROR: File not found</div>';

}?&gt;

&lt;/body&gt;
&lt;/html&gt;


  Use Form helper inside a customer helper
Posted by: El Forum - 11-18-2008, 10:04 AM - Replies (1)

[eluser]spyro[/eluser]
I am working on code that will dynamically build a form based off of meta data. I added a helper called formBuilder to the formbuilder_helper.php file. I included the helper in my controller so that it could be used. The problem is that in the helper I need to use the CI Form helper but it won't load because $this does not exist.

Error:
Fatal error: Using $this when not in object context in C:\xampp\htdocs\sd\system\application\helpers\formbuilder_helper.php on line 8

How do I get this to work or should I be doing this a completely different way?


  Force Download vs 'Save Link as...'
Posted by: El Forum - 11-18-2008, 09:43 AM - Replies (1)

[eluser]deltajam[/eluser]
I just don't get it. Sometimes it works, sometimes it doesn't. This Force Download thing is starting to drive me crazy.

Why oh why can't I get it to work like a right-click on a link? If I choose to 'Save link as ...' the download dialog box immediately comes up. Where as, if I choose to use 'Force Download', sometimes it takes 5mins for the screen to come up, and sometimes it doesn't come up at all, and I get blank screen that says 'Done'.

I need a real solution here. How do I get Force Download to work like 'Save link as..'

I'm at the end of my rope here.

Code:
function get( $file_hash )
    {
        if ($this->session->userdata('logged_in') != TRUE) {
            $this->session->set_userdata('whereis_login','downloads/get/' . $file_hash );
            redirect('login/', 'refresh');
        }
        else
        {
            $query = $this->db->query("SELECT * FROM download_hash WHERE file_hash ='$file_hash' ");
            
            
            
            if ($query->num_rows() > 0)
            {
                $row = $query->row();
                
                $name = $row->file_name;
                
                $user_id = $row->user_id;
                $download_id = $row->download_id;
                $file_type_id = $row->type_id;
                
                $query2 = $this->db->query("SELECT name FROM download_type WHERE type_id ='$file_type_id' ");
                $row2 = $query2->row();
                
                $folder_name = $row2->name;
                
                if( $this->session->userdata('info_id') != $user_id )
                {
                    echo "You have not purchased this file.<p>";
                    echo "Please login and " . anchor('downloads/' . $download_id , 'click here') . " to purchase.";
                }
                else
                {
                    $data = file_get_contents( base_url() . "media/downloads" . $folder_name . $name );
            
                    force_download( $name, $data );
                }
        
                
            }
        
        }
    }


  Delete Core Libraries
Posted by: El Forum - 11-18-2008, 08:09 AM - Replies (3)

[eluser]wiZe[/eluser]
Hey,

i thought about deleting those core libraries i'll defenitly not use in a entire project to reduce the amount of files and prevent uploading useless classes. what about the integration of the libraries like "languages"? will CI give me any error on that? or is it a stupid idea to delete libraries?


  Active Record and MS SQL Server?
Posted by: El Forum - 11-18-2008, 08:01 AM - Replies (1)

[eluser]timboland[/eluser]
Can anyone confirm that CI's active record does or does not work with Microsoft sql server?


  Build page function
Posted by: El Forum - 11-18-2008, 06:32 AM - Replies (1)

[eluser]Ollie Rattue[/eluser]
Hi there,

I find that I am always repeating the order in which I load my view files like this:

Code:
$data['title'] = 'Welcome to mysite - Admin Area - Events view';
$this->load->view('admin/header', $data);
$this->load->view('admin/top_message');    
$this->load->view('admin/left_panel');    
$this->load->view('admin/events/view', $data);
$this->load->view('admin/footer');

An disciple of the Don't Repeat Yourself rule, I was wondering how I would build a function to do this automatically. I am not sure whether a function can load files like this. I want to do something like this:

buildpage(TITLE."- View events", 'admin/events/view', $data);

It would condense my code so much, and make it easier if I want to add/remove an extra view file in the future.

Is this possible?


  Temporary data.
Posted by: El Forum - 11-18-2008, 06:11 AM - Replies (1)

[eluser]Lazos[/eluser]
Hi. I am developing a CMS. What I want to do is when I try to add contents I would like to have a preview button. This button will temporary store the data I wrote into the add content form and it will attempt to show me in another page how the page will look like if I press the submit button.

I have TinyMCE that has a preview button but the output is not accurate without styles and a full size window. So I think the best way is to save the data temporary so I can view how it looks like before I press the final submit button. Any idea what or how I should do this?

Thanks.


  payment module using paypal
Posted by: El Forum - 11-18-2008, 06:07 AM - Replies (16)

[eluser]nandish[/eluser]
Hi guys


I have written out the steps that I think need to take place in the logical flow.

1. Build the Main Form
2. Validate the Form Data upon Submission
3. Transfer the user to PayPal with the PayPal_lib
4. Client fills out payment details on PayPal’s site
5. Client is transferred to a confirmation page
6. I receive the IPN confirmation from PayPal
7. Details [edit]from the original form[/edit] are posted to the DB and emailed to the Client and myself

Is there anything that I am missing for this?

Can any one please explain the flow of payment

Thanks in advance!


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
CVE-2022-40834 SQL Inject...
by reactionstudio
8 minutes ago
SQL server connection not...
by falagar2k
21 minutes ago
How to use Codeigniter wi...
by sr13579
21 minutes ago
Disable debug output in v...
by groovebird
30 minutes ago
CI 4.5.1 CSRF - The actio...
by kenjis
2 hours ago
CodeIgniter v4.5.0 Releas...
by kenjis
2 hours ago
Cache best practice?
by BhambriRohunu
3 hours ago
Bug with sessions CI 4.5....
by InsiteFX
4 hours ago
Codeigniter Shield Bannin...
by kenjis
8 hours ago
Best way to create micros...
by kenjis
11 hours ago

Forum Statistics
» Members: 85,309
» Latest member: canhoglobalcitycomvn
» Forum threads: 77,578
» Forum posts: 375,989

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB