Never mind it works

Hello i have this codes to try to get this working. But when on ./index.html all the li are given a class of current_yes exept for the ./clients.html link. And the other way aroud if i go to Clinets/clients.html then all li exept ./index.html are given a class of current_yes. I also use this script with a menu with no sub level and for this menu it works. So if any boudy have any idea please share. Thank you.

jQuery(document).ready(function($){

    var url = location.href;

    $('.ribbon a').filter(function() {

    return this.href == url;})

    .closest('li').addClass('current_yes');

});

And this is how my menu html looks like:

<!-- Responsive menu -->
<div class="ribbon">
<div class="rmm style">
<ul>
<li>
<a href="./index.html">HOME</a>
</li>
<li>
<a href="">PROJECTS</a>
<ul>
<li>
<a href="">IKEA - NORWAY</a>
</li>
<li>
<a href="">FASTEC - SWEDEN</a>
</li>
</ul>
</li>
<li>
<a href="./clients.html">CLIENTS</a>
<ul>
<li>
<a href="">IKEA</a>
</li>
<li>
<a href="">FASTEC</a>
</li>
</ul>
</li>
<li>
<a href="">CONTACT US</a>
</li>
<li>
<a href="">WEBSHOP</a>
</li>
<li>
<a href="">ADMIN</a>
<ul>
<li>
<a href="">STAFF</a>
</li>
<li>
<a href="">DOCUMENTS</a>
</li>
</ul>
</li>
</ul>
</div>
</div>

I also have a js script that make the menu function it looks like this:

function adaptMenu() {
    /*  toggle menu on resize */
    $('.rmm').each(function() {
        // initialize vars
        var maxWidth = 0;
        var width = 0;

        // width of menu list (non-toggled)
        $('.rmm-menu').children("li").each(function() {
            if($(this).parent().hasClass('rmm-menu')){
                width = $(this).outerWidth();//outerWidth();
                if(width>0){
                    maxWidth += width;
                }
            }
        });

        // compare width
        var width = $('.rmm').css('max-width');
        width = width.replace('px', ''); 

        if ( $(this).parent().width() > width ) {
            $('.rmm-menu').removeClass("rmm-mobile");

            //remove ...

OK, i have jQuery Drop/Sort working. Now i need a save the new order function, i think that will be an PHP function. This is the code i have now:

<?php
require("../config.php");
if ($enablegzip == "1")
{
ob_start("ob_gzhandler");
header("Content-Encoding: gzip");
}
session_start();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<title>Web links - List (<?php echo basename(dirname(__FILE__));?>)</title>
<link rel=StyleSheet href="style.css" type="text/css">
<script type="text/javascript" src="../collapse_expand_single_item.js"></script>
<script type="text/javascript" src="../jquery-1.11.1.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>  
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> 
</head>
<body>
<br>
<div class="link_back">
<a href="../index.php">Back to Index</a></div>
<br>
<div class="add_link">
<a href="#first" onClick="shoh('first');">Add new link +</a></div>
<br>
<div class="index_letter"><?php echo basename(dirname(__FILE__));?></div>
<div class="add_links" style="display: none;" id="first">
<div class="box">
<br>
<form action=addurl.php method=POST name="addurlform">
<div class="box_title">Title:</div><input type=text name=text size="56">
<div class="box_link">Drag & Drop Link:</div><input type=text value="" name=link size="56">
<div>
<br><br>
<input type=submit class="add_button" value="Add"></div>
</form>
<br>
</div>
</div>
<br>
<?
$gbfile='links.txt';
$separator= '|';
//====================================
//This function will add one line to 
//the end of file
//====================================
function add($str){
global $gbfile;
      $tmp = trim($str);
      $fp=fopen($gbfile,'a+'); 
           flock($fp, LOCK_EX); 
                fwrite($fp, $tmp. "\n"); 
           flock($fp, LOCK_UN); 
      fclose($fp); 
}
//====================================
//Function below gets specified number
//of lines and returns an array
//====================================
function get($start, $end){
global $gbfile;
      $records=array(); 
      $filename="links.txt"; 
      $fp=fopen($gbfile,'r'); 
           flock($fp, LOCK_SH); 
           $i=1; 
           $tmp=TRUE;
           while($i<$start && !feof($fp)) {
                $tmp=fgets($fp);
                $i++;
           }
           while($i<=$end && !feof($fp)) {
                $tmp=trim(fgets($fp));
                if ($tmp) { array_push($records, $tmp); }
                $i++;
           }
           flock($fp, LOCK_UN); 
      fclose($fp); 
      return($records);
}
//Listing part
$start=$_GET['start'];
$end=$_GET['end'];
if (!$end || $start<=0) { $start=1; }
if (!$end) { $end=$linkspage; }
if ($end<$start) { $end=$start+1; }
$show=$end - $start;

//Get records from file into array
      $records = ...

Hello, im making a bookmark script to save on a web page as links. I have the following code but i want to have links movable.
That is i want to able to change position on the links. Demo: Click Here i have tested several Jquery/Java dragg/dropp/sort scripts but i can not get it to work. The only thing i gotten to work is that i can dragg the first link but no other links and even the firs link will not changs position. The links are saved in and echod from a links.txt file.

The code i use:

<?php
require("../config.php");
if ($enablegzip == "1")
{
ob_start("ob_gzhandler");
header("Content-Encoding: gzip");
}
session_start();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<title>Web links - List (<?php echo basename(dirname(__FILE__));?>)</title>
<link rel=StyleSheet href="style.css" type="text/css">
<script type="text/javascript" src="../collapse_expand_single_item.js"></script>
<script type="text/javascript" src="../jquery-1.11.1.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>  
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> 
    <script>  
        $(function() {
            $( "#sortable" ).sortable({   
                placeholder: "ui-sortable-placeholder"   
            });  
        });  
    </script>  
</head>
<body>
<br>
<div class="link_back">
<a href="../index.php">Back to Index</a></div>
<br>
<div class="add_link">
<a href="#first" onClick="shoh('first');">Add new link +</a></div>
<br>
<div class="index_letter"><?php echo basename(dirname(__FILE__));?></div>
<div class="add_links" style="display: none;" id="first">
<div class="box">
<br>
<form action=addurl.php method=POST name="addurlform">
<div class="box_title">Title:</div><input type=text name=text size="56">
<div class="box_link">Drag & Drop Link:</div><input type=text value="" name=link size="56">
<div>
<br><br>
<input type=submit class="add_button" value="Add"></div>
</form>
<br>
</div>
</div>
<br>
<?
$gbfile='links.txt';
$separator= '|';
//====================================
//This function will add one line to 
//the end of file
//====================================
function add($str){
global $gbfile;
      $tmp = trim($str);
      $fp=fopen($gbfile,'a+'); 
           flock($fp, LOCK_EX); 
                fwrite($fp, $tmp. "\n"); 
           flock($fp, LOCK_UN); 
      fclose($fp); 
}

//====================================
//Function ...

Hello, and thank you for aswering. I have tryed severol Java/Jquery Dragg/Drop/Sort scripts but i can't get them to work. I can only move the first link and i cant get even this one to change position.

Hello, im making a bookmark script to save on a web page as links. I have the following code but i want to have links movable.
That is i want to able to change position on the links. Demo: Click Here

The code i use:

<?php
require("../config.php");
if ($enablegzip == "1")
{
ob_start("ob_gzhandler");
header("Content-Encoding: gzip");
}
session_start();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, target-densitydpi=high-dpi">
<title>Web links - List (<?php echo basename(dirname(__FILE__));?>)</title>
<link rel=StyleSheet href="style.css" type="text/css">
<script type="text/javascript" src="../collapse_expand_single_item.js"></script>
<script type="text/javascript" src="../jquery-1.11.1.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>  
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> 
    <script>  
        $(function() {
            $( "#sortable" ).sortable({   
                placeholder: "ui-sortable-placeholder"   
            });  
        });  
    </script>  
</head>
<body>
<br>
<div class="link_back">
<a href="../index.php">Back to Index</a></div>
<br>
<div class="add_link">
<a href="#first" onClick="shoh('first');">Add new link +</a></div>
<br>
<div class="index_letter"><?php echo basename(dirname(__FILE__));?></div>
<div class="add_links" style="display: none;" id="first">
<div class="box">
<br>
<form action=addurl.php method=POST name="addurlform">
<div class="box_title">Title:</div><input type=text name=text size="56">
<div class="box_link">Drag & Drop Link:</div><input type=text value="" name=link size="56">
<div>
<br><br>
<input type=submit class="add_button" value="Add"></div>
</form>
<br>
</div>
</div>
<br>
<?
$gbfile='links.txt';
$separator= '|';
//====================================
//This function will add one line to 
//the end of file
//====================================
function add($str){
global $gbfile;
      $tmp = trim($str);
      $fp=fopen($gbfile,'a+'); 
           flock($fp, LOCK_EX); 
                fwrite($fp, $tmp. "\n"); 
           flock($fp, LOCK_UN); 
      fclose($fp); 
}

//====================================
//Function below gets specified number
//of lines and returns an array
//====================================
function get($start, $end){
global $gbfile;
      $records=array();
      $filename="links.txt"; 
      $fp=fopen($gbfile,'r'); 
           flock($fp, LOCK_SH); 
           $i=1; 
           $tmp=TRUE;
           while($i<$start && !feof($fp)) {
                $tmp=fgets($fp);
                $i++;
           }
           while($i<=$end && !feof($fp)) {
                $tmp=trim(fgets($fp));
                if ($tmp) { array_push($records, $tmp); }
                $i++;
           }

           flock($fp, LOCK_UN); 
      fclose($fp); 
      return($records);
}
//Listing part

$start=$_GET['start'];
$end=$_GET['end'];

if (!$end ...

OK, how wold i do that. Do you have an example of how that code wold look like?
Thank's

Do i put somthing here:

$result = explode('"', $result);
$confrom = explode(' ', $result[1]);
$conto = explode(' ', $result[3]);

I just get a blank page?

[QUOTE=nav33n;817219]You can set up a cron job to run every day (or night) and have this query. If you can't have crons, you can run this script whenever the main page is loaded.
[code=mysql]
DELETE FROM Table
WHERE datecolumn < DATE(DATE_SUB(now() , INTERVAL 15 DAY))
[/code][/QUOTE]

Whare wxactly do i put this code?, my DB connection code looks like this:

[CODE]?php

$databasename='xxxx'; // Name of the database
$tablename='xxxx'; // Name of the table
$mysqladd='xxxx'; // Address to the MySQL Server - Usually localhost but could be an IP address
$mysqluser='xxxx'; // Your MySQL UserName
$mysqlpass='xxxx'; // Your MySQL Password

//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());

//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());

$query="SELECT * FROM xxxx ORDER BY Timestamp DESC";

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) :

?>
[/CODE]

Anoter problem i have [CODE]//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());

//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());

$query="SELECT * FROM jobadd ORDER BY Timestamp DESC LIMIT 0, 10";

if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
//we give the value of the starting row to 0 because nothing was found in URL
$startrow = 0;
//otherwise we take the value from the URL
} else {
$startrow = (int)$_GET['startrow'];
}
$query="SELECT * FROM jobadd ORDER BY Timestamp DESC LIMIT $startrow, 10";
echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Nästa    </a>';
$prev = $startrow - 10;

//only print a "Previous" link if a "Next" was clicked
if ($prev >= 0)
echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'">Föregående</a>';

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) :
?>
[/CODE]

I'v got Text links "Nästa" "Föregående" to move throw pages but i also want numbers, e.g, if i have 55 posts and 10 posts per page thats 6 pages, i want between "Nästa" and "Föregående" linked numbers 1 2 3 4 5 6. Any idees?

I'm trying to get an email address from db. I'v fixt it now. [CODE]$mailto = ''.$_POST['mailto'].'';[/CODE]

DB CONNECT CODE:

[CODE]<?php

$databasename=''; // Name of the database
$tablename='
'; // Name of the table
$mysqladd=''; // Address to the MySQL Server
$mysqluser='
'; // Your MySQL UserName
$mysqlpass='****'; // Your MySQL Password

//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());

//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());

$query="SELECT * FROM jobadd";

$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) :
?>
[/CODE]

EMAIL FUNCTION CODE:

[CODE]<?php
function ValidateEmail($email)
{
$pattern = '/^(0-9a-z@(([0-9a-z])+([-\w][0-9a-z])*.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = '<?php echo mysql_result($result,$i,"Epost"); ?>';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Svar på Tjänstförfrågan från Jobler.se';
$message = 'Hej, Vi vill gärna lämna en facktura på denna Tjänstförfrågan';
$success_url = './tack.php';
$error_url = './error.php';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
$boundary = md5(uniqid(time()));

  $header  = 'From: '.$mailfrom.$eol;
  $header .= 'Reply-To: '.$mailfrom.$eol;
  $header .= 'MIME-Version: 1.0'.$eol;
  $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
  $header .= 'X-Mailer: PHP v'.phpversion().$eol;
  if (!ValidateEmail($mailfrom))
  {
     $error .= "The specified email address is invalid!\n<br>";
  }

  if (!empty($error))
  {
     $errorcode = file_get_contents($error_url);
     $replace = "##error##";
     $errorcode = str_replace($replace, $error, $errorcode);
     echo $errorcode;
     exit;
  }

  $internalfields = array ("submit", "reset", "send", "captcha_code");
  $message .= $eol;
  $message .= $_SERVER['REMOTE_ADDR'];
  $message .= $eol;
  foreach ($_POST as $key => $value)
  {
     if (!in_array(strtolower($key), $internalfields))
     {
        if (!is_array($value))
        {
           $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
        }
        else
        { ...

Yes i got this, but my code does not work.

how to get 1 email from mysql and send the mail to that emailaddress?

Still dont get it, Sorry

Cold anyone schow me how to get 1 email from mysql and send the mail to that emailaddress? Currently i got this code, but ´not working:

[CODE]//CONNECT TO MYSQL
$link=mysql_connect($mysqladd, $mysqluser, $mysqlpass) or die('Could not connect to database: ' . mysql_error());

//CONNECT TO DATABASE
mysql_select_db($databasename, $link) or die('Could not connect to table: ' . mysql_error());

$query="SELECT * FROM jobadd";

$result=mysql_query($query);

$num=mysql_numrows($result);

session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['captcha_code'],$_SESSION['random_txt']) && md5($_POST['captcha_code']) == $_SESSION['random_txt']) {
unset($_POST['captcha_code'],$_SESSION['random_txt']);
}
else { if ($errorpage == 'false') {
echo '<b>Fel kod!</b><br>';
echo '<a href="javascript:history.back()">Försök igen!</a>';
exit;
} if ($errorpage == 'true') {
header('Location: ././error.php');
exit;
}
}
}
?>
<?php

function ValidateEmail($email)
{
$pattern = '/^(0-9a-z@(([0-9a-z])+([-\w][0-9a-z])*.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$mailto = '<?php echo mysql_result($result,"Epost"); ?>';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Svar på Tjänstförfrågan från Jobler.se';
$message = 'Hej, Vi vill gärna lämna en facktura på denna Tjänstförfrågan';
$success_url = './tack.php';
$error_url = './error.php';
$error = '';
$eol = "\n";
$max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
$boundary = md5(uniqid(time()));

  $header  = 'From: '.$mailfrom.$eol;
  $header .= 'Reply-To: '.$mailfrom.$eol;
  $header .= 'MIME-Version: 1.0'.$eol;
  $header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
  $header .= 'X-Mailer: PHP v'.phpversion().$eol;
  if (!ValidateEmail($mailfrom))
  {
     $error .= "The specified email address is invalid!\n<br>";
  }

  if (!empty($error))
  {
     $errorcode = file_get_contents($error_url);
     $replace = "##error##";
     $errorcode = str_replace($replace, $error, $errorcode);
     echo $errorcode;
     exit;
  }

  $internalfields = array ("submit", "reset", "send", "captcha_code");
  $message .= $eol;
  $message .= $_SERVER['REMOTE_ADDR'];
  $message .= $eol;
  foreach ($_POST as $key => $value)
  { ...