Follow us on Twitter!
You cannot teach a man anything; you can only help him find it within himself. - Galileo
Friday, April 25, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 24
Guests Online: 21
Members Online: 3

Registered Members: 82906
Newest Member: ilija
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Help with php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 23-09-09 21:24
Ok I would like to make a url with php. Lets say...

http://mydomain.com/servlet/Index.php?nid=2


How would I make it to where the "nid=#" be a new number everytime the user refreshed the page.

I was thinking something like

<?php
for ($i=0;$i<=10;++$i) {
echo '<a href="http://mydomain.com/servlet/Index.php?nid='. $i . '">Click Here to refresh</a>';
}
?>

But its not working apparently. Im a noob. Sorry.

Edited by on 23-09-09 21:27
Author

RE: Help with php

ynori7
Member



Posts: 1486
Location: #valhalla
Joined: 08.10.07
Rank:
God
Posted on 23-09-09 21:43
Froger wrote:
<?php
for ($i=0;$i<=10;++$i) {
echo '<a href="http://mydomain.com/servlet/Index.php?nid='. $i . '">Click Here to refresh</a>';
}
?>

That'll just print out 10 hyperlinks.

You could just say:
Code
$i=rand(0, 10);
echo "<a href='http://mydomain.com/servlet/Index.php?nid=$i'>Click Here to refresh</a>";



But of course the user will have to click your link to make the number change, if they hit refresh it wont do it. Why exactly do you want the value in the url to change?


halls-of-valhalla.org/images/affiliateLogo.png voodoorage.halls-of-valhalla.org/images/smallLogo.png
i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg
ynori7 http://halls-of-valhalla.org
Author

RE: Help with php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 23-09-09 21:44
I see you've got the whole concept of how php works and is utilized wrong. It's not one transnet program that ends and waits for a user reaction everytime an echo statement is used. It's one script that is executed in its entirety, in this case on the server and can then execute again if called for again, etc.
What you'd need is a session for the person where you can keep a counter variable that gets incremented every time the person asks for that page.
For more info: http://www.tizag.. . .ssions.php
However, I'd really recommend you to get a more firm grasp on php first.


Author

RE: Help with php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 23-09-09 22:17
ynori7 wrote:

Code
$i=rand(0, 10);





This is actually what I did. The reason why is because I couldnt prevent my mobile browser from caching images no matter what I did. So I had to make sure that when Refreshing the url would change. Now my browser isnt caching images files so the page can now be reloaded successfully. Thanks yall.
Author

RE: Help with php

ynori7
Member



Posts: 1486
Location: #valhalla
Joined: 08.10.07
Rank:
God
Posted on 24-09-09 00:48
Froger wrote:
Thanks yall.

...Not entirely sure I understand, but glad I could help.


halls-of-valhalla.org/images/affiliateLogo.png voodoorage.halls-of-valhalla.org/images/smallLogo.png
i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg
ynori7 http://halls-of-valhalla.org
Author

RE: Help with php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-09-09 00:52
ynori7 wrote:
Froger wrote:
Thanks yall.

...Not entirely sure I understand, but glad I could help.


Say you're working on a design but you're web browser keeps caching the CSS file, a simple solution on this is:

echo "<link src=\"/styles/theme.css?rand=".rand(0,1000)."\" />";

The CSS file doesn't parse the GET variable, although the web browser will think that this is a new file that hasn't been cached yet. Ergo, it will fetch that file instead of the cached one.