|
|
 |
 |
 |
 |
register |
bbs |
search |
rss |
faq |
about
|
 |
 |
meet up |
add to del.icio.us |
digg it
|
 |
 |
| Everything *NIX This is a general forum about all forms of *nix. Post your ideas and thoughts on this wonderful OS family. Talk about your personal favorite flavor of *nix and why you think it's so much better than the others. Anything pertaining to *nix and *nix administration should be posted here. |
 |
# 1

2008-03-04, 23:31
|
|
|
PHP script not executing fully
So i finally got my server up and running. Able to ftp and ssh to it. Get a response when i go to the ip address. I uploaded a php script that connect to a website, login, does some stuff.
There a problem with it. It only executes the first part of the script. Login part. Nothing else. I wondering if i have apache configured correctly? how do i change how long i let a script execute for? Also the script requires it to create a txt file. I noticed it wasn't creating that file. I thinking permission but do i gotta change the permission on the file. If so to what?
|
# 2

2008-03-05, 00:28
|
|
|
Re: PHP script not executing fully
Judging by your source code I would say you put a 4 instead of a $.
|
# 3

2008-03-05, 08:03
|
|
Moderator
|
|
Great Britain
|
|
Re: PHP script not executing fully
What's being displayed on the screen? Nothing?
You probably have a PHP error and have display errors turned off.
Look in /etc/php.ini for error_reporting and display_errors
Provided the script is executing at all, my money would be on an error within your PHP. Post the source if you wish, and I'll take a look.
-deus-
|
# 4

2008-03-06, 04:44
|
|
|
Re: PHP script not executing fully
Quote:
Originally Posted by deus-redux
What's being displayed on the screen? Nothing?
You probably have a PHP error and have display errors turned off.
Look in /etc/php.ini for error_reporting and display_errors
Provided the script is executing at all, my money would be on an error within your PHP. Post the source if you wish, and I'll take a look.
-deus-
|
I don't think it my php script due to it works on my laptop which runs wamp right now. It work flawless for several months now, but as i create more and more script i dont want them all running off laptop
Quote:
|
Warning: fopen(email@hotmail.com.txt): failed to open stream: Permission denied in /var/www/GoldSeeker.php on line 38
|
My script doesn't seem to have permission to write to the folder it in. How would i fix this?
All the other errors seem to lead off of this one. Due to the script relies on information and writing to this file.
Showing errors really helped 
|
# 5

2008-03-07, 17:15
|
|
Moderator
|
|
Great Britain
|
|
Re: PHP script not executing fully
Quote:
Originally Posted by ThunderChicken
I don't think it my php script due to it works on my laptop which runs wamp right now. It work flawless for several months now, but as i create more and more script i dont want them all running off laptop
My script doesn't seem to have permission to write to the folder it in. How would i fix this?
All the other errors seem to lead off of this one. Due to the script relies on information and writing to this file.
Showing errors really helped 
|
I didn't mean it was necessarily an error with your code, in this case it's a permissions error, but it caused a fatal error in PHP.
Anyway, it'll be the permissions. Does the file exist? You'll want to make it all-writable if it does, or make the directory all-writable if it doesn't so it can be created. Look into file permissions and the chmod command.
-deus-
|
# 6

2008-03-08, 03:49
|
|
|
Re: PHP script not executing fully
Well change owner of the folder to apache so it can write. changed it to 775. This correct so far?
I'm not understanding this error now.
Notice: Undefined offset: 0 in /var/www/GoldSeeker.php on line 104
This error keeps repeating all the way to 200. It a loop but i not understanding why it giving me this :S
The bold part is the error part
Quote:
<html>
<form action="GoldSeeker.php" method="post">
Email: <input type="text" name="email"><br>
Pass: <input type="text" name="pass"><br>
Start Page: <input type="text" name="startpage"><br>
End Page: <input type="text" name="endpage"><br>
Minimum gold (only numbers): <input type="text" name="mingold"><br>
<input type="Submit">
</form>
<?php
dtdarkmanage ("email@hotmail.com","123456","1","675000","1","1" ,"50000000");
function dtdarkmanage($email1,$pass1,$bangsa,$harga,$min_fo rt_damages,$mode,$min_bank){
set_time_limit(0);
if (isset($_POST['email']))
{
$email=addslashes($_POST['email']);
$pass=addslashes($_POST['pass']);
$startpage=addslashes($_POST['startpage']);
$endpage=addslashes($_POST['endpage']);
$mingold=addslashes($_POST['mingold']);
//echo $email."<br/>".$pass."<br/>".$startpage."<br/>".$endpage."<br/>".$mingold."<br/><br/>";
$post_arr = array ("email" => $email, "password" => $pass, "submit" => 'TRUE',);
$dthrones = "http://www.darkthrone.com";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0";
//$agent = "MSIE 6.0 (compatible; Mozilla/4.0; Windows NT 5.1) Opera 7.54u1 [en]";
$error_msg='';
$newfile = $email.".txt";
$url="darkthrone.com/login.dt";
$headertemp = fopen($newfile,"w");
//AUTO LOGIN
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
$headers = array("Expect:");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$post_arr);
//curl_setopt($ch, CURLOPT_REFERER, "darkthrone.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
curl_setopt ($ch, CURLOPT_WRITEHEADER, $headertemp);
curl_exec($ch);
fclose($headertemp);
curl_close($ch);
$fillheader = $newfile;
$confim = findme2($fillheader, "20", "32", "redirect.dt?s");
echo date('H:i:s');
echo " - $email<br>\n";
if ($confim <> "") {
echo date('H:i:s');
echo " - Login succesful! SESSION-ID = $confim<br>\n";
}
$session=$confim;
// LOADING ATTACK PAGE
for ($startpage;$startpage<=$endpage;$startpage++)
{
//echo "<br/>";
loadAttackPage($dthrones,$agent,$session,$startpag e,$mingold);
}
}
}
// ANY CODE YOU WANTED REPEATED OR EXECUTED ON MANY RANGES USE A FUNCTION LIKE BELOW
function loadAttackPage($dthrones,$agent,$session,$page,$mi ngold)
{
$url = $dthrones."/userlist.dt?session=".$session."&mode=attack&page= ".$page;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_HEADER, 1);
$res=curl_exec($ch);
curl_close($ch);
$b= preg_match_all("/\<td class\=\"box_content\" align\=\"center\"\>[0-9]*\<\/td\>/",$res,$f);
$c= preg_match_all("/[0-9A-Za-z_]*\<\/a\>\<\/td\>/",$res,$g);
$d= preg_match_all("/&id=[0-9]*/",$res,$h);
for ($i=0;$i<50;$i++)
{
$id[$i] = str_replace("&id=","", $h[0][$i]);
}
for ($i=0;$i<50;$i++)
{
$username[$i]=$g[0][$i+2];
}
$counter=0;
for ($i=0;$i<50;$i++)
{
$OR[$i]=$f[0][$counter];
$counter++;
$Gold[$i]=$f[0][$counter];
$counter++;
$Army[$i]=$f[0][$counter];
$counter++;
$Level[$i]=$f[0][$counter];
$counter++;
}
for ($i=0;$i<50;$i++)
{
$req=100000000;
$fix1 = substr_replace($Gold[$i],"", 0, 39);
$fixedgold[$i] = str_replace("</td>","", $fix1);
if ($fixedgold[$i] > $mingold)
{
$revgold = strrev($fixedgold[$i]);
$cut = str_split($revgold,3);
$commasep = implode(",", $cut);
$goldcomma = strrev($commasep);
?>
<a href="http://www.darkthrone.com/viewprofile.dt?session=&id=<?php echo $id[$i]."\">".$username[$i]."</a> ".$goldcomma." ".$level[$i]."<br/>";
}
}
}
function getID($dthrones,$agent,$session){
$url = $dthrones."/members.dt?session=".$session;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_HEADER, 1);
$res=curl_exec($ch);
$a=preg_match("/\buser=\b([0-9]+)/i",$res,$d);
$b=preg_match_all('/(? [0-9]+))/i', $d[0], $d2);
$ID=implode('',$d2[1]);
curl_close($ch);
return $ID;
}
function findme2($nama_file, $posisi, $panjang, $keword){
$recheck = '';
$val_get = '';
$val_get2 = '';
$nama_file = file($nama_file);
//echo $lines;
foreach ($nama_file as $line_num => $line) {
$pos = strpos($line, $keword);
if ($pos == true) {
$val_get = substr($line,$pos+$posisi, $panjang);
if ($recheck == '') {
$val_get2 = $val_get;
}
$recheck = 'on';
}
}
return $val_get2;
}
?>
|
Last edited by ThunderChicken; 2008-03-08 at 03:52.
Reason: edit out email
|
# 7

2008-03-08, 16:28
|
|
Moderator
|
|
Great Britain
|
|
Re: PHP script not executing fully
"Undefined offset" means the key you tried doesn't exist in the array.
For example, if I did:
Code:
$var = array ();
for ($i = 0; $i < 10; ++$i)
{
echo $var[$i];
}
I would get:
Code:
Notice: Undefined offset: 0 in __FILE__ on __LINE__
Notice: Undefined offset: 1 in __FILE__ on __LINE__
...
Notice: Undefined offset: 9 in __FILE__ on __LINE__
Notice: Undefined offset: 10 in __FILE__ on __LINE__
To debug, have a look at what's in the array by passing it to print_r () .
-deus-
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |
 |
To the best of our knowledge, the text on this page may be freely reproduced and distributed.

totse.com certificate signatures
|
 |
 |
About | Community | Bad Ideas | Drugs | Ego | Erotica | Fringe | Society | Technology
|
 |
 |
 |
 |
|
|