cereal 1,524 Nearly a Senior Poster Featured Poster

Try to write echo $_POST['year']; if you want to use $year variable then you have to write $year = $_POST['year'];
Also, where did you get $_SERVER['HTTP_GSSO_USER']? I don't find this anywhere.

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Where you have //connect place print_r($query); exit; and check if the query has a regular structure, probably there is something wrong with the loop above, I don't see any space beetween WHERE and conditions.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can use str_replace() for days of week and months.


<?php $days_of_week_no = range(0,6); $days_of_week_translated = array( 'Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu' ); $months_no = range(1,12); $months_translated = array( 'Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'Desember' ); $week_day = str_replace($days_of_week_no, $days_of_week_translated, date('w')); $month = str_replace($months_no, $months_translated, date('n')); echo $week_day . ' ' . date('d') . ' ' . $month . ' ' . date('Y'); ?>

Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok then, I tried.. ^__^

cereal 1,524 Nearly a Senior Poster Featured Poster

I would use a captcha for new users: if a user writes more than N posts in a given period of time (10~ minutes) then a response to a captcha field is requested for each new attemp. Just an idea o_o'

cereal 1,524 Nearly a Senior Poster Featured Poster

The reason it was an empty set was because I was deleting each new entry thats all, but I don't no if that makes any difference?

Ah! Sure it makes a difference because you showed only the select part of the query, neither the insert nor the delete queries, this explains why you could not get the doc_id.

I put that function sanitize_data before my insert query too is that ok?

sure, you have to.

I don't really no how to incorporate the doc_id into the email part of the script. Here is a snippet of the email code, should I put it into a $message variable?

Yes, just add something like: $message .= "$post[doc_id]"; along with your HTML and it's not a problem if you don't use $post['doc_number'] mine was just an example.

A question: if you delete the entry from the database right after the insert, even if you send a number to the client, he cannot use it to retrieve this data from the website and if he writes back with that number as reference, you don't have any data to match.. what's the sense of this? Just to get an incrementing number? o_o'

cereal 1,524 Nearly a Senior Poster Featured Poster

Good.

If the email is sent from the same script then just use the same $id variable as in my previous post. But try also to run your previous select query directly from phpmyadmin (or mysql shell) wiht same conditions and check if you get a result, because it's strange that you get an empty set. Also I suggest you to trim and escape data before running a query, something like this can be useful:

    function sanitize_data($data)
    {
        $data = array_map('trim',$data);
        $data = array_map('strip_tags',$data);
        $data = array_map('htmlspecialchars',$data);
        $data = array_map('mysql_real_escape_string',$data);
        return $data;
    }

    $post = sanitize_data($_POST);

and then, for example, write echo $post['doc_number']; instead of echo $_POST['doc_number'];.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, now is clear, nothing seems to be wrong to me, have you tried mysql_insert_id()? http://php.net/manual/en/function.mysql-insert-id.php
You can run this right after the form submits data to the database:

mysql_query('INSERT ...');
$id = mysql_insert_id();

This way you don't need to bug the database another time with a select query.
Also if anybody else has an idea..

cereal 1,524 Nearly a Senior Poster Featured Poster

In some browsers you can change the user agent, not even javascript will detect the difference. Try it your self if you want:

maybe checking window.navigator.oscpu, you can detect the OS but I think this also is fakeable.. perhaps with flash or a java applet you can detect the right browser, but I'm not sure if this is real possible and how to do it.

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

I still don't understand what you want to achieve, the last query you posted is the same of the first post.
doc_id is primary key in tc_tool.forms or is a foreign key to another table? Can you run this query and paste the output?

explain tc_tool.forms;
cereal 1,524 Nearly a Senior Poster Featured Poster

Value of parameter 19 is 'verify', $activationKey is 20 (and it seems to work fine) unless you are counting from 0. If that it's a enum field then check if 'verify' is an accepted value.

cereal 1,524 Nearly a Senior Poster Featured Poster

Add or die(mysql_error()); both to line 2 and 4 (and also 7 if you want to check the query). Probably you need to set username, password in mysql_connect(), because if there is no database connection, mysql_query() returns false and you get that error.

cereal 1,524 Nearly a Senior Poster Featured Poster

With GD it's not simple, you need to detect if the image is animated, split, resize each frame and merge them again, check if this class is helpful for you:

http://www.phpclasses.org/package/7353-PHP-Resize-animations-in-files-of-the-GIF-format.html

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Something like this will work:

    <?php
    $file = $_FILES['file']['name'];
    $a = pathinfo($file);

    $basename = $a['basename'];
    $filename = $a['filename'];
    $extension = $a['extension'];

    $path = $_SERVER['DOCUMENT_ROOT'].'/up/images/'; # set upload directory
    $dest = $path.$basename;

    if(file_exists($dest))
    {
        $b = count(glob($path.$filename.'*.'.$extension))+1; # all matches + 1
        for($i = 1; $i < $b; $i++)
        {
            if(!file_exists($path.$filename.$i.'.'.$extension))
            {
                move_uploaded_file($_FILES['file']['tmp_name'],$path.$filename.$i.'.'.$extension);
            }
        }
    }
    else
    {
        move_uploaded_file($_FILES['file']['tmp_name'],$dest);
    }
    ?>

If the file exists then the script does a glob() in the destination directory in search of the filename (without the number) and counts all the matches, we add 1 to the result and go to loop until a free combination is find. This is just an interpretation of a function used in CodeIgniter framework that you can find in System/Libraries/Upload.php at line 390~ the difference is that in CI that function is limitated to 100 loops. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

It's $q, imagepng() as third parameter takes values from 0 to 9, which is different from imagejpeg()

http://www.php.net/manual/en/function.imagepng.php

also, take a look at imagegif(), it does not have a third paramenter for quality, so remove it:

http://www.php.net/manual/en/function.imagegif.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Check if this thread helps you: http://codeigniter.com/forums/viewthread/71999/
Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Use absolute paths, you can use $_SERVER['DOCUMENT_ROOT'] . "/members/$securecode/$sname/..."

Also, if I upload a file with double extension, let's say my_image.jpg.php, it will get through the conditional statement at line 7. Bye.

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Provide the code you are using, at least the PNG creation part and the serving script. Otherwise it's hard (at least for me ^_^) to give the right answer, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

I'm missing something, it's a counter? I don't see an update or insert query here, so the problem may be there. Can you show that code and an example output of the database table? If the count is done by adding a new row each time (insert) instead of an update query, then you need to change your select query with something like:

"select count(doc_id) as total_doc_id from tc_tool.forms group by doc_id"

where you have to add your WHERE conditions. Hope it helps.

cereal 1,524 Nearly a Senior Poster Featured Poster

Which error? Add or die(mysql_error()); to line 27, you will get some output about the error:

$result_query = mysql_query($select_query, $connection) or die(mysql_error());

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Did you tried to print_r($_POST); at very top of the file to check if everyting you need is retrieved?
Second: add or die(mysql_error()); at the end of the update query, line 351 and check what happens, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

And also change line 18 to:

$login = mysql_query("SELECT * FROM Jobseeker WHERE Username = '$username' and Password = '$password'") or die(mysql_error());

At the moment at line 22 the input for mysql_num_rows() is just a string, not a query result.

cereal 1,524 Nearly a Senior Poster Featured Poster

Try by adding ."\n" at the first echo:

<textarea name="payment_details" cols="40" rows="3" class="inputt2"><?php echo $row['polnum']."\n"; ?> <?php echo $row['provider']; ?></textarea>

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

As suggested by Biiim you could use symbolic links: http://php.net/manual/en/function.symlink.php
In linux the command is ln -s /path/to/file.ext /new/path/file.ext but you can do this to the parent directory, just like an alias and have two different directory names poiting to the same files.

cereal 1,524 Nearly a Senior Poster Featured Poster

If this CMS is developed over a framework there are some chances to use some sort of routing library embeded, otherwise search for routing solutions like http://fatfree.sourceforge.net/

note apart: if they've been hacked it's probably because of a misconfigured .htaccess file or for wrong permission on the parent folder, the rewriting rule it self is not harmful, so there should be no reason to not use it, my opinion.

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Just a little error: you are placing class="selected" inside <li> while your CSS is checking for the <a> tag. Change it like this:

<li><a <?php echo ($thisPage == 'Home') ? ' class="selected"' : ''; ?> href="index.php">Home</a></li>

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

On CodeIgniter forum there is a thread about a similar problem (I think), but at the moment there aren't answers:

http://codeigniter.com/forums/viewthread/209004/

I'm wondering if this can be related to Utf8 library, this is in System/Core, check if removing @ from iconv() and mb_convert_encoding() will display an error. Good luck!

Dani commented: Thank you for the suggestion. +0
cereal 1,524 Nearly a Senior Poster Featured Poster

In linux you can use nslookup, in PHP gethostbyname() and gethostbynamel() to get the list:

http://www.php.net/manual/en/function.gethostbyname.php
http://www.php.net/manual/en/function.gethostbynamel.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

change elseif line to:

elseif(!isset($keyword)) {
cereal 1,524 Nearly a Senior Poster Featured Poster

Check the manual: http://php.net/manual/en/control-structures.elseif.php

if {} # first

elseif {} # in the middle
else if {} # "elseif" and "else if" are the same

else {} # last

bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

Ok, if we've finished mark this thread as solved, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Right, then change it to:

"SELECT FirstName, LastName, Age, Hometown, Job FROM people WHERE age <= ?"

As explained here: http://php.net/manual/en/mysqli-stmt.bind-param.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Add single quotes around $keyword:

"SELECT FirstName, LastName, Age, Hometown, Job FROM people WHERE age <= '$keyword' "

Also use CODE tags when posting to the forum, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

What kind of errors do you get?

cereal 1,524 Nearly a Senior Poster Featured Poster

Check line 23: setcookie("id", "id", time()+86400); the second argument, the value, is "id" while it should be $id: setcookie("id", $id, time()+86400);

cereal 1,524 Nearly a Senior Poster Featured Poster

Maybe it's a memory limit issue, i.e. the memory used by PHP scripts, did you get any error? If error reporting is disabled, place <?php error_reporting(E_ALL); ?> at top of the script and see what it happens.

cereal 1,524 Nearly a Senior Poster Featured Poster

Your code seems ok to me, but why do you have var_dump($x); inside your javascript? var_dump() it's PHP, you need console.log there, or alert as you already wrote. And also you need to change your document.write to integrate the var as you did in the alert: document.write('<a href="' + unescapedUrl + '">save the image</a>'); bye :)

paulaandrea commented: THANKS SO MUCH +0
cereal 1,524 Nearly a Senior Poster Featured Poster

Here's what you can try:

<?php session_start(); ?>
<h3>Cookies</h3>
<pre>
<?php
print_r($_COOKIE);
?>
</pre>
<h3>Session</h3>
<pre>
<?php
print_r($_SESSION);
?>
</pre>

After your login go to this page and check if you get same variables or if something is missing, do this test with the iphone and desktop. I mentioned cookies because I didn't know if you used them or not. I can't help more than this without the code.

cereal 1,524 Nearly a Senior Poster Featured Poster

Create a php page to display cookies and session values and then open it with iphone and a desktop. This will help you to understand what is not working. Also check error and access log files in apache.

cereal 1,524 Nearly a Senior Poster Featured Poster

This is called database replication, you can apply different solutions, if you are using MySQL then read these:

http://dev.mysql.com/doc/refman/5.0/en/replication.html
http://www.howtoforge.com/mysql_database_replication

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

Use glob() to do that: http://php.net/manual/en/function.glob.php

$array = glob('*.xml',GLOB_NOSORT);

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

An example based on this comment: http://www.php.net/manual/en/ref.simplexml.php#66259

<?php
function display($in, $string) {
    if (file_exists($in)) {
        $xml = simplexml_load_file($in);
    } else {
        throw new Exception($in . " does not exist");
    }

    $manifest = $xml->children('http://www.w3.org/1999/02/22-rdf-syntax-ns');
    $a = '';
    foreach ($manifest->xpath('//rdf:value') as $value) {
	if(trim($value) == trim($string))
	{
		$a = $manifest->xpath('//rdf:object');
	}
    }

    # json used to remove SimpleXMLElement Object
    return json_decode(json_encode($a),true); 
}

$f = 'file.rdf';
$search = 'formality';
print_r(display($f,$search));
?>

Will give you this:

Array
(
    [0] => Array
        (
            [0] => vj
        )

)

You can improve it, just read the documentation, bye.

cereal 1,524 Nearly a Senior Poster Featured Poster

You can extend the Form_validation library which is in System/Libraries or you can use callbacks: http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks

To extend an existent library check at the end of this page: http://codeigniter.com/user_guide/general/creating_libraries.html

Also if you create a callback function set that public and if you don't want to be accessible from the url then place an underscore before the name of the function, example:

# if private or protected it won't work
public function _confirm($y)
{
        if($y == 'yes')
        {
            return true;
        }
        else
        {
            # without error message you get a notice from CI.
            $this->form_validation->set_message('_confirm', 'Value of %s is not valid.');
            return false;
        }
}

In your rule then you will write:

$this->form_validation->set_rules('confirm', 'confirm checkbox', 'trim|required|exact_length[3]|xss_clean|callback__confirm');

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Check the guide: http://codeigniter.com/user_guide/database/active_record.html#delete

$this->load->library('database');

$this->db->where('id',$id);
$this->db->delete('add_campaign');

$tables = array('table1', 'table2', 'table3');
$this->db->where('addcampid', $id);
$this->db->delete($tables);

bye

cereal 1,524 Nearly a Senior Poster Featured Poster

It can be done like this:

<?php
$html = '<tbody><tr>   <td>1.</td>   <td><a href="something.php?y=US&amp;id=197003">Some Name Here</a></td>   <td>City, STATE</td>   <td class="noWrap"></td>   <td class="noWrap">123-456-7890</td></tr><tr class="altRow">   <td>2.</td>   <td><a href="something.php?y=US&amp;id=113762">Another Name</a></td>   <td>City, STATE</td>   <td class="noWrap"></td>   <td class="noWrap">123-456-7890</td></tr>';

function get_id($data)
{
	preg_match_all('/< *a[^>]*href *= *["\']?([^"\']*)/i', $data, $matches);
	$result = array();
	foreach($matches[1] as $id)
	{
		$r = explode('id=',$id);
		$result[] = $r[1];
	}
	return $result;
}
print_r(get_id($html));
?>

Using preg_match_all to get all href in a tags and then searching for the right pattern, the constant, I set "id=" as constant in the explode() function but you can set also explode('something.php?y=US&amp;id=',$id); if you want and you will get the same result:

Array
(
    [0] => 197003
    [1] => 113762
)

an array of IDs, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Place resource link as second parameter, the first has to be the query string:

$r = mysql_query("DELETE FROM customer WHERE id = '$id'",$dbc);

Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

try this:

if (
 ( isset($_POST['submit']) && isset($_POST['pica10']) ) # submit & pica10
 || isset($_POST['pica14']) # from here single conditions
 || isset($_POST['pica18'])
 || isset($_POST['pgata10'])
 || isset($_POST['pgata14'])
 || isset($_POST['pgata18'])   
 || isset($_POST['mmec10'])
 || isset($_POST['mmec14'])
 || isset($_POST['mmec18'])
 || isset($_POST['mpae10'])
 || isset($_POST['mpae14'])
 || isset($_POST['mpae18'])
 || isset($_POST['mpica10'])
 || isset($_POST['mpica14'])
 || isset($_POST['mpica18']) 
 || isset($_POST['mrel110'])
 || isset($_POST['mrel114'])
 || isset($_POST['mrel118'])
 || isset($_POST['coke'])
 || isset($_POST['cokezero'])
 || isset($_POST['spr'])
 || isset($_POST['minmaid'])
)
cereal 1,524 Nearly a Senior Poster Featured Poster

If you can, please post explain for both tables: explain profiletable; explain presentTable; so we can check the structure and try, bye :)