Jump to content

182x

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Everything posted by 182x

  1. I have just tried that and I still have the same problem.
  2. Hey guys, Sorry for another newbie question but I have used the following code for a logout page but when I click the logout button the session variables are still on scope. I was just wondering what I did wrong? <?php session_start(); session_destroy(); header("location:index.php") ?>
  3. Hey guys, I was just wondering in how do I exit an html frameset as I have a link which has to redirect back to the index page as shown below, which should not have the frames. Any help would be great thanks. header("location:index.php");
  4. 182x

    header error

    Ah yes I see that makes a lot more sense. I left the echo in by mistake instead of storing it as a variable and it still displayed properly that was confusing me. I still am not sure why it was displaying properly when it wasn't stored in variables with the html formatting. Thanks again.
  5. 182x

    header error

    Thanks for the alternate option. How does the php output keep the html formatting when it is called before the html? Is it to do with how it is parsed by the browser?
  6. 182x

    header error

    Thats awesome thanks for all the help guys. I didn't realise that if the php code was put before the html tags that it would still keep the html formatting. Is that also a hack or is that just normal practice? Thanks again.
  7. 182x

    header error

    Yeah I did although still I can't figure out how to make it work and keep the HTML.
  8. Hey guys, I get the following error message when using the code below: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\a\processLogin.php:10) in C:\xampp\htdocs\a\processLogin.php on line 48 I was just wondering how to fix it? Thanks. line 48: case 1: header("location:admin.html"); break; <?php session_start(); include ('db.php'); $li = db(''); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Login</title> <style type="text/css"> <!-- .style1 { font-size: 29px; font-family:Helvetica, sans-serif; } --> </style> </head> <body bgcolor="#CCCCCC"> <?php $u = $_POST['u']; $p = $_POST['p']; $s = "SELECT * FROM `u` WHERE `u` ='$u'"; $r = mysql_query($s,li) or die(mysql_error()); if(mysql_num_rows($r) > 0) { $s2 = "SELECT * FROM `u` WHERE `u` ='$u' AND `p` ='$p'"; $r2 = mysql_query($s2,li) or die(mysql_error()); if(mysql_num_rows($r2) > 0){ $r = mysql_fetch_assoc($r2); $l = $r[al]; switch($l) { case 1: header("location:test.html"); break; case 2: header("location:test1.html"); break; exit(); } } else { echo '<p align="center"><span class="style1">incorrect.</span></p>'; echo '<p align="center"><a href="index.php" class="style1">Back</a></p>'; } } else { echo '<p align="center"><span class="style1">error.</span></p>'; echo '<p align="center"><a href="index.php" class="style1">Back</a></p>'; } ?> </body> </html>
  9. Thanks for the quick reply.
  10. Hey guys, I was wondering how do you put a google search bar on a PHP page? I have looked everywhere for code to do this but can't find any. Thanks.
  11. Hey guys I have created a simple frame and in the menu part of the frame I have the following code within the body tags, however the image will not be displayed in firefox when the refresh button is pressed. I was just wondering how to fix this? Thanks. <img src="images/Logo.gif" border="4" alt="logo"> <br><br> <a href="test.htm" target="main" class="style1">test</a>
  12. That looks like a very clever way of doing it. Thanks for your help
  13. Hey guys, I am trying to write a login script which can manage 4 different types of user so for example if one of the admin users logs in they will be taken to the admin section or another user will be taken to their section with their proper privileges. I have never done anything like this before and was just wondering what would be the best way to do this, or are there any scripts that can help with this? Thanks for any advice.
  14. Thanks so much, can't believe it was something to simple!
  15. Hey guys, I was trying to get the jpgraph software to work but when I use the following code I get an error that suggests there is a problem with the database, I was just wondering how to fix it? thanks. error message: Parse error: syntax error, unexpected T_EXIT in C:\xampp\htdocs\graphTest\test.php on line 9 Code used: <?php include ("c:/jpgraph/src/jpgraph.php"); include ("c:/jpgraph/src/jpgraph_bar.php"); $db = mysql_connect("localhost", "root","") or die(mysql_error()); mysql_select_db("student",$db) or die(mysql_error()); $sql = mysql_query("SELECT * FROM students") die(mysql_error()); while($row = mysql_fetch_array($sql)) { $data[] = $row[1]; $leg[] = $row[0]; } $graph = new Graph(250,150,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); $graph->SetShadow(); $graph->xaxis->SetTickLabels($leg); $bplot = new BarPlot($data); $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->Stroke(); ?>
  16. Hey guys, I am using Xampp to develop my PHP scripts and was just wondering if there is a simple way to add charts in PHP using xampp? Thanks.
  17. Thanks again Am I best having output buffering enabled in the php.ini file? and is it also good practice to put the following code at the top of all the pages to avoid problems? <?php session_start(); ?>
  18. Ahh I see. Thanks so much for your help! The previous version of PHP I was using was PHP4 and Xampp uses PHP5 does the session_start() rule not apply for PHP4?
  19. Hi, I can't seem to find the problem, can you see it in the code? Sorry about the tabs they messed up when i copied the code. <html> <head> <title>pu</title> <style type="text/css"> <!-- .style1{font-family: Arial, Helvetica, sans-serif} --> </style> </head> <body bgcolor="#CCCCCC"> <p align="center" style="style1"> <?php session_start(); include('db.php'); $link_id = db_(''); $fl = "uw/"; $fl = $fl.$HTTP_POST_FILES['gf']['na']; $mn= $HTTP_POST_VARS['mn']; $pa = $fl; $an = $HTTP_POST_VARS['an']; $at = $HTTP_POST_VARS['at']; if(move_uploaded_file($HTTP_POST_FILES['gf']['tn'], $fl)) { $gu = "SELECT ui FROM up WHERE pa = '$fl'"; $re = mysql_query($gu, $link_id); if(mysql_num_rows($re) > 0 ) { ?> <p align="center" class="style1"> <?php echo "already exists"; ?> </p> <p align="center" class="style1"><a href="uw.php" class="style6">Back </a></span></p> <p align="center" class="style1"><a href="lo.php" class="style6">Logout</a></span></p> <?php exit(); } $iu="INSERT INTO upload VALUES('','$mn','$pa', '$an', '$at')"; mysql_query($iu, $link_id); ?> <p align="center" class="style1"> <?php echo "The selected file ".$HTTP_POST_FILES['gf']['na']. "";?> </p> <?php } else { ?> <p align="center" class="style1"> <?php echo "the file does not exist.";?> </p> <p align="center" class="style1"><a href="uw.php" class="style1">Back </a></span></p> <p align="center" class="style1"><a href="lo.php" class="style1">Logout</a></span></p> <?php exit(); } ?> </p> <p align="center" class="style1">Please click the following:</p> <p align="center" class="style1"><a href="ah.php">Home</a></p> <p align="center" class="style1"><a href="lo.php">Logout</a></p> </body> </html>
  20. Hey guys, I installed Xampp yesterday and I am still getting the following error message with the PHP code which I did not have before I installed xampp so i was just wondering why i am getting this error now? I also have the session_start at the top of the code. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\test\processUpload.php:4) Thanks
  21. Hi thanks for your reply, is using ob_start and ob_end_flush a standward way of doing things? and if not what is the best way? Thanks again and sorry for all the noobie questions.
  22. Thanks for the replaies guys. I downloaded Xampp to give it a try and so far it work great until a tested a script that involved uploading a file where i get the following error message... Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\test\processUpload.php:4) anyidea what it means or how to fix it? Thanks
  23. Hey guys, I am trying to setup PHP, mysql, phpmyadmin and apache for a project I am working on however I am having a really difficult time getting these to work properly in Vista. I was just wondering would you recommend I use a package such as WAMP or XAMPP or is it best trying to get all these to work on their own? Thanks.
  24. Thanks for the reply am I correct in saying that both are used to achieve the same result?
  25. Hey guys, I am about to start a project using PHP and after doing some research I have discovered that the same variable types can be implemented in different ways for example by using two different formats such as $HTTP_SESSION_VARS and $_SESSION. So I was just wondering which format of declaring the variables is correct? And is there any major differences between the two methods? Thanks for any help.
×
×
  • 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.