Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8756325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:03:17+00:00 2026-06-13T14:03:17+00:00

I am getting seriously frustrated that I can’t get this to work. I’ve tried

  • 0

I am getting seriously frustrated that I can’t get this to work. I’ve tried a few different approaches to this, and from all the examples and code I’ve read this SHOULD be working, but it isn’t.

2012-10-19 19:24:04.533 192.168.1.62 "-" "WEBMATRIX" "-" 192.168.1.62 POST /Actions/NewTicket.php - 500 0 6149 688 45 -11640 "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4" "QCUserID=1" "http://192.168.1.62:53896/NewTicketPage.html" "-" "192.168.1.62:53896" 0

WebMatrix/Actions/login.php <- This works. I can see it in my cookies in Chrome. and it looks like it is in the log error.

<?php 
//set vars
require_once(__DIR__ . "/GlobalCookies.php");

GC_ClearCookie("QCUserID");
$user = $_POST['username'];
$pass = $_POST['password'];

require_once(__DIR__ . "/db.php");

$query = sprintf("SELECT * FROM users WHERE UserInitials='%s' AND UserPassword='%s'", mysql_real_escape_string($user),mysql_real_escape_string($pass));
$result = mysql_query($query);
$rows = mysql_num_rows($result);

if($rows!=0)
{
    $row = mysql_fetch_row($result);
    GC_SetCookie("QCUserID", $row[0]);
    header("refresh:0;url=../DashboardPage.php");
}
else
{
    echo("User Not Found, redirecting to login page in 3 seconds");
    header("refresh:3;url=../index.php");
}

?>

WebMatrix/Actions/GlobalCookies.php <- strange that it doesn’t get the ?> at the end of the file.. I didn’t look up how to do a functions file, I just copied some of it from Mantisbt. but it throws a error 500 if i have it and try to use it in login.php

<?php
function GC_GetCookie( $p_var_name, $p_default = null )
{
    if( isset( $_COOKIE[$p_var_name] ) )
    {
        $t_result = gpc_strip_slashes( $_COOKIE[$p_var_name] );
    }
    else if( func_num_args() > 1 )
    {
        //check for a default passed in (allowing null)
        $t_result = $p_default;
    }
    else
    {
        error_parameters( $p_var_name );
        trigger_error( ERROR_GPC_VAR_NOT_FOUND, ERROR );
    }

    return $t_result;
}
function GC_SetCookie($p_name, $p_value, $p_httponly = true)
{
    return setcookie( $p_name, $p_value, 36000, "/");
}
function GC_ClearCookie($p_name)
{
    return setcookie( $p_name, '', -1, "/" );
}

WebMatrix/Actions/NewTicket.php <- this fails

<?php
error_reporting(-1);

require_once(__DIR__ . "/db.php");
require_once(__DIR__ . "/GlobalCookies.php");

$serial = $_POST['serialNumber'];
$model = $_POST['modelNumber'];
$company = $_POST['companyName'];
$special = $_POST['specialNote'];
$userID = GC_GetCookie("QCUserID",1); //Error 500 here
echo($userID."<br>");
?>

This seems like such a simple thing, but I’ve been trying for a few days.. and my searches on Google is turning up nothing. Thank you for your time…. For giggles i tried it in IE on a different computer, and it works…. strange.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:03:19+00:00Added an answer on June 13, 2026 at 2:03 pm

    For setting your cookie, try changing:

    setcookie( $p_name, $p_value, 36000, "/");
    

    to:

    setcookie( $p_name, $p_value, time() + 36000, "/");
    

    The reason is because the expiration parameter is a Unix timestamp so you have to add the current time to however many seconds you want it to expire in.

    Are you using this cookie solely for the purpose of identifying if a user is logged in? If so, all I would need to do to log in as a different user would be to create a cookie with the appropriate name and pick a random user id if that were the case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
Seriously getting on my nerves. This code was working just fine earlier, I restarted
Right I'm getting a bit tired of this so hopefully you can help me
Getting this out of the way; I don't frequently do much in php or
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
These days I'm getting seriously into functional programming. While I'm really excited about Haskell
Seriously. My hosting company says that there's something wrong with my Php code. I'm
I seriously suck at getting the quotes and quotation marks correctly. is there a
I am getting a static analysis error in this code which doesn't make any
I'm new to this libcurl stuff and struggling trying to get directory content of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.