Josh Connerty 20 Unverified User

Glad to hear it :)

Josh Connerty 20 Unverified User

I tested this while in a meeting so fingers crossed it works for you:

<?php

$ip_ranges = "63.119.179.0/24, 23.119.180.0/24,154.119.181.0/24,193.119.182.0/24,133.119.183.0/24";
    function multiCidrToRange($cidrs)
    {
        $return_array = array();
        $cidrs = explode(",",str_replace(" ","",$cidrs));
        foreach($cidrs as $cidr)
        {
            $begin_end = explode("/",$cidr);
            $ip_exp = explode(".",$begin_end[0]);
            $range[0] = long2ip((ip2long($begin_end[0])) & ((-1 << (32 - (int)$begin_end[1]))));
            $range[1] = long2ip((ip2long($range[0])) + pow(2, (32 - (int)$begin_end[1])) - 1);
            unset($ip_exp[3]);
            $ip_prefix = implode(".",$ip_exp);
            $count = str_replace($ip_prefix . ".","",$range[0]);
            $ncount = 0;
            while( $count <= (str_replace($ip_prefix,"",$range[0]) + str_replace($ip_prefix . ".","",$range[1])) )
            {
                $return_array[] = $ip_prefix . "." . $count;
                $count++;
                $ncount++;
            }
            $begin_end = false;
            $ip_exp = false;
            $range = false;
            $ip_prefix = false;
            $count = false;
        }
        return $return_array;
    }

    var_dump(multiCidrToRange($ip_ranges));

?>
matei_ commented: Thank you very much! You saved me. It works in the way I want it to. +0
Josh Connerty 20 Unverified User

Got meetings for the next couple of hours. I'll post something as soon as I get chance

Josh Connerty 20 Unverified User

OH I see. That won't work then. Let me look up the calculations for the range

matei_ commented: Any updates? Can't we work something from cidrToRange function? +0
Josh Connerty 20 Unverified User

So if you var_dump the text field and it's an empty array it implies it has nothing in the textfield. I need to see more of how it's implemented

matei_ commented: I solved the error, but the problem is now that I get only the IPs only to .24 and I should get until .255 +0
Josh Connerty 20 Unverified User

What does $pluginData hold? if you pass a list of comma separated range values to the function it will return an array of ip addresses from all of the ranges

matei_ commented: The $pluginData -> ipAddresses is the actual text area that holds all the CIDR ranges. +0
Josh Connerty 20 Unverified User

Something like that

<?php

    $ip_ranges = "32.89.178.30/24, 63.119.179.0/24, 23.119.180.0/24,154.119.181.0/24,193.119.182.0/24,133.119.183.0/24";
    function multiCidrToRange($cidrs)
    {
        $return_array = array();
        $cidrs = explode(",",str_replace(" ","",$cidrs));
        foreach($cidrs as $cidr)
        {
            $begin_end = explode("/",$cidr);
            $ip_exp = explode(".",$begin_end[0]);
            $range[] = $begin_end[1];
            $range[] = $ip_exp[3];
            unset($ip_exp[3]);
            $ip_prefix = implode(".",$ip_exp);
            $count = $range[1];
            while( $count <= ($range[0] + $range[1]) )
            {
                $return_array[] = $ip_prefix . "." . $count;
                if($count == 255)
                { exit; }
                $count++;
            }
            $begin_end = false;
            $ip_exp = false;
            $range = false;
            $ip_prefix = false;
            $count = false;
        }
        return $return_array;
    }

    var_dump(multiCidrToRange($ip_ranges));

?>
matei_ commented: Using "var_dump($pluginData -> ipAddresses)" it shows me this: "array(0) { }"... +0
Josh Connerty 20 Unverified User

Give me an 20 mins and I'll write something for you. Just got to finish what I'm on and push to live

matei_ commented: Sure, thank you very much! +0
Josh Connerty 20 Unverified User

$cidrs is not defined yet. This would be for instance explode(",",$my_form_field) passing an array of ranges

matei_ commented: I get only the CIDR, e.g.: 88.39.88.0/24, 89.33.88.0/24 etc.. I want to retrieve a list with IPs from all the CIDRs that I have in my textarea. +0
Josh Connerty 20 Unverified User
function cidrToRange($cidr) {
    $range = array();
    $split = explode('/', $cidr);

    if(!empty($split[0]) && is_scalar($split[1]) && filter_var($split[0], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
        $rangeStart = ip2long($split[0]) & ((-1 << (32 - (int) $split[1])));
        $rangeStartIP = long2ip($rangeStart);
        $rangeEnd = ip2long($rangeStartIP) + pow(2, (32 - (int) $split[1])) - 1;

        for($i = $rangeStart; $i <= $rangeEnd; $i ++) {
            $range[] = long2ip($i);
        }
        return $range;
    } else {
        return $cidr;
    }
}

$ip_arr = array();

foreach($cidrs as $cidr)
{
    array_merge(cidrToRange($cidr),$ip_arr);
}
echo '<ul>';
foreach($ip_arr as $ip)
{
    echo '<li>'.$ip.'</li>';
}
echo '</ul>';
matei_ commented: "Notice: Undefined variable: cidrs on line 41 && Warning: Invalid argument supplied for" - Line 41" foreach($cidrs as $cidr) +0
Josh Connerty 20 Unverified User

If theres discrepencies with spaces etc. I'd consider

$ips = explode(",",str_replace(" ","",$field)); // Gives IP's
foreach($ips as $key => $ip) {
    $range = explode("/",$ip);
    $ips[$key] = $range;
}

which will strip spaces out and then create an array of ip addresses

[0] => [[0] => 192.168.0.0, [1] => 30]
[1] => [[0] => 192.168.10.0, [1] => 10]
matei_ commented: Your function works as you said, but what I am trying to do is to retrieve a full list with IPs from the CIDR ranges that I have. +0
Josh Connerty 20 Unverified User

You need to use JavaScript and possibly AJAX to make this work. You need to put an "onChange" event on each drop down box so that the page reacts to the drop down box being changed. Do you have any JavaScript knowledge?

Josh Connerty 20 Unverified User

Have you tried another mouse? It sounds more like the mouse as oppose to the OS.

Josh Connerty 20 Unverified User

Forgot or forgets? I should imagine it has an easy fix in the registry, have you tried contacting microsoft about registry entries for live?

I presume you have reinstalled messenger?

Josh Connerty 20 Unverified User

Okay, I will let you down gently, I think it's a bit farfetched to explain this through a forum. It is virtually imposible for me to tell you how to do this.

The two tables are vastly different.

It would take a week maybe more for a professional to do this.

Unfortunately this is too difficult to do through a forum. I am really sorry.

Josh Connerty 20 Unverified User

Yes thats right, either attach them to a post or open them up and copy and paste the contents into tags. ;)[code=sql] tags. ;)

Josh Connerty 20 Unverified User

Basicly, just use your orignal document. Make a submit button that will go to another document.

In this document you will need to handle the posted data. You will need to make queries dependant on the value passed. For instance if it is UK then you need to select the stuff from other tables that relate to the UK.

Josh Connerty 20 Unverified User

Right first of all you need to export the tables from wich you think the members are held.

You need to do this for both, after doing so you can post them in tags.[code=sql] tags.

Josh Connerty 20 Unverified User

I would suggest also making a dedicated table for the user preferences. However I would suggest making a column for each preference. Eg. user_id, gardening, pet, food.

As for the pets, gardening and food tables, it is a good idea to make as many tables in your database as possable, this means you wont overstress a single table.

So in a sense, when the user sellects pet and food you will check the table for the users ID if there is already and ID then edit that row else make a new one. The idea is add a 1 into the column the chose, in the instance it is pet and food,

This will make the row look like this:

ID --- Pet --- Gardening --- Food
----------------------------------------
984 1 0 1
======================

So if they have a 1 in any of the topics then you will retreive the rows from the specified tables.

This is the most ligical way to my knowledge.

darkagn commented: Helpful comments +5
Josh Connerty 20 Unverified User

Okay well I first need to ask how dedicated you are to this?

This is a complex proccess!

Basicly to start with you will need to compare the two database systems. In order for them to work together they need to use just the one.

Another issue is they probably require two seperate cookies. So you will also need to edit the source in order to use just one cookie.

Josh Connerty 20 Unverified User

Another point, with MySql the advice given is you use as many tables as possible as to releive the stress on any one particular table.

Josh Connerty 20 Unverified User

Before you start, be aware that you may be 'bloating' your app without need. The basis for a good app/site is solid data structure. I don't think you've got it yet. If your data structures are all to hell, a javascript framework won't help.

I'd suggest redesigning a streamlined version of your tables - make them relational (as I suggested earlier). If you need to add ajax later on, fine, your database will be set up to deal with it. Ajax ain't a magic bullet.

Good luck again!

PS. @ Josh - sorry mate, didn't mean to diss your suggestion.

No youre right in what you are saying, however I think what he is wanting is something that will perform these things without page refresh.

Okay, please export your database using phpmyadmin and then post it here so as I know exactly what you database structure is liek and as ardav said try and make it more efficient.

Josh Connerty 20 Unverified User

Yes clearing the CMOS sounds like the next step. Other than that you may have to find someone else with a 1GB stick of DDR and see if theirs works any better, by this I mean one that doesn't need to clock down.

But clearing the CMOS should make your BIOS administer new RAM. In a sense it has to POST from scratch all of your hardware to the BIOS so clearing it will make sure it scans for installed hardware again.

As said before it is major simple, there should be a 3/4 inch round battery either upright or flat, remove all of the power to the motherboard and remove this battery.

I leave it for 2 minutes just to be sure. Then fit your RAM, there shouldn't be a primary and secondary like the hard drives and ATA devices, then pop the battery back in.

After this boot your system and go into the BIOS and make sure your boot devices are in the correct order and correct the time and date. Then save the settings and reboot the system.

You should leave it to boot into the OS and login etc. and if all is fine then this has worked. ;)

(This is just incase you don't know how to clear your CMOS)

If this doesn't work however then I am lost. I haven't seen this happen too often but sometimes it requires you to format your hard drive but …

Josh Connerty 20 Unverified User

This might sound daft but why not loop it until you have sent the mail to everyone?

This might cause a strain on the server CPU though.

Josh Connerty 20 Unverified User

Oh thats because you need to declare the ones in the form as $_POST etc as you are only declaring them if the form has been submitted try this:

<?php

if ( isset( $_POST['send'] ) ) {
  // The author's details have been updated.

  
  $title = $_POST['Title'];
  $subtitle = $_POST['Subtitle'];
  $content = $_POST['Content'];
  $author = $_POST['Author'];
  $date = $_POST['Date'];
  $id = $_POST['id'];

  $sql = "UPDATE `indexinfo` SET
          `Title` = '$title',
          `Subtitle` = '$subtitle',
	    `Content` = '$content',
	    `Author` = '$author',
          `Date` = '$date'
          WHERE `id` = '$id'";
  if (mysql_query($sql)) {
    echo '<p>Author details updated.</p>';
  } else {
    echo '<p>Error updating author details: ' .
        mysql_error() . '</p>';
  }

?>


<form action="#" method="post">
<p>Edit the author:</p>
<label>Title: <input type="text" name="Title" value="<?php echo $title; ?>" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" value="<?php echo $subtitle; ?>" /></label><br />
<label>Content: <input type="text" name="Content" value="<?php echo $content; ?>" /></label><br />
<label>Author: <input type="text" name="Author" value="<?php echo $author; ?>" /></label><br />
<label>Date: <input type="text" name="Date" value="<?php echo $date; ?>" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="Submit" name="send" /></p>
</form>
<?php
} else {
?>
<form action="#" method="post">
<p>Edit the author:</p>
<label>Title: <input type="text" name="Title" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" /></label><br />
<label>Content: <input type="text" name="Content" /></label><br />
<label>Author: <input type="text" name="Author" /></label><br />
<label>Date: <input type="text" name="Date" /></label><br />
<input type="hidden" name="id" />
<input type="submit" value="Submit" name="send" /></p>
</form>

The only problem is you need to specify the ID somehow. Without using PHP.

Josh Connerty 20 Unverified User

It sounds more like a dodgey stick of RAM, I know AMD motherboards can have the funnies but it is unlikely. I have had an eMachines Intel Celeron M system and that had a 512MB RAM that I upgraded to 1.2GB RAM with mis matching frequencies and the newer higher frequency 1GB module clocked down as it should do.

So yes run memtest and confirm what they are clocking at so as to dismiss the dodgey underclocking.

Josh Connerty 20 Unverified User

Oh and try to avoid using the @ suppresants until you have the script working and perfect else you may be missing some important errors.

Josh Connerty 20 Unverified User

Try this as yours is riddled with errors:

<?php

if ( isset( $_POST['send'] ) ) {
  // The author's details have been updated.

  
  $title = $_POST['Title'];
  $subtitle = $_POST['Subtitle'];
  $content = $_POST['Content'];
  $author = $_POST['Author'];
  $date = $_POST['Date'];
  $id = $_POST['id'];

  $sql = "UPDATE `indexinfo` SET
          `Title` = '$title',
          `Subtitle` = '$subtitle',
	    `Content` = '$content',
	    `Author` = '$author',
          `Date` = '$date'
          WHERE `id` = '$id'";
  if (mysql_query($sql)) {
    echo '<p>Author details updated.</p>';
  } else {
    echo '<p>Error updating author details: ' .
        mysql_error() . '</p>';
  }

}

?>


<form action="#" method="post">
<p>Edit the author:</p>
<label>Title: <input type="text" name="Title" value="<?php echo $title; ?>" /></label><br />
<label>Subtitle: <input type="text" name="Subtitle" value="<?php echo $subtitle; ?>" /></label><br />
<label>Content: <input type="text" name="Content" value="<?php echo $content; ?>" /></label><br />
<label>Author: <input type="text" name="Author" value="<?php echo $author; ?>" /></label><br />
<label>Date: <input type="text" name="Date" value="<?php echo $date; ?>" /></label><br />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="submit" value="Submit" name="send" /></p>
</form>

Try this it might work allot better.

A list of problems you had or may have had (methods that may cause problems):
- Capitals at the start of a variable $Title - SQL Statement was messy. All fields or table names should be contained with ` (key to the left of 1 but not the numpad numbers the top row)
- PHP_SELF as stated before isn't advised. Your better of using #.
- The use of if( STATEMENT ): isn't advised for newbies. Stick to the standard if( …

Josh Connerty 20 Unverified User

Selects and Radios should be fine as long as you give them the value in witch you wich to be in the database.

<input type="radio" name="you_field" value="Male" />

If you were to insert the POSTed data from my little form you would insert "Male" into the database, whereas you are using 1, 2, 3 & 4 for your values.

Please make sure that you also mysql_real_escape_string( $_POST['field_name'] ) as this will make sure MySql will not refuse any data given.

Josh Connerty 20 Unverified User

Okay then in that case you will need to use AJAX, are you aware of this?

You will need to add a javascript event to your "term" text box.

<input type="text" name="term" onkeyup="javascript: returnTerms( $("#select").val() );" />

Now every time you enter a key into this text box we will make javascript contact your PHP document to retreive the relevent information.

Now if you are happy to do a little learning then I will continue on your say. I will be using jQuery as I program JavaScript with the jQuery library.

jQuery: http://jquery.com/

So if you are happy to use this method then I will continue.

Josh Connerty 20 Unverified User

I do have the $_POST['term'] in the file so I am assuming that I have a syntax error somewhere.

I started the project this way because I thought this would be the elementary way to begin learning and do have plans to improve it to a relational database as I move along. This is my dads website and while the scroll bars are functional It seemed to be the ideal real world situation to learn from. Perhaps I am taking the wrong approach to learn PHP.

I appreciate your comments because it seems to make more sense to me as I further investigate the manual and other resources.

Thank you.

If it a parse error it would state so. If it doesn't either say Fatal Error: or Parse Error: .......... On Line: ... In *Document Name* or something similar.

If neither of these ar returned then it is more likely a fault in the logic as to why it is not working.

What exactly is it that is not working?

Josh Connerty 20 Unverified User

I suppose you could yes, you would need to play a little with the configuration. When I say a little I mean you would have to literally rewrite allot of how wordpress work.

Also I have had my shared hosting accout hacked via a loop hole in WordPress, so I wouldn't advise you to use WordPress at all.

Josh Connerty 20 Unverified User

I don't agree. As long as you use correct cyntax (ie. `desc`) and as long as you know what `desc` means it isn't a problem. I use desc myself.

Josh Connerty 20 Unverified User

You need to look into the jQuery.ajax function, this will send/receive information from a PHP document.

What you need to do is set up a PHP document that will handle the the form as though it were being posted to by http, or by setting the action on the <form> tag.

You then need to make a function similar to this:

var name = $("input[name=name]").val();
var email = $("input[name=email]").val();
jQuery.ajax({
type: "POST",
url: "document handle/ php document",
timeout: 4000,
beforeSend: function() {
$("#loadingScreen").html('<img src="link to loading image, optional" alt="" />');
},
data: "name="+name+"&email="+email,
error: function() {
alert("We are experiencing some issues at the moment. \r\n Please try again soon.");
},
success: function( success ) {
$("#results").html( success );
}
});

The beforeSend is optional, if you don't want a loading image or text then you can remove the three lines relating to the attribute.

The others are quite self explanitary, for data though you must have the first name of the value inside the $_POST[' but when adding a second you must have the + infornt of the name.

This is virtual submiting certain values without page refresh and mutch input from the user.

By the way you are going in the right direction with jQuery, it is a brilliant framework. I use it with majority of JavaScript work. Someone asked recently where a good place to learn jQuery was. Well themeforest (http://themeforest.net) have a beginners series on their blog. Try googling theme …

Josh Connerty 20 Unverified User
number_format( $string , 2 , "Decimals" , "Thousands" );
function fomat_brazil ( $case ) {
// Presuming the brazilian use "," as the equvilant of "." or the reverse
echo number_format( $case , 2 , "," , "." );
}

function format_english( $case ) {
echo number_format( $case , 2 , "." , "," );
}

Hope this helps ;)

Josh Connerty 20 Unverified User
<?php

mysql_connect("localhost","root","");

mysql_select_db("student") or die("Unable to select database"); 
?>

<form name="form" action="result.php" method="get">

Subject   <input type="text" name="q" />
Topic <input type="text" name="r" />
Ability <input type="text" name="s" />

  <input type="submit" name="Submit" value="Search" />
</form>

<?php
  // Get the search variable from URL
 $q = $_GET['q'] ;

  $r = $_GET['r'] ;

  $s = $_GET['s'] ;

// Build SQL Query  
 $myquery = "select * from lesson where subject like '%".$q."%'  AND learningArea like '%".$r."%'  AND  ability like '%".$s."%'";
//echo $myquery ;
 $result = mysql_query ($myquery); 


 echo "<table>"  ;
echo "<tr><th>Lesson ID</th>";
echo "<th>Subject</th>";
echo "<th>Learning Area</th>";
echo "<th>No of Students</th>";
echo "<th>Time Period</th>";
echo "<th>Class</th>";
echo "<th>Ability</th></tr>";

while ($row= mysql_fetch_array($result)) 
 {
$lessonID = $row["lessonID"];  
  $subject = $row["subject"];
  $learningArea= $row["learningArea"];
    $noofstudent= $row["noofstudents"];
    $minutes= $row["minutes"];
    $class= $row["class"];
    $ability= $row["ability"];

//display the row
   
echo <<<EOD
<tr>
<td><a href="details.php?lessonID=$lessonID"> </a></td>
<td>$subject</td> 
<td>$learningArea</td> 
<td>$noofstudents</td> 
<td>$minutes</td>  
<td>$class</td>  
<td> $ability</td>  
</tr>
EOD;
}
echo "</table>";
  
?>
Josh Connerty 20 Unverified User

Sorry, so are the DIV's fetched from the database? Presuming it is MySql then you can add ORDER BY column ASC/DESC Column being the column name to identify the divs and DESC meaning descending and ASC meansin ascending.

Josh Connerty 20 Unverified User

Hmmmm, is this changing often. You mentioned using JavaScript to change them. Will JavaScript be changing them often?

If so then you might aswell get JavaScript to order them. Theres little point in PHP organizing them for JavaScript to come and cock them up.

Josh Connerty 20 Unverified User

Well good thats easier for you then.

You need to look into PHP scandir() and PHP explode() then take a look at the mysql_() functions.

This will basicly tell you what you need to know.

Josh Connerty 20 Unverified User

is the DB on local host or a remote machine?

Josh Connerty 20 Unverified User

Does pdf and txt have to be as a string or jumbled up chars?

Josh Connerty 20 Unverified User

Basicly you use the page.php with file_get_contents() to retreive the remote page.

This will only happen once your page has loaded and when javascript uses AJAX to take whatever the page.php returns.

If you don't know much javascript and ajax then http://jquery.com/ will simplify the process a little.

I use jquery as it also saves allot of javascript coding.

Josh Connerty 20 Unverified User

Note that you cannot use AJAX to fetch content from a domain other than the one the script runs on. The browser will not let you execute cross-domain AJAX requests.

Yarp thats why you must make the page.php to retrieve it for you.

Josh Connerty 20 Unverified User

Yep make another file called page.php then use JavaScript and AJAX to retrieve it once your document is ready.

In this page.php you use file_get_contents() to retrieve the files contents.

Josh Connerty 20 Unverified User

I suppose so, I don't feel to happy taking FTP details as I only take those kind of details for a project or paid services. This way the user (i.e you) has some kind of security.

I think I might be able to email me at: josh [at] jjcon.co.uk

Can I ask, who exactly originally programmed these scripts? It's a little wierd as there is a mish mash of different PHP versions...

Usually a PHP programmer programs in just one version (usually the one they learned with) I myself am prodominently a PHP 4 & 5 programmer but I can program in PHP 6 aswell.

Josh Connerty 20 Unverified User

Just to clarify, does the cookie holsd the username? if not then the script needs to be changed...

Infact are you using PHP Sessions?

The sooner you tell me these things the sooner I can send you on your way.

Josh Connerty 20 Unverified User
<?php
include("include/session.php");
?>
<html>
<title>bla bla</title>
<body>
 
<table>
<tr><td>
 
 
<?php
/**
* User has already logged in, so display relavent links.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>";
 
 
echo "<h2>Your available downloads</h2>";
//$id = $_COOKIE['logged_in'];
//$query = mysql_query("SELECT * FROM `users` WHERE `id` = '$id'");
 
$user = $_COOKIE['logged_in'];
$query = mysql_query("SELECT * FROM `users` WHERE `username` = '$user'");
 
// This will echo out all the links to the downloads
$count = 1;
while( $row = mysql_fetch_array( $query ) ) {
$file_count = "file".$count;
if( $row[$file_count] == 1 ) {
$file_dets = fetch("SELECT * FROM `files` WHERE `file_id` = '$count'");
echo '<a href="'.$file_dets['file_src'].'" target="_blank">'.$file_dets['file_name'].'</a><br />';
}
$count++;
}
echo '<br/ >';
echo "Welcome <b>$session->username</b>, you are logged in. <br><br>";
echo "[<a href=\"process.php\">Logout</a>]";
}
else{

?>

<h1>Login</h1>

<?php

/**

* User not logged in, display the login form.

* If user has already tried to login, but errors were

* found, display the total number of errors.

* If errors occurred, they will be displayed.

*/

if($form->num_errors > 0){

echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";

}

?>

<form action="process.php" method="POST">

<table align="left" border="0" cellspacing="0" cellpadding="3">

<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>"></td><td><?php echo $form->error("user"); ?></td></tr>

<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<?php echo $form->value("pass"); ?>"></td><td><?php echo $form->error("pass"); ?></td></tr>

<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?>>

<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;

<input type="hidden" name="sublogin" value="1">

<input type="submit" value="Login"></td></tr>

<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>

</table>

</form>

 

 

</td></tr>

</table>


</body>
</html>

Should work now.

Josh Connerty 20 Unverified User

Okay found the problem myself on that one

in

<h2>Your available downloads</h2>

i changed it to

echo "<h2>Your available downloads</h2>"

Now i get

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/bluetek/public_html/dac/main.php on line 24
echo "<h2>Your available downloads</h2>"

you missed the closing ;

echo "<h2>Your available downloads</h2>";
Josh Connerty 20 Unverified User

lol easy mistake to make.

Can you mark this as solved please?

Thanks,
Josh Connerty

Josh Connerty 20 Unverified User

I may be able to do it for you...

It'd be easier if you have the users id or username in the cookie?

You will need to add another table!

Execute this for the table

CREATE TABLE IF NOT EXISTS `files` (
  `file_id` int(2) NOT NULL,
  `file_name` varchar(200) NOT NULL,
  `file_src` varchar(200) NOT NULL,
  PRIMARY KEY (`file_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

And this for the values. Change the 'File (?) name' for the name of the file and change the 'File (?) HTTP source' for the address of the file eg. http://mydomain.com/filename.zip.
** (?) being the file number!!! **

INSERT INTO `files` (`file_id`, `file_name`, `file_src`) VALUES
(2, 'File 2 name', 'File 2 HTTP source'),
(1, 'File 1 name', 'File 1 HTTP source'),
(3, 'File 3 name', 'File 3 HTTP source'),
(4, 'File 4 name', 'File 4 HTTP source'),
(5, 'File 5 name', 'File 5 HTTP source'),
(6, 'File 6 name', 'File 6 HTTP source'),
(7, 'File 7 name', 'File 7 HTTP source'),
(8, 'File 8 name', 'File 8 HTTP source'),
(9, 'File 9 name', 'File 9 HTTP source'),
(10, 'File 10 name', 'File 10 HTTP source');

Then use this code please note that the commented queries are dependant on wether you store the user id in the cookie or the username in the cookie. If you use neither then you, if you don't mind me saying, fucked. You will have to go back and change the login to add the users username or id …