Jump to content

CodeTech

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

CodeTech's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Finally Figured it out. Thanks anyway. Just wanted to post solution for others.. <?php echo '<html>'; $Page=$_GET["page"]; //the page number requested $AvailablePages=5; //number of pages available after the page requested //---calculations--- $StartPage=round($Page/3)*3-2; if($StartPage<2) { $StartPage=1; } $EndPage=$StartPage+$AvailablePages-1; //the last page number to be displayed in paging //--create the paging bar-- $PagingBar=''; while($StartPage<=$EndPage) { if($Page==$StartPage) { $PagingBar=$PagingBar . $StartPage . ''; } else { $PagingBar=$PagingBar . ' <a href="test.php?page=' . $StartPage . '">' . $StartPage . '</a> '; } $StartPage++; } //---show the paging bar-- echo $PagingBar; echo '</html>'; ?>
  2. Hello, everyone. I am having some trouble figuring this out. I am trying to create a paging bar(so to speak) to display results by page number. Trying to get the paging bar to go as follows... Requested Page The resulting paging bar Page 1 1 2 3 4 5 Page 2 1 2 3 4 5 Page 3 1 2 3 4 5 Page 4 1 2 3 4 5 Page 5 4 5 6 7 8 Page 6 4 5 6 7 8 Page 7 4 5 6 7 8 Page 8 7 8 9 10 11 ...... This is what I have right now that I am trying to get to work. I have changed this so many times and been working on it for 2 days. I think I'm just confusing my self. This can't be that hard.. <?php echo '<html>'; //---these values changed based on query---- $Page=$_GET["page"]; //the page number requested $AvailablePages=5; //number of pages available after the page requested //---calculations--- $StartPage=round($Page/5)*5; $EndPage=ceil($StartPage/5)*5 ; //the last page number to be displayed in paging if($StartPage<5) {$StartPage=1;} //just looking at variables echo 'page is: ' . $Page . '<br>'; echo '<br>Starting @: ' . $StartPage; echo '<br>Ending @: ' . $EndPage . '<br>'; //--create the paging bar-- $PagingBar=''; while($StartPage<=$EndPage) { if($Page==$StartPage) { $PagingBar=$PagingBar . $StartPage . ''; } else { $PagingBar=$PagingBar . ' <a href="test.php?page=' . $StartPage . '">' . $StartPage . '</a> '; } $StartPage++; } //---show the paging bar-- echo $PagingBar; echo '</html>'; ?>
  3. Never Mind I changed something and it works now, just not sure what. LOL
  4. Ok, I put it all in the same file. Still doesn't work. <?php ////////// MySQL Database Information //////////// $dbservertype='mySQL'; $servername='localhost'; $dbusername='**********'; $dbpassword='**********'; $dbname='**********'; ////////// End Database Information //////// //// Other Information /////// function ConnectToDB($servername,$dbname,$dbuser,$dbpassword) { global $dblink; $dblink = mysql_connect ("$servername","$dbuser","$dbpassword")or die("Couldn't connect to the database."); mysql_select_db("$dbname",$dblink) or die ("Could not select Database".mysql_error()); } ConnectToDB($servername,$dbname,$dbusername,$dbpassword); $VisitorIP=$_SERVER['REMOTE_ADDR']; $result = mysql_query("SELECT Hits FROM Visitors WHERE IP = '$VisitorIP'"); $num_rows = mysql_num_rows($result); if($num_rows){ while ($row = mysql_fetch_array($result, MYSQL_NUM)) { $numHits = $row[0]; } mysql_free_result($result); $newHits = $numHits + 1; mysql_query("UPDATE Visitors SET Hits = '$newHits' WHERE IP = '$VisitorIP' AND Hits = '$numHits'"); } else { /*echo "Unable to match IP";*/ mysql_query("INSERT INTO Visitors (IP, Hits, Date, Time) VALUES ('$VisitorIP', '1', CURDATE(), CURTIME())"); $allrows = mysql_query("SELECT * FROM Visitors"); $TotalVisitors = mysql_num_rows($allrows); mysql_free_result($allrows); if ($TotalVisitors == '7') { header("Location: http://www.domain.com/winner.html"); /* Redirect browser */ exit; } } ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <body> Why doesn't this work </body> </html>
  5. I have database stuff in the GiveAway_Control.php and depending of the responses, it either redirects or not. I don't see how that helps. If I load the GiveAway_Control.php by its self which has the redirect in it, it all works fine; I just can't get it to work with the include. Another note: if I just have... <?php header("Location: http://www.domain.com/winner.html"); ?> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> I get the same error. I don't get it. Warning: Cannot modify header information - headers already sent by (output started at /home/domain/public_html/contact.php:1) in /home/domain/public_html/contact.php on line 2
  6. Can someone tell me how to fix this At the top of every page i have this. <?php include('GiveAway_Control.php');?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> in the GiveAway_Control.php there is the header("Location: http://www.domain.com/winner.html"); /* Redirect browser */ The GiveAway_Control.php has NO echo statements what so ever.
  7. I'm trying to figure out how i can update an exiting file that is contained in a Self-extracting executable using php on a hosted webserver with Cent OS. <?php rar a -sfx7z.sfx test.exe helpdesk.txt; echo "Success"; ?> This doesn't seem to work; it displays an error: Parse error: syntax error, unexpected T_STRING in /home/kompute6/public_html/vnc.php on line 2 I tried adding "" and '' and nothing seems to work. any ideas how i can do this? Maybe I'm going about this all wrong. I'm not really sure.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.