NameSilo

Making CMS

Spaceship Spaceship
Watch

cleanvar()

Account Closed
Impact
0
Hi all,

Im making a cms and keep getting window.location='viewpost.php?pid=".$pid."'</script>"; with: but i dont know why.
PHP:
      <?

       

/*###########################################*\
| THIS CODE IS PART OF RACKING CMS. NO PART   |
| MAY BE COPIED WITHOUT THE AUTHORS           |
| PERMISSION || http://www.stevengibbons.com  |
| FILE: lockpost.php    Created: 22/02/06     |
 \*###########################################*/

       

      /* INCLUDE SOME FILES */

       

      include('inc/connect.php');

      include('inc/class_core.php');

      include('inc/header.php');

       

      $username = $_SESSION['username'];

      $pid = $_GET['pid'];

       
       
 
      /* NOW FOR LOCK */

       

      $query1 = "SELECT * FROM users WHERE username = '$username' AND user_level = '2'";

      $result1 = mysql_query($query1) or die (mysql_error());

      $nr = mysql_num_rows($result1);

       

      /* NOW WE SEE */

       

      if ($nr != 1)

      {

      include('disallowed.php');

      die();

      }

       

       

      $query2 = "UPDATE posts SET status = '1' WHERE id = '$pid'";

      $result2 = mysql_query($query2);

      echo "<script type='text/javascript'>window.location='viewpost.php?pid=".$pid."'</script>";

      ?>
Thanks,
Will
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
why dont you just use header('Location:viewpost.php?pid=$pid');
 
0
•••
have tried that still doesnt work:

PHP:
      <?

       

/*###########################################*\
| THIS CODE IS PART OF RACKING CMS. NO PART   |
| MAY BE COPIED WITHOUT THE AUTHORS           |
| PERMISSION || http://www.stevengibbons.com  |
| FILE: lockpost.php    Created: 22/02/06     |
 \*###########################################*/

       

      /* INCLUDE SOME FILES */

       

      include('inc/connect.php');

      include('inc/class_core.php');

      include('inc/header.php');

       

      $username = $_SESSION['username'];

      $pid = $_GET['pid'];

       
       
 
      /* NOW FOR LOCK */

       

      $query1 = "SELECT * FROM users WHERE username = '$username' AND user_level = '2'";

      $result1 = mysql_query($query1) or die (mysql_error());

      $nr = mysql_num_rows($result1);

       

      /* NOW WE SEE */

       

      if ($nr != 1)

      {

      include('disallowed.php');

      die();

      }

       

       

      $query2 = "UPDATE posts SET status = '1' WHERE id = $pid";

      $result2 = mysql_query($query2);

      header('Location:viewpost.php?pid=$pid');

      ?>


Thanks for any help.

Steven
 
0
•••
PHP:
  <?

       

/*###########################################*\
| THIS CODE IS PART OF RACKING CMS. NO PART   |
| MAY BE COPIED WITHOUT THE AUTHORS           |
| PERMISSION || [url]http://www.stevengibbons.com[/url]  |
| FILE: lockpost.php    Created: 22/02/06     |
 \*###########################################*/

       

      /* INCLUDE SOME FILES */

       

      include('inc/connect.php');

      include('inc/class_core.php');

      include('inc/header.php');

       

      $username = $_SESSION['username'];

      $pid = $_GET['pid'];

       
       
 
      /* NOW FOR LOCK */

       

      $query1 = "SELECT * FROM users WHERE username = '$username' AND user_level = '2'";

      $result1 = mysql_query($query1) or die (mysql_error());

      $nr = mysql_num_rows($result1);

       

      /* NOW WE SEE */

       

      if ($nr != 1)

      {

      include('disallowed.php');

      die();

      }

       

       

      $query2 = "UPDATE posts SET status = '1' WHERE id = '$pid'";

      $result2 = mysql_query($query2);

      echo "<script type='text/javascript'>window.location='viewpost.php?pid='".$pid."'</script>";

      ?>

See if that works..

Also, when you used header('Location:viewpost.php?pid=$pid'); , how did it not work? Did it give an error? Did it just do nothing?
 
Last edited:
0
•••
Thanks for the code but it didnt work. I get window.location='viewpost.php?pid='".$pid."'"; ?>

there must be something wrong.
Will
 
0
•••
Goodbye webmonkey.
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back