Page 1 of 2
Easy PHP Question
Posted: Fri Oct 13, 2006 11:29 pm
by holyearth
Hey Experts, I have some questions for you. I am a newb (learning), so have mercy on me. I appreciate everyone's help in advance.
I am looking for a PHP script that will do the following simple tasks:
Asks the user a starting number (example 103)
Asks the user to go in increments of? (example 4)
Ask the user whether we're going upwards or downwards? (in other words going + in numbers (increasing) or going - in numbers (decreasing)
Then "onclick" the script will redirect to a url as follows:
submit.php?n1=103&n2=104&n3=105&n4=106&n5=107
The tricky part is that I need it to do 10-15 "sockets/threads" at a time, for example the next "set" would be:
submit.php?n1=108&n2=109&n3=110&n4=111&n5=112
I don't mind paying for this code (via PayPal).
Posted: Fri Oct 13, 2006 11:32 pm
by feyd
May I ask what the final intention of this is supposed to be for? There may be more simple methods of generating whatever you're trying to achieve.
Posted: Fri Oct 13, 2006 11:36 pm
by n00b Saibot
decide whether you want help or want somebody to do it for you. This thread will need to be moved accordingly.
Posted: Fri Oct 13, 2006 11:38 pm
by holyearth
Well, i'd like help because all I can do it make it go once, I don't know how to make it take the starting number and add the incremental value to make a set (i.e. start at 102 in increments of 4 yielding 102,103,104,105,106).
feyd, this is for a submission of numbers used in a catalog. This is the most efficient way for my current setup.
Posted: Fri Oct 13, 2006 11:47 pm
by n00b Saibot
you should only get a starting number & increment size. rest you can calculate in your script.
for reading ?num=103&increment=5 see
$_GET variables.
and whatsup with the threads.. can you detail on that?
Posted: Fri Oct 13, 2006 11:49 pm
by feyd
well, there are a few basic ways of generating the numbers:
Code: Select all
for($i = $startingValue; $i < $startingValue + $run; ++$i)
{
echo $i . PHP_EOL;
}
for($i = 0; $i < $run; ++$i)
{
echo ($startingValue + $i) . PHP_EOL;
}
$numbers = range($startingValue, $startingValue + $run);
foreach($numbers as $number)
{
echo $number . PHP_EOL;
}
to name a few.
Posted: Fri Oct 13, 2006 11:52 pm
by holyearth
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is my basic .html template. It will help you understand where I seek help.
Code: Select all
<?php
$n1 = $HTTP_GET_VARS['n1'];
?>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>TESTING</title>
<script type="text/javascript">
function send() {
document.getElementById('sendtheform').submit();
}
</script>
</head>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" id="table1">
<tr>
<td>
<div align="center">
<table border="0" cellpadding="0" width="750" height="404" id="table2" bordercolor="#000000" bgcolor="#FFFFFF">
<tr>
<td>
<table border="0" style="border-collapse: collapse" width="100%" id="table7" height="102">
<tr>
<td>
<p align="center">
</td>
</tr>
</table>
<table border="0" width="100%" id="table9" height="172">
<tr>
<td>
<form method="POST" action="#">
<p align="center">
Start at the following number:
<input type="text" name="T1" size="16"></p>
<p align="center">
In increments of:
<input type="text" name="T2" size="4"></p>
<p align="center">
Go Forwards:
<input type="checkbox" name="C1" value="ON" checked></p>
<p align="center">
Threads / Sockets per second:
<input type="text" name="T3" size="4"></p>
<p align="center"> </td>
</tr>
</table>
<p align="center" style="margin-top: 0; margin-bottom: 0">
</p>
<div align="center">
<table border="0" width="100%" id="table8" height="111">
<tr>
<td>
<p align="center">
<input value="PROCESS & SUBMIT" onclick="send();" name="sendit" type="button">
</form>
</td>
</tr>
</form>
</table>
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Fri Oct 13, 2006 11:55 pm
by holyearth
As the .html stands,
A user enters a starting value
A user enters the increments of the value (Ending number = Starting number + incremental value)
Checkbox determines if numbers go + or -
It asks the user for how many threads/sockets to do. This means that it will "submit" x amount of times (example 10 times a second)
But, I am dont know how to integrate php to make this happen.
Posted: Fri Oct 13, 2006 11:58 pm
by n00b Saibot
holyearth wrote:But, I am dont know how to integrate php to make this happen.
then you should study the
php manual for increase in your knowledge. will help you a lot...
Posted: Sat Oct 14, 2006 12:01 am
by holyearth
noob saibot,
Yes I appreciate that and I am looking forward to learning but at the present moment I am in need of this script.
Posted: Sat Oct 14, 2006 12:05 am
by n00b Saibot
ok here is a starter:
Code: Select all
<?php
$start = $_GET['T1'];
$incr = $_GET['T2'];
$dir = isset($_GET['C1']) ? 'forward' : 'backward';
$thread_per_sec = $_GET['T3'];
?>
this will capture all the data posted in the HTML form... you can take off from here I hope
Posted: Sat Oct 14, 2006 12:13 am
by holyearth
noob saibot,
Perhaps there is some misunderstanding...
I want the .html to process the data I input. I can receive the variables fine after submission.
What I need is for the .html to take the data and send it in a frame (which I did not put into the .html yet) ....
for example.....
I put into the box START AT 272
I put into the box in increments of 3
Going Forwards: Checked
Then, the .html will submit (via iframe) like this:
submit.php?n1=272&n2=273&n3=274
I can do the above no problem. The problem is this. I need it to do that 10 times in one second. So, for example, in one second it should do:
submit.php?n1=272&n2=273&n3=274
submit.php?n1=275&n2=276&n3=277
submit.php?n1=277&n2=278&n3=279
submit.php?n1=280&n2=281&n3=282
submit.php?n1=283&n2=284&n3=285
submit.php?n1=286&n2=287&n3=288
submit.php?n1=289&n2=290&n3=291
submit.php?n1=292&n2=293&n3=294
submit.php?n1=295&n2=296&n3=297
submit.php?n1=298&n2=298&n3=299
Posted: Sat Oct 14, 2006 12:19 am
by n00b Saibot
is that fixed that you want that called ten times? can you post what is in iframe? you can use javascript probably for this...
Posted: Sat Oct 14, 2006 12:22 am
by holyearth
yes noob i am thinking i will need javascript

(javascript I have no idea how to do)
The 10 is not fixed it may be 15.
The iframe is just redirection like submit.php?n1=101&n2=102&n3=103
Posted: Sat Oct 14, 2006 9:40 am
by holyearth
Just so everyone knows...
I contacted noob saibot via Yahoo IM.
I paid him $65 via paypal and he said he would deliver me the script.
An hour or so later I get the script. I ask him to make one adjustment. He never makes the adjustment.
Instead he says:
(10/14/2006 3:40:10 AM) n00b_saibot_is_here: ok bye
(10/14/2006 3:40:27 AM) n00b_saibot_is_here: see ya
I want everyone on these forums to know that noob saibot did this. I will be telling PayPal about this.
The adjustment I asked for was to make some hidden iframes visible.