vibhaJ 126 Master Poster

Thanks all for your answers. We finally got solution from "dosarrest". Any ping on server will be first passed to dosarresr and it will only redirect valid ping to our server and all spamm ping will be aborted. Though its costly but its working like a charm. Our website is faster than before. It may help someone who is comming to this thread for their problem.

vibhaJ 126 Master Poster

I have mobile web services written in PHP. Ant it is running on Apache Linux. Suddenly since yesterday our server became too slow. We found the reason that there are many continuous connection is coming to our server. Which is engaging bandwidth and making server slow.

We have asked hosting provider GoDaddy to restrict some country from firewall but it is not suggested by them. I have tried with htaccess but it doesnt work. What is the idle solution for this?

vibhaJ 126 Master Poster

You need to work on mysql queries.
No one can help you without your database structure.

vibhaJ 126 Master Poster

From Google...

<?php
// ------------------------------------------------------------
function recursive_remove_directory($directory, $empty=FALSE)
{
    if(substr($directory,-1) == '/')
    {
        $directory = substr($directory,0,-1);
    }
    if(!file_exists($directory) || !is_dir($directory))
    {
        return FALSE;
    }elseif(is_readable($directory))
    {
        $handle = opendir($directory);
        while (FALSE !== ($item = readdir($handle)))
        {
            if($item != '.' && $item != '..')
            {
                $path = $directory.'/'.$item;
                if(is_dir($path)) 
                {
                    recursive_remove_directory($path);
                }else{
                    unlink($path);
                }
            }
        }
        closedir($handle);
        if($empty == FALSE)
        {
            if(!rmdir($directory))
            {
                return FALSE;
            }
        }
    }
    return TRUE;
}
// ------------------------------------------------------------
recursive_remove_directory('install');
?>
BadManSam commented: Thanks This Script Worked +0
vibhaJ 126 Master Poster

From getParameter function it seems meetnewpeopleId should be passed to url.
i.e. yourpage.php?meetnewpeopleId=177

Are you passing meetnewpeopleId in url or any object?

vibhaJ 126 Master Poster
<?
    if(form is submitted)
    {
        $transportAll = $_POST['transport'];
        foreach($transportAll as $transport)
        {
            echo '<br />You have selected:'.$transport;
        }
        echo '<br />Total:'.count($transportAll);
    }
?>
vibhaJ 126 Master Poster

As pritaeas says, have you tried simple htaccess rule?? like below?

# This allows you to redirect your entire website to any other domain
Redirect 301 / http://www.google.com/

First of all check if htaccess is working in your server or not?

vibhaJ 126 Master Poster

1) First of all make sure all your href should have seo url, which you finally want
i.e. fullnews.php/123/This-is-the-Headline
So below code will make such href.

function seo($input){
    $input = mb_convert_case($input, MB_CASE_LOWER, "UTF-8"); //convert UTF-8 string to lowercase
    $a = array('č','ć','ž','đ','š');
    $b = array('c','c','z','dj','s');
    //$input = strtr($input, "čćžđšè", "cczdse"); not working properly :(
    $input = preg_replace("/[^a-zA-Z0-9]+/", "-", $input); //replace all non alphanumeric chars with dashes
    $input = preg_replace("/(-){2,}/", "$1", $input); //prevent repeating dashes
    $input = trim($input, "-"); //trim dashes both sides, if any
    return $input;
}
while($row=mysql_fetch_array($sel))
{
$id=$row['id'];
$headline=$row['headline'];
echo "<a href='fullnews.php/".$id."/".seo($headline)."'>$headline</a>";
}

2) Add below code in htaccess file.

RewriteEngine On
RewriteRule ^fullnews\.php/([^/]*)/([^/]*)$ /fullnews.php?id=$1&headline=$2 [L]

So that
The original URL:
http://domain.com/fullnews.php?id=123&headline=asas-asa-as
The rewritten URL:
http://domain.com/fullnews.php/123/asas-asa-as

vibhaJ 126 Master Poster

ORDER BY RAND()

ORDER BY RAND() will do the same thing.
Better to use it instead of 4 line coding. For better practice when things are possible from mysql query better to use it directly instead of 2-3 php operation.

vibhaJ 126 Master Poster

Try this:

<form method="post" autocomplete="off">
vibhaJ 126 Master Poster

Are you saving image path or image data in database?? It is working for me for image data.

vibhaJ 126 Master Poster

Below is two functions which can be used for insert and update tables.
When you have large table you can try it, you need to pass array to function as shown in example.
I know it is off to your question but this code may help you.

<?
//======= function for insert into database =========
function insert($tbl,$arr)
{
    $sql = " INSERT into $tbl set ";
    foreach($arr as $key=>$val)
    {
        $sql.=" `$key` = '$val' ,";
    }
    $sql = substr($sql, 0, -1); 
    mysql_query($sql) or die( '<br /><strong>Insert Query: </strong>'.$sql.'<br /><br /><strong>Error: </strong>'.mysql_error());
    return mysql_insert_id();   
}
//======== function for updating value ===========
function update($tbl,$arr,$where='')
{
    $sql = " UPDATE $tbl set ";
    foreach($arr as $key=>$val)
    {
        $sql.=" `$key` = '$val' ,";
    }
    $sql = substr($sql, 0, -1); 

    if($where != '')
        $sql.= ' WHERE '.$where;
    $res = mysql_query($sql) or die( '<br /><strong>Update Query: </strong>'.$sql.'<br /><br /><strong>Error: </strong>'.mysql_error());
    return $res ;
}
//=== insert user ======
$tbl = 'user';
$data = array();
$data['firstname'] = $_POST['firstname'];
$data['lastname'] = $_POST['lastname'];
$user_id = insert($tbl,$data);

//=== update user ======
$tbl = 'user';
$data = array();
$data['address'] = $_POST['address'];
$data['zipcode'] = $_POST['zipcode'];
$data['subject'] = $_POST['subject'];
$user_id = update($tbl,$data,"user_id=$user_id");

?>
vibhaJ 126 Master Poster

As blocblue says you can set timezone.
If you have access of php.ini, you can also set timezone in directly php.ini.

vibhaJ 126 Master Poster

You can use Ajax.
Once page is loaded at user side and then you want any php operation without page load you can use ajax.
Below is sample code. You need to include jQuery file to run it.

By default show only one pic. When user click on button call this ajax function.
in ajax.php file you need to write php code to fetch any random image src and just echo it.

$.ajax({
  url: 'ajax.php',
  success: function(data) {
   alert('random image src:'+data);
    // data will be src of image
    // using javascript you can change image's src from data
  }
});
vibhaJ 126 Master Poster

Post your code.

vibhaJ 126 Master Poster

Try this code:

echo $query = "SELECT link FROM asmmanual WHERE id = '".$q."'"; exit;

You will see one quesy in browser, copy that query and run it in your mysql query window.
Post what is your query output.

vibhaJ 126 Master Poster

I think you should add $_SESSION['timeout'] = time(); inside if(isset($_SESSION['timeout'])) {condition.

Once your session expires and you are redirected back to index.php again you will have $_SESSION['timeout'] set with time(); So you can redirect back anywhere.

vibhaJ 126 Master Poster

Make sure you have proper src to show image in browser.
Your src can be relative or absolute.

1) http://localhost/nseries/A2-1C1-1B.png

OR

2) nseries/A2-1C1-1B.png (considering php page running this code is placed beside nseries folder.)

vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

What do you mean by corrupt?? Are you uploading image file, how do you know file is corrupted?
Also check both file's size.

vibhaJ 126 Master Poster

Learn from this link and then post if you have issue. http://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax/

vibhaJ 126 Master Poster

John, don't attack on old post. Create new thread with your question and code you have tried.

vibhaJ 126 Master Poster

Can you attach submitresume.php complete file that is uploaded on your live server.

vibhaJ 126 Master Poster

what is error line number?
Also for testing remove all comments once and then try.

vibhaJ 126 Master Poster

post your code.nobody can assist you without looking in your code.

vibhaJ 126 Master Poster

Check this code. I have used jquery to get selected text.
Also you have used name="categories[]", there is no need to use array as select tag is not multyple. You can use name="categories" . check if this code is working for you or not!

<script src="http://code.jquery.com/jquery-1.7.js"></script>
<script language="javascript">
jQuery(document).ready(function(){
    $(".categories").change(function() {
        var selected = $(this).find("option:selected").text(); // here is selected text
        alert(selected+' clicked!');
    });
});
</script>

<select style="color: rgb(0, 51, 153); text-align: justify; font-size: 1em; border-left: medium none; border-right: medium none; border-bottom: medium none;" class="categories" name="categories">
  <option value="0">--Select One--</option>
  <option value="2">BRAKE SYSTEMS</option>
  <option value="1">CAR CARE SERVICES</option>
  <option value="4">COMFORT CONTROL</option>
  <option value="3">COOLING SYSTEM</option>
  <option value="9">OTHER</option>
</select>
vibhaJ 126 Master Poster

Make sure you don't sent anything on browser before you use session_start.
Is there any blank space before code start?

vibhaJ 126 Master Poster

Are you displaying this category values from database?
If yes, then when numeric values are posted after form submission, you need to fetch value of category from database using posted numeric id.

If no, you can directly use text as a value.

Making the value equal to the text value is not an option.

Why don't you use text as value?

vibhaJ 126 Master Poster

Is your php short tag is open in php.ini?

vibhaJ 126 Master Poster

Yes. You need to create new .htaccess file and place it at root of your project.
There are many sites which can create code for htaccess.
Personally i like this site: http://www.generateit.net/mod-rewrite/

vibhaJ 126 Master Poster

Okay..good.. Read my signature :)

vibhaJ 126 Master Poster

Replace

<<div class="textrightblog">

With

<div class="textrightblog">
vibhaJ 126 Master Poster

I am not sure if you can access via this.
But can you have access of image storage of other machine? If yes you can save image in wamp folder.

vibhaJ 126 Master Poster

On login page you need to check session. If it is set then you need to redirect user to home page as shown below.

if(!isset($_SESSION['Memberid'])){
header("Location: home.php");
} 

Also make sure session_start() should be in top of page.You can add session_start() in database_connection.php file.

vibhaJ 126 Master Poster

You can use below function for filtering data before inserting in database.

function filter($data) 
{
    $data = trim(htmlentities(strip_tags($data)));

    if (get_magic_quotes_gpc())
        $data = stripslashes($data);

    $data = mysql_real_escape_string($data);

    return $data;
}
$filename  = filter($filename);
vibhaJ 126 Master Poster

Thanks diafol for your reply.
Dropbox is huge, i just want small file manager with minimum space allowed.

I understand your vesion logic for rollback. But as you said it will be too huge and heavy to maintain and store all users previous version's files.
Yes i can rollback using dataabse, but i am not sure if any server provides such functionallity that they will automatically takes backup at midnight. Are you aware?

Also security is main concern. I will give 777 permission to upload folder and i don't know if there may be any issue of virus or hackers attack. Will you personally suggest any protective secured hosting server.

vibhaJ 126 Master Poster

Hi Friends,

I want to develop a website like file manager. Where user register and will get fix disk space lets say 20MB.
Now user can upload their pdf, doc, txt, jpeg etc files upto their disk limit.
I can develop upto this using PHP.

Now my issue is if user's files are corrupted they can rollback their folders before 2-3 days.
Files must be secure and safe from viruses as users are uploading their important documents.
I am also thinking to store user's files on 3rd party server.

Anybody have ideas or thoughts on this? Please share.
Is there any 3rd party storage server who provides such facility?

Thanks.
VJ

vibhaJ 126 Master Poster

$_GET['tm']==td

td should be in quote. i.e. 'td' OR "td"

vibhaJ 126 Master Poster

Wherever you are using $_GET'tm'] use isset($_GET['tm'])before it as shown below

if(isset($_GET['tm']) && $_GET['tm']...something..)

vibhaJ 126 Master Poster

You have to use . (dot) for concatenation and not +.

So this:

echo ('result es ' + $result);

Should be

echo ('result es '. $result);
vibhaJ 126 Master Poster

You want to redirect to xml page, what is goback.php?

If you want to redirect to xml file i.e. myfile.xml then,
header("location:myfile.xml");

vibhaJ 126 Master Poster

You mean your search is working fine, but you just need to arrange search result list.. Is it right??

vibhaJ 126 Master Poster

When you insert image in database use chunk_split function as shown below.

$image = chunk_split(base64_encode(file_get_contents($_FILES['fileupload']['tmp_name'])));

After that check, if still it is not working comment below line
// header("Content-type: image/jpeg");

and open get.php in other tab of browser, check if you having any error?

hwoarang69 commented: yeahh +0
vibhaJ 126 Master Poster

Your image's field datatype must be BLOB or LONGBLOB.

hwoarang69 commented: thanks +0
vibhaJ 126 Master Poster

Use session_start on top of page.
There should be no other HTML codes, html comments or any white space.

vibhaJ 126 Master Poster

What is datatype of image field in mysql table?

hwoarang69 commented: blob +0
vibhaJ 126 Master Poster

many ways:

<?
$mtn = array('08034', '08035', '08036','08037');
echo $mtn[rand(0, (count($mtn)-1))];
?>
vibhaJ 126 Master Poster

When you up vote any post, add some comments, so i can get reputation points :)

hwoarang69 commented: thanks alot for your help +2
vibhaJ 126 Master Poster

i have edited post.. Have you checked that?

vibhaJ 126 Master Poster
<?
$mtn = array('08034', '08035', '08036','08037');
$rand_key = array_rand($mtn,1);
echo $mtn[$rand_key];
?>