[QUOTE=PhilEaton;1317049]Yeah I saw that and changed it but in my original code it still didn't work. But it's all good now thanks a lot![/QUOTE]
No problem! Glad it's all fixed! :)

Regarding for your original code, the reason why the IP displayed but you couldn't click the link is because you were missing an = between the href and the first quote. Try this:
[code=HTML]
<a href="<?= $ip ?>"><?= $ip ?></a>
[/code]

Also notice that since you have shorttags enabled I used shortened syntax to print variables. It removes the need for print or echo in short, one-line variable outputs and will be compatible with PHP (with shorttags enabled) until 6.0.0.

So is it solved? If not, can you give us a sample of some of the URL's you try? The URL you gave in the first post should work fine and did work fine when I tried it. If it doesn't, have you set your charset to the appropriate one with the meta charset tag?

[QUOTE=ﻼim;1315151]:D yeah, you're really good at samples- no second thought with that PHP man (former PMC man). Ϋ[/QUOTE]
Never gotten that before, but PHP Man works too. I'll have to make note of that somewhere on the new site! :)

You can use [icode] [/icode] as an empty space in any empty table columns and rows. It's HTML's way of representing a space. In case you haven't noticed, a space along usually doesn't work, and multiple spaces (or a new line) do no appear. [icode] [/icode] is the answer to the multiple space (or single space alone) problem.

Yes it will! Php.net also has [URL="

Tizag has [URL="

ﻼim commented: really good at php. Ϋ +0

[b]EDIT:[/b] To DaniWeb: Please update your posting system so if my token has expired when I post, I don't have to hit the back button and re-type everything.

Alright, take two. The gist of it is that there are two problems. The simpler of the two to fix is the problem regarding the URL. To access the var parameter you should use [icode]$matches[1][/icode] instead.
The second problem involving the style can be fixed in a similar manner as above, but also requires a Regex fix. Here is your revised code:
[code=PHP]
$this->avatar = $post->find('div[class=shell] td');
foreach($this->avatar as $avatar) {
pregmatch('/url("([a-z0-9-.\/]*\/)?([a-z0-9-_\%.]+)")/i', $avatar->style, $matches); // Thanks "FlashCreations"/"PhpMyCoder"!
$this->avatar = $matches[2];
echo $this->avatar . 'Hello world!';
}
[/code]

Hope this fixes everything! :)
-PhpMyCoder

Well you'll need to find a way to get the short code SMS to communicate with your PHP script. I have no idea how to do this. When it comes to the PHP, it seems easy enough.
[code=PHP]
switch(strtolower($_GET['command'])) {
case 'pizza':
$r = mysql_query("SELECT * FROM pizza ORDER BY popularity DESC LIMIT 5");
if(mysql_num_rows($r) != 0) {
while($arr = mysql_fetch_array($r)) { echo $arr['name']; }
} else { echo "No pizzas found. Sry!"; }
break;
}
[/code]
This would work assuming you have already connected to your database and your table structure is similar to my little demo. You would also need to have texts to the number routed to your script, assuming the command parameter contains the contents of the text and the stdout is returned to the sender of the text message.

For the first URL, you can retrieve the var parameter by exploding the string returned by parse_url. You can also use a Regex if you want.
[code=PHP]
$param = explode('&', parse_url($url, PHP_URL_QUERY));
if(is_int($param['var'])) {
//$param['var'] for the var parameter
}

//OR

preg_match("/var=([0-9]+)/i", $url, $matches);
//$matches[1][0] for the var parameter
[/code]
[b]EDIT:[/b] As a rule, everything is usually faster than a Regex...Keep that in mind :)

The URL from the CSS command can be found with a simple Regex:
[code=PHP]
pregmatch('/url("([^\/]+\/)*([a-z0-9-\%.]+)")/i', $css, $matches);
//$matches[2][0] contains the file name from the URL
[/code]

If either Regexes need to be refined or you need clarification, just write back!
Cheers,
PhpMyCoder

Assuming that the downloads are routed through a PHP script, it should be simple enough to record user download data. The devil is in the database and how you store this information. Here's my recommendation:
You only need one table to store download information along with hit counts. I recommend three columns for tracking download numbers: A total downloads column, a weekly downloads column, and a monthly downloads column. When a user requests a file download, simply increment all three fields for that file by one.
You stats are simply a MySQL query away:
[code=PHP]
//Get total downloads
mysql_query("SELECT downloads FROM files WHERE id='".$id."'");

//Get weekly downloads
mysql_query("SELECT weeklyDownloads FROM files WHERE id='".$id."'");

//Get monthly downloads
mysql_query("SELECT monthlyDownloads FROM files WHERE id='".$id."'");
[/code]
*Depending on what you name your columns

You will need CRON jobs to run once every Sunday and once at the end of every month. The weekly script should contain something along the lines of:
[code=PHP]
//Set all the files to a 0 weekly download count for the new week
mysql_query("UPDATE files SET weeklyDownloads=0");
[/code]

As you can assume the monthly CRON will look something like this:
[code=PHP]
//Set all the files to a 0 monthly download count for the new month
mysql_query("UPDATE files SET monthlyDownloads=0");
[/code]

**These all assume that you have already connected to MySQL and a DB, and perform the necessary [icode]mysql_fetch_array()[/icode]'s after if the query requires it.

Cheers,
PhpMyCoder

phplover commented: Fantastic post made in helping me :) +1

Actually funny enough, he does have some sort of security in place. The tag <iostream> was removed because of it's containing < and > (which generally signifies an HTML tag). What needs to be done though, is not stripslashes or addslahses. It's mysql_real_escape string():

[code=PHP]
<?php
include("contentdb.php"); //Connect to MySQL
include("data.php"); //Declares Variables
//Perform query
if(mysql_query("INSERT INTO $table (code) VALUES ('".mysql_real_escape_string($code)."')")) echo "<br><br>Your Code was Added to the Quiz.<br><br>";
?>
<a href="editquizlist.php">Return to the Code List</a>
[/code]

To really diagnose the problem, we would need to see the data.php file. Can you post it?

Well then try this. And yes it will still work. You just have to do is change the way the data is added to the class. Check the readme file for more (It should be similar though, what does your demo query return?).

Try this with the [b]old query:[/b]
[code=PHP]
<?php
/***

  • PhpMyCoder Paginator *
  • Created By PhpMyCoder *
  • 2010 PhpMyCoder *
  • ------------------------------- *
  • You may use this code as long *
  • as this notice stays intact and *
  • the proper credit is given to *
  • the author. *
    ***/

class pmcPagination {
private $pageVar = "page"; //$_GET variable to get page # from
private $items = array(); //Array of items to paginate
private $resultsPerPage = 10; //Results to be displayed per page
private $paginated = false; //Has the paginate() function been called?

public function __construct($resultsPerPage="", $pageVar=0, $items=NULL)
{
    //Set pageVar if arg is valid
    if($this->isValidPageVar($pageVar)) $this->pageVar = $pageVar;

    //Set resultsPerPage if arg is valid
    if($this->isValidResultsPerPage($resultsPerPage)) $this->resultsPerPage = $resultsPerPage;

    //Add items passed
    $this->add($items);
}

public function add($items)
{
    //If the item is null, exit function
    if(is_null($items)) return;

    //If arg is not an array, make it one
    if(!is_array($items)) $items = array($items);

    //Cycle through items passed
    foreach($items as $item)
    {
        //Add them to the $items array if they are valid
        if($item instanceof paginationData) $this->items[] = $item; 
    }
}

public function paginate($resultsPerPage="", $pageVar=0, $items=NULL)
{
    //Prevent set function form changing values
    $this->paginated = true;

    //Set pageVar if arg is valid
    if($this->isvalidPageVar($pageVar)) $this->pageVar = $pageVar;
    //Set ...

So does the date work now? If so, that's [b]great[/b]! Regarding the events: Did you check and see if they are in the database? Also, did you check their expiration date (I remember something about the expiration date being filtered in MySQL). To test this, you can perform the query you use to get the programs and attempt to find the missing ones. If they aren't their, the problem is with you query (I can help with this). If they are there, it's a slight bug in my code (Which I can also fix!).

Oh no! Well right about now I don't know what to tell you. I've tried the code on my server, and it works fine. I also just ensured that the date formats you gave me from MySQL formats properly into the UNIX Epoch (which it does). Are you running this site on your own dev server (using XAMPP, WAMP, etc), or do you have it setup on a testing server?

whitestream6 commented: Excellent source of help. Much recommended. +2

Inside a complex syntax brackets ([icode]{$var}[/icode]) you can call any function with a return value that can be converted to casted to a string. So using your code that would be:
[code=PHP]
$message .= "<td>XXXX-XXXX-XXXX-{substr($_GET['cc_number'] , -4, 4)}</td>";

//Or this....
$message .= "<td>XXXX-XXXX-XXXX-".substr($_GET['cc_number'] , -4, 4)."</td>";

//Or even this...
$message .= "<td>XXXX-XXXX-XXXX-";
$message .= substr($_GET['cc_number'] , -4, 4);
$message .= "</td>";
[/code]
The first or second ones make most sense to me, so I would chose one of them, but it's totally up to you!

drewpark88 commented: Helped me alot! +1

Alright, it's all integrated for you [URL="

I have updated the script again to fix the notices (Your setup seems to be very picky about $_GET and $_POST variables!). To achieve what you are looking for, you will need some simple css. With the current code, all you need to do is add this style to the top of your page. The only other thing you will need to do is enclose the navigation inside a div with and id of nav like this:

[code=PHP]
<div id="nav">
<?php
//Show the navigation
$paginator->navigation();
?>
</div>
[/code]

And here's the CSS to include:
[code=CSS]

nav { font: normal 13px/14px Arial, Helvetica, sans-serif; }

nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; }

nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; }

[/code]

The only thing it doesn't do is apply the box (possibly a grayed out one) to the disabled Next and Previous links. If You wish for this to happen, reply back and I'll make the slight changes that are necessary for this to happen.

I just wrote a pagination script (for another DaniWeb User). Let me find the link to it and I'll show you my code...

[b]EDIT:[/b]
Here's the link:
[URL="

Yes, it could be. I would suggest a static color picker (Most users don't know about hex's) or a backend system that checks a color before it is placed in the database. This way you can ensure that a color is always displayed (Because the user could have entered some color followed by a semicolon and some more css. The user could have even inserted javascript with this loose input system. This is a horrible XSS Vulnerability.)

diafol commented: really good point - he needs a 'real colour' dropdown or something +5

Yeah, I was guessing that something like this didn't work. It's a shame too, because multi-language highlighting in a single code block would be pretty cool.

You know I'll try it:
[code=php]
<html>
<head>
<title>CODE Tag Test</title>
</head>
<body>
<?php
//Comment
echo "String!";
mysql_connect("localhost", "user", "pass") or die(mysql_error());
$b = 6;
$a = $b++;
class dummy { private $value; }
include("text.php");
?>
</body>
</html>
[/code]

[b]EDIT:[/b] Well it looks like it doesn't work. Oh well! Thanks anyways.

How about including a PHP file which contains the javascript you wish to be able to access the PHP variables. Then in this included file pass the PHP variables to the script. You can not alter a PHP variable from javascript, but this should suffice. Here's an example:

[b]index.php:[/b]
[code=php]
<?
//Set some vars that JS can access
$something = "Hello Javascript!";
$daniweb = "awesome";
$scriptby = "PhpMyCoder";
?>
<html>
<head>
<title>PHP Vars in JS Example</title>
<?php require_once("js.php"); ?>
</head>
<body onload="phpVars();">
</body>
</html>
[/code]

[b]js.php:[/b]
[code=PHP]
<?php
//Add the javascript vars with the script tag
echo "<script type='text/javascript'>\n" +
"something = " . $something . ";\n" +
"daniweb = " . $daniweb . ";\n" +
"scriptby = " . $scriptby . ";\n" +
"</script>\n";

//Now either attach an external JS file
// echo "<script type='text/javascript' src='external.js'></script>";
//Or add the Javascript to this file
echo "<script type='text/javascript'>\n" +
" function phpVars() { alert(something + ' Daniweb is ' + daniweb + '! Script coded by ' + scriptby + '.') }\n" +
"</script>\n";
?>
[/code]

You need to connect to a database (Such as MySQL) then perform the queries in your arrays (You also need to unescape the quotes after the "tfr", it will stop the query from working).
Try something like this:
[CODE]
<?php
//Why do all three of these have the same name
//Is it your intention to reset them three times?
$qualifiers_array[0] = "SELECT FROM table WHERE trk is not null AND WHERE tfr = '1'";
$qualifiers_array[1] = "SELECT
FROM table WHERE tfr='2'";
$qualifiers_array[2] = "SELECT * FROM table WHERE tfr='3'";
?>
[/CODE]

[CODE=PHP]
<html>
<head>
<title>Database Results</title>
</head>
<body>
<?php
include($_SERVER['DOCUMENT_ROOT'].'////.php');
mysql_connect("localhost", "INSERT USER HERE", "INSERT PASS HERE");

$result = mysql_query("NAMES QUERY");
if($result)
{
$i = 0;
while($arr = mysql_fetch_array($result))
{
//Transfer values from table to result array
//Ex. $values[0][$i] = $arr['column_name'];
$i++;
}
}

//Repeat for other queries

?>
<table border='1'>
<tr>
<th>Filter Name</th>
<th>Profit</th>
<th>Winners</th>
<th>Qualifiers</th>
<th>%age</th>
</tr>
<?php
for($i=0;$i<count($values[0]);$i++)
{
echo "<tr>\n"
echo " <td width='20%'>". $result[0][$i] . "</td>\n";
echo " <td width='20%'>". $result[1][$i] . "</td>\n";
echo " <td width='20%'> </td>\n";
echo " <td width='20%'>". $result[2][$i] . "</td>\n";
echo " <td width='20%'> </td>\n";
echo "</tr>\n\n";
?>
</table>
</body>
</html>
[/CODE]

But there are problems beyond that. Why not PM me and we can get this sorted out. I can help you fix-up, clean-up, and optimize your code!

Borderline commented: Thank you! +2

You can check for a search by the employee's name. Then you can check for a space. If there is a space you can split the two names with explode and then perform a query that matches first and last name. If there isn't any spaces only perform a query for the first or last name (Depending on what you want).
[CODE=php]
<?php
if(isset($_POST['searchType'])) //Check first, get values later
{
$method=$_POST['searchType'];
$search=$_POST['query'];

switch ($method)
{
    case 'EmployeeFName': //Switch is not like if...you don't need an expression, just a value will do
        if(empty($_POST['query'])) exit("Please Fill in a name of an employee you want to search. Click <a href=search.php>here</a> to go back.</p>");
        else
        {
            echo"<i>Your search for {$search} had the following results:</i>";
            //Here's the magical splitting of the names
            $arr = explode(" ", $search);
            $search_first = $arr[0];
            $search_last = $arr[1];

            $query = mysql_query("SELECT * FROM Employee WHERE EmpFName = '".$search_first."' AND EmpLName = '".$search_last."'");
            $result = mysql_query($query);
            if(mysql_num_rows($result)==0) echo exit("<font color='red'>No Record Found</font>");
            echo"<table class='full'>";
            echo"<th></th><th>ID</th><th>Employee Name</th><th>Title</th><th>Team</th><th>Department</th></tr>";
            while ($row = mysql_fetch_array($result)) //Ohh! You can only fetch from a result RETURNED by mysql_query, not the actual query
            { 
                //No need to setup individual variables...just use the $row array!
                echo"<tr><td class='view'><form action='employee.html' method='post'><div><input type='submit' value='View' class='button' /></div></td><td name='userID' class='id'>".$row["EmployeeID"]."</td></form><td name='userName' class='record'>".$row["EmployeeFName"];." ".$row["EmployeeLName"]."  </td><td name='userTitle' class='record'>".$row["EmployeeTitle"]."</td><td name='userTeam' class='record'>".$row["EmployeeTeam"]."</td><td name='userDept' class='record'>".$row["EmployeeDepart"]."</td></tr>";
            }
        }      
        break;
    //And on, and on, etc.
}

}

function mysqlConnectAndSelect()
{
checkLogin();
sqlConnect();
mysql_select_db("titans", $con);
}
?>
[/CODE]
There are also lots more problems beyond this one. I'd be glad to fix them ...

[QUOTE=pritaeas;965973]My suggestion stated before the query...

[code=php]
$link = array ();
$result = mysql_query($sql):
while ($row = mysql_fetch_array($res))
{
$link[]=$row;
}
[/code][/QUOTE]
Exactly..though it does need one minor fix! (But I'm sure you knew this!):
[code=PHP]
$link = array();
$result = mysql_query($sql); //<-- Semicolon
while ($row = mysql_fetch_array($res))
{
$link[] = $row;
}
[/code]
Also, I believe the problem was that instead of [icode]$links[/icode], [icode]%links[/icode] as used, but your solution provides a safety if there are no rows returned (Which is a good thing to have!).

@Dukane
You made the same error as Newbi..the correct code is below (Don't worry about it, I've made worse mistakes :D):
[code=PHP]
while($info = mysql_fetch_array($result))
[/code]
The reason for this is as Dukane explained...When you perform a query the query string is executed with the [icode]mysql_query()[/icode] function. This function returns a special MySQL Result that you can then pass to [icode]mysql_fetch_array()[/icode] or any other MySQL Result functions.

Dukane commented: OOOPS! I meant to type out what you typed out, but thank you for pointing out my mistake! Good catch! +3

That's great that you got it to work! If you don't have any more questions...would you please mark this thread as solved?

woocha commented: thanks for the help !! +3

You would probably want to use a MySQL table to store the emails. Then all you would have to do is write a php script that you can use to send email (Just make sure to password protect it for security!!).
PHPList is a pre-coded, easily customizable PHP mailing list application. Check it out on [URL="

Epic Tissue commented: helpful and informative +1

Ok then, try this:
[code=PHP]<?php
session_start();

if(session_is_registered('user'))
{
$user=$_SESSION['user'];
$del="DELETE FROM online WHERE user='$user'";
$result=mysql_query($del);

 if($result==true)
 {
      echo "<h3>Member Offline</h3>\n";
 }
 else
 {
     echo "<h3>Failed to Logoff</h3>\n";
 }

 //Remove the Session Vars
 $_SESSION = array();
 if (isset($_COOKIE[session_name()])) {
      setcookie(session_name(), '', time()-42000, '/');
 }
 session_destroy();

 //include"index.php";

}
else
{
include "index.php";
}
?>
[/code]

Shanti C commented: Good Helping.... +2