-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
that seems to be the case.
-
Calling a second PHP form as a subroutine.........possible?!
.josh replied to jeffery1493's topic in PHP Coding Help
[quote author=jeffery1493 link=topic=123098.msg508441#msg508441 date=1169189181] What I am doing is a forum, like this one, where you pay to post. You fill out the form, just like you do when you click "New Topic" here, and then after you click POST, you go to a payment routine where you are charged a fee. When the fee routine completes, if it is successful, your topic posts. If it is unsuccessful, your topic should not post. I don't know what else I can say........ [/quote] Okay do it like this example: makepost.php [code] <?php session_start(); // form for making post // I just have a generic form with a generic text field, for example sake echo <<<POSTFORM <form action='makepayment.php' method='post'> <input type='text' name='userpost'> <input type='submit' value='post'> </form> POSTFORM; ?> [/code] makepayment.php [code] <?php session_start(); if ($_POST['userpost']) { // save the userpost info in a session var $_SESSION['userpost'] = $_POST['userpost']; // form for taking payment // I just have a generic form with a generic text field, for example sake echo <<<POSTFORM <form action='processpayment.php' method='post'> <input type='text' name='ccname'> <br/> <input type='text' name='ccnumber'> <input type='submit' value='post'> </form> POSTFORM; } ?> [/code] processpayment.php [code] <?php session_start(); if ($_POST['ccname'] && $_POST['ccnumber']) { // generic boolean var for illustration purposes $payment = false; // do whatever you do to process payment, using $_POST vars // set $payment to true on success if ($payment == true) { // insert/display new post with $_SESSION var // or you could make $payment a session var too and // do like header('Location: processpost.php); exit(); // and go to another script altogether if you want to seperate // the payment and the post process scripts } else { // payment didn't go through or something happened. throw out // an error or whatever. } } ?> [/code] This is just a basic skeleton. You will obviously want to throw in form validation, as well as lots of other security checks. -
Calling a second PHP form as a subroutine.........possible?!
.josh replied to jeffery1493's topic in PHP Coding Help
nopers. not in the way that you are wanting to do it. You can do that with javascript, but seeing as how money is involved, I don't recommend it, since people can just turn it off or alter it. I can think of some scenarios involving sessions that might help, but you're going to have to give more details on what exactly you're wanting to do here... -
Calling a second PHP form as a subroutine.........possible?!
.josh replied to jeffery1493's topic in PHP Coding Help
Php is parsed on the server and then sent to the client. That's why it "continues to run." Because php is not an event based language, you are going to have to rethink your program flow here. Now, my suggestions are little more than guesses, since I have no idea what your "bigger picture" is, but you mentioned some kind of "pay-per-post" system, so my suggestion would be to setup a "bank" where the user pays ahead of time for x amount of posts and then when the user clicks the submit button to post, the handling script first checks to see if the user has enough "credits" for the post and if so, decriment "credits," insert/display. If not, don't insert, and also give an error message, or hold the post in a que and send them to a payment screen to get more credits, or something. But again, I'm just kind of feeling in the dark here, as I don't know the whole background of your situation. -
I don't really think that's the problem here. I think you fixed something that needed to be fixed...but let's find out for sure that that's not the problem, by commenting out your condition and doing this instead: [code] // if (strpos($line,"PING :") != 0) { if (substr($line, 0, 6) == 'PING :') { fwrite($socket, "PONG :irc.barafranca.com\r\n"); } [/code]
-
right. so, if I do strpos($line,"PING :") it would return the first instance of "PING :" in your string. If it finds nothing, it will return false, or 0. So basically, the only way your condition will be true is if 0 === 0, or in other words, the condition is true if it is not found. edit: yes, you should either change it to != 0 just simply if (substr($line,"PING :")) { ... }
-
you know, i'm looking at your ping code: [code] //pong at pings if (strpos($line,"PING :")===0) { fwrite($socket, "PONG :irc.barafranca.com\r\n"); } [/code] and maybe i'm just having a fubar moment, but isn't your condition only ponging if the strpos is false, meaning, only if it [i]doesn't[/i] find "PING :" ?
-
well it could be php if you want to select and submit. If you want it to get results whenever you select but not submit, then yes, you need javascript.
-
not really. Seeing as how it's php4 oop, It's just more "organized." But anyways, have you tried running your bot from somewhere else? This might help narrow down the issue.
-
Time limit on editing posts on this forum
.josh replied to neylitalo's topic in PHPFreaks.com Website Feedback
blue is much better. thankies. -
thoughts about what? The magazine as a whole? Some specific article?
-
I kind of sort of like the way devshed's mod works. On each post there is a little scale and when you click on it, there's a popup, where you can add/take away "rep points" and the amount of rep points you can add/take away is based on your "rep power" - which is based on how many positive rep points you yourself have. In addition to this "karma" system, there's a radio box to choose "I agree/disagree" and a text input to give your reasons why. You get a fair amount of space to type, like around 250 chars or something. When you submit, it adds your comments inside the targe post inside a little quote style box labeled "comments on this post." But again...I still feel this mod is little more than a spruced up karma system. I mean, I suppose since it would be some other site's cup of tea to use it, it would make for a good mod for you to make, Juan. But as far as phpfreaks is concerned...again, people decided the karma system wasn't working out. Maybe a mod like this would be useful though. I will agree that there have been plenty of times that I've read a post that I slightly agreed/disagreed on, and didn't necessarily feel it warranted a new post to express my opinion. However, adding comments to posts in this fashion, doesn't really do a whole lot for the people who have already visited the thread. How many people do you know who actually go back and re-read previous posts in threads? It would certainly be useful for future readers though.
-
Not the mention the fact that those ads paid for a dedicated server for phpfreaks so that people could stop bitching about not being able to get on...
-
yes it was sarcasm. Uncalled for? Actually, that was rather tame... laugh about it and get over it.
-
uh...the word 'sarcasm' comes to mind...
-
Most office environments I've seen [i]have[/i] only basic needs. Something to run their POS, ACT! or other similar program. Each worker only really needs a terminal. I think this product will be something of interest to a lot of companies.
-
ajax AND flash frontend? hmm...you know, i'm by no means an expert on either one of them, but it just seems to me that's kind of...oh I don't know, superfluous?
-
Because, like most businesses, they adhere to the philosophy of "if it ain't broke, don't fix it." And unfortunately, their idea of it being "fixed" is that their site runs perfectly fine with the current version, so therefore it's not broken. Unfortunately, the only way to get past that mentality is for their stuff to break. @businessman: I have a hard time believing that Barand is a supporter of "goto" style programming...
-
whoops. Hit the post instead of preview... anyways.. what I'm getting at is that it would probably be easier for you to look for a chatroom program with a php backend if you looked for js or flash based chatrooms, rather than searching for "php" chatrooms. Because as you know, php is not really well suited for 'real time' programs.
-
you know... a php based chatroom is little more than a fancy guestbook. All the live-ness to it comes from using something client-side, like javascript or flash.
-
you know, I read your last sentence neylitalo: "They rip you off shamelessly" and my mind immediately decided to read it as thus: "They off you shamelessly: R.I.P." I have no idea how this bears any relavence to the topic, but maybe it's like, an omen or something. Kind of like when an old fortune teller lady points her finger at you and screams "deeeeaaathhh!!!" or something. Or Ron.
-
No. You don't need the wire at all. Instead, have your computer and your camcorder each start a little fire so they can send smoke signals to each other. Is there a particular reason why you searched bestbuy, or is that just a random search result you pulled? http://www.tigerdirect.com/applications/SearchTools/search.asp?keywords=IEEE+1394&image1.x=0&image1.y=0
-
[quote author=Barand link=topic=122558.msg505688#msg505688 date=1168910276] I learnt only today that the time between hitting the key and realising that you just deleted everything is defined as an "onosecond" [/quote] LMAO
-
LoL I gave up. After an hour of my processor running at 100% I stopped it. I don't even know what number it got up to. Maybe I should have used some js or something to write the current number to the screen or something.
-
okay well all of that wierd looking thing looks well...wierd. and not just cuz it's wavy. The wavy actually helped. so I opted for the bcmath/bruteforce method. It's been running for about 15 min. now...