PHP - Check Cookie After A Callback
Hello there
I was wondering if anyone could help me with this problem See I running a site where people can log in, and everytime they log in, a cookie is set, based on their username. so when a user complete a offer, my website send a link to a Network. (example: www.Network.com/offer=9384736) When the Network has receive the link with the offer (offer=9384736) , then they will do a postback call to my website. Example my site is www.mywebsite.com/PB.php/offer=9384736 Then my postback script will get the offer and check for the cookie when a postback call is made from the network to my script. So what i want is when someone giving me a postback call, a script will check for the cookie ( the user who have complete a offer) I was just think just to put this in echo $_COOKIE["user"];, but that dident work, because it was the network who called my postback. So have anyone any idea how i can do this? Would really appericate if someone could help me out Thanks! Similar TutorialsHey All, I am looking for a way to setup licensing for a script i built, I am not to worried about the script being modified because I will have different tutorials on modifying things within the script, but I would like to restrict the use of the script to a Per Domain basis. I am looking for some resources or a foot in the right direction to achieve this. Basically, I am looking to setup an authentication code linked to a domain name. The user uploads the script, adds user/pass/authentication code. Are callbacks a way for me to setup a database with this info, and if the code doesn't match the domain it's not usable? perhaps by including an important file or command... thanks in advance for any info. Hi guys, I'm working on a customer appointment system using PHP where the users or admin adds customers to the system and book them an appointment for a specific date and time, and it all works fine. I've now been told the system should have a callback button, so for example, if a user is booking an customers appointment then at point the customer says am not interested at the moment call me back in 1months time for example, the user would click the callback button, keys in 1month into the text field and press save. the system would now store this information in the database but remove the customer from the customer list, then in 1months time that customer would appear back on the customer list and the admin can call back again. Making the customer appear back in 1months time or so seems very technical for me so would like you expertise on this one. Please I would more than welcome any input you may have or if you have a better or simplier idea. Thanks guys. Hello, I'm developing a script that includes an admincp. I want to know if anyone knows how to make it so when the administrator goes to the update section of the admin cp, it checks the scripts current version and displays the latest version released, then they have an option to install the latest version, using php to release the files needed with a list of files on the update server. Is there any possible way to do this? Is it possible to pass a callback function to other class's method?
Is what I am attempting to do a bad idea?
Thanks
<?php class validate { public function __construct($data,$callback) { //A bunch of script goes here, and I don't want to duplicate it if($callback) { //Use $callback function to modify $data } } } class controller { public function savePage() { //A bunch of script goes here, and I don't want to duplicate it $validate=new validate(array('hello'),$this->callback); } } class controller_page1 extends controller { public function callback() { //script which will be used to modify future $data } } ?> I have a small site that is based around maxbounty offers (incentives for leads as such) and I can't seem to work out a good way to adjust the database entry for 'currency' when the callback is performed.
Basically, I just need help finding a (fairly) secure php script (http://www.maxbounty.../help.cfm?id=12) that connects to my database and adjusts the user's balance to a certain amount on the call back.
In addition, one to deduct from the balance on call would also help heaps!
Is anybody able to help out?
I have a file I'm trying to split up to separate some HTML from PHP code. Everything works fine when all of the code is together but when I split it into two files the two call back functions in the html form will not work. No errors and when I view the page source my file is included with the form. Any help would be appreciated. Here is the file that has the include statement. add_action('admin_menu', 'sampleoptions_add_page_fn'); // Add sub page to the Settings Menu function sampleoptions_add_page_fn() { add_options_page('Options Example Page', 'Options Example', 'administrator', __FILE__, 'options_page_fn'); } function options_page_fn() { ?> <?php include('options_form.php'); ?> <?php } Here is the options_form.php file code. Code: [Select] <div class="wrap"> <div class="icon32" id="icon-options-general"><br></div> <h2>My Example Options Page</h2> Some optional text here explaining the overall purpose of the options and what they relate to etc. <form action="options.php" method="post"> <?php settings_fields('plugin_options'); ?> <?php do_settings_sections(__FILE__); ?> <p class="submit"> <input name="Submit" type="submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?>" /> </p> </form> </div> I'm guessing that it may have to do with this line of code, due to the page parameter but I don't know that much about that area. <?php do_settings_sections(__FILE__); ?> Thanks in advance <td> <button onclick="alertdialog()"><span class="glyphicon glyphicon-trash"> </span></button></td> <script> function alertdialog(){ window.confirm("Are you sure you want to delete this post?"); } </script> This is my code. I need to have a callback to a PHP script when a user decides to delete a post. I think html POST is the most unobtrustive way to do this. What's the easiest / most robust way to send data to a script when the user clicks OK? Appreciated. Mark Probably missing something really stupid here. My usort function: private function compareLastName($x, $y) { if($x['Name'] == $y['Name']) { return 0; } elseif ($x['Name'] < $y['Name']) { return -1; } else { return 1; } } is being called in this function, same file: public function loadAll() { //various SQL stuff $arrayNoNulls = $stmt->fetchAll(); //various SQL stuff $arrayNulls = $stmt->fetchAll(); $arrayAll = array_merge($arrayNoNulls, $arrayNulls); usort($arrayAll, "compareLastName"); print_r($arrayAll); } The page outputs the unsorted array, preceded by the warning. What am I missing? I am getting
set_exception_handler() expects the argument (static BugReporter::exception_handler) to be a valid callback in ....
The line is set_exception_handler(array('static BugReporter', 'exception_handler')); BugReporter is a class - eg
class BugReporter {
}
exception_handler is a function withing the class
I have no idea what is wrong. I haven't come across set_exception_handler() before
Can anyone see what is wrong - Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=343702.0 I have a listener which executes a HTTP request to a remote API before the User entity is persisted and uses the response to set one of the entity's properties. It will also listen for update and remove and will make the appropriate HTTP request to the API but will not modify the entity. All works as desired... Almost. If when persisting the entity, I have some error, the remote API and my application become out of sync. I wish to change my application to perform a second call to the API if an error occurs and reverse the previous call. My thoughts on how to implement a Place a try/catch block when executing the query. Don't like this approach. Add an ExceptionListener which somehow retrieves the entity and makes the applicable changes. Maybe part of the solution, but too complicated to be the full solution. When adding, updating, or deleting a user from the remote API under UserListener's three methods, adding a callback which gets executed upon a PDOException. I think this is the best approach and expanded my thoughts below.
<?php namespace App\EventListener; use Doctrine\Persistence\Event\LifecycleEventArgs; use App\Service\HelpDeskClient; use App\Entity\AbstractUser; final class UserListner { private $helpDeskClient; public function __construct(HelpDeskClient $helpDeskClient) { $this->helpDeskClient = $helpDeskClient; } public function prePersist(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->addUser($user); //$user will be updated with the HTTP response } public function preUpdate(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->updateUser($user); } public function preRemove (AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->deleteUser($user); } } Okay, how do I actually do this? Was thinking of modifying UserListner as follows: //... use Symfony\Component\HttpKernel\KernelEvents; final class UserListner { // ... public function prePersist(AbstractUser $user, LifecycleEventArgs $event) { $this->helpDeskClient->addUser($user); $event->getObjectManager()->getEventManager()->addEventListener(KernelEvents::EXCEPTION, function($something) use($user) { // Use $this->helpDeskClient to reverse the changes }); } // Similar for update and remove }
But when trying this approach, I get a PDOException, but my callback never gets excecated. I've also tried replacing KernelEvents::EXCEPTION with '\PDOException' (note the quotes) with no success. Any ideas what I should be doing differently? Maybe some totally different approach? I suppose I could make the request to the API after the DB query is complete for updating and deleting, but not for adding. i want to store the nickname of the user as a cookie.. somthing like set cookie name=nickname,value=smarty,expires after 1 week i know cookies are stored against domain names. what happens when another person logs in the same computer, with different login, and his nickname is diff how does the cookie get handled, and how does the right nickname flash against the right persons login id... Hey PHPFreaks! I have a problem with my login script, because when i login it sets a cookie and it all works. But when i got redirected and refresh the page, my script turns an error which says i'm not logged in? how come? This is what finds the cookie and redirects me Code: [Select] if(!isset($_SESSION['auth']) && !isset($_COOKIE['authcookie'])) { $_SESSION['ERROR'] = 7; header('location: index.php?login'); } how can i set cookie like a*dm*n@**t*r*c**.*c** ?? Code: [Select] $cookkiee = $islem_1['mail'] ; $sayisi = strlen($cookkiee)-1 ; $cok = $islem_1['mail'] ; for($i=0;$i<=$sayisi;$i++) { $sifr = rand(0,2); if($sifr ==0) { $cok[$i]= '*'; } $dizik = $cok[$i]; setrawcookie("kayip",$dizik,time()+(60*30),"/"); $_COOKIE['kayip'] = $dizik; echo $dizi // etc . a*dm*n@**t*r*c**.*c** } echo $_COOKIE['kayip']; // etc. just one char being like random a I have part of my script that I have used many times in many diffrent applications that works just fine. But in this use it refuses to set the cookie or do anything besides the redirect for that matter. // if login is ok then we add a cookie $ip = $_SERVER['REMOTE_ADDR']; $datem = date("j F Y, g:i a"); mysql_query("UPDATE YBK_Login SET date = '$datem' AND ip = '$ip' WHERE ID = '{{$info['ID']}'")or die(mysql_error()); $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie('ID_WatsonN', $_POST['username'], 0); setcookie('Key_WatsonN', $_POST['pass'], 0); setcookie('UID_WatsonN', $info['ID'], 0); setcookie('LOGIN', $info['ID'], time()+3); //then redirect them to the members area Header("Location: dashboard.php"); Hi, I was trying to use setcookie on my website but when I try to use, it wasn't setting anything and then I tried to make sure if it's setting something, I added Code: [Select] echo $_COOKIE;But it shows Array (just the word) instead of tblogvalue. This is the code I'm using; Code: [Select] $Month = 2592000 + time(); setcookie(tblog, tblogvalue, $Month); echo $_COOKIE; Hi all, I'm struggling with a program I'm trying to write with cookies, so any help would be very much appreciated!! What I'm wanting to do is when someone visits my site, I want to display content until the end of the day, and once the days up it disappears forever/until the cookies are deleted. Could someone help me with this? Thanks lots in advance, Jake Ok I have my login form and previously I was using $_SESSION untill I learned this removes data when browser is closed. Someone said to me to use cookies but I have no clue where to begin on setting a cookie or reading information from it. Can anyone point me to a tutorial on cookies? if a user clicks ?hide=1 or ?hide=2 it does Code: [Select] if (isset($_GET['hide'])){ $id = intval($_GET['hide']); setcookie('hide', ''.$id.'',time()+32000000); header('Location: index.php'); exit; } How do I make it so if they click ?hide=1 it ad's 1, but what if they do ?hide=2 also? it would need to be 1,2 not just 2. I have a question about cookies I want the cookie to work on all the paths / folders / directorys located in a root path. So say like.. http://www.site.com/members/login.php is the folder which sets the cookie, then this cookie will also work on like.. http://www.site.com/bla/boo/works.php I'm trying to do: setcookie(Data1, 'valueofthecookie', '/', '.site.com', 1); But its not working... |