-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Heres a very basic way. $username will be the input <?php $username = "what ever"; $result = mysql_query("SELECT * from table WHERE username = '$username' "); $num_rows = mysql_num_rows($result); if($num_rows > 0) { die("User already exists"); } ?>
-
okay i only skimmed this but you could try this.. (BTW: using UserID would be better then usernames) **UNTESTED <?php $findfriends = "select * from friends where username = '".$_SESSION['username']."'"; $friendsresults = $db->query($findfriends); $friendnumrows = mysqli_num_rows($friendsresults); if($friendnumrows == 0) { //echo nothing; } else if($friendnumrows != 0) { $friend = ""; while($friendrows = $friendsresults->fetch_assoc()) { $friend .= $friendrows['friendname']."','"; //Build friendlist } $friend = "'".trim($friend,",")."'"; // remove last comma $bulletin_query = "select * from bulletin where postuser IN ($friend)"; $bulletin_results = $db->query($bulletin_query); $bulletin_rows = mysqli_num_rows($bulletin_results); if($bulletin_rows == 0) { //echo "<tr>Your friends have <b>not</b> posted any bulletins.</tr>"; } else if($bulletin_rows != 0) { while($bulletinrow = $bulletin_results->fetch_assoc()) { $bulletinposter = $bulletinrow['postuser']; $bulletintime = $bulletinrow['date']; $bulletintitle = $bulletinrow['title']; $bulletinid = $bulletinrow['id']; echo"<tr> <td width='20%' bgcolor='#e9e9e9'><a href='/profile.php?user=$bulletinposter'><b>$bulletinposter</b></a></td> <td width='35%' bgcolor='#e9e9e9'>$bulletintime</td> <td width='45%' bgcolor='#e9e9e9'><a href='/bulletin.php?action=readbulletin&bulletinid=$bulletinid'>$bulletintitle</a></td> </tr>"; } } ?>
-
See my last post
-
Autocommit is normally on.. but if its off then you can commit the changes that what mysqli_commit is for.. think of it this way commit writes the data to the drive while uncommit data is held in memory, if you look up mysqli_rollback it may clear thing up.. rollback reverts back to the uncommits data hope that helps EDIT: wildteen88 link is better lol
-
Turning Magic quotes on will only reduce the risk it won't stop people using all types SQL Injection. plus will could cause other problems, i find magic quotes a nightmare
-
What your seeing is normally unseen (unless you turn the options on) in the email but it likely valid, try this $mail->headers = "MIME-Version: 1.0\r\n"; //Add this $mail->headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $mail->headers .= "Bcc: *the same address as above*\r\n"; //move this down one
-
Welcome, i use foreach with array 95% of the time, i find them easier just remember count is always over more then you need lol
-
your using count that returns 2 because the array have 2 items.. but the loop starts at 0, and ends at 2 thus 0,1,2 AKA 3 try for ($i=0; $i < (count($image)-1); $i++) { Another option foreach($tmpImage as $K=> $img) //$K = array key, $img = current items { if(!empty($img)) { echo $tmpImage[$K] . " - " . $imgImage[$K] ."<br />"; //please note $tmpImage[$K] is the same as $img //its just an example (normally i would use $img) } }
-
i'm pleased this one is solved lol
-
first try removing Kind regards, COMPANYNAME</body> and then add </body> and test (pleasse remove the </body> and then re-type it, you may have copied and pasted some extended chars, also change $mail->headers = "Bcc: *the same address as above*"; to $mail->headers = "Bcc: *the same address as above*\r\n"; $mail->headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; EDIT: you could also try UTF-8 instead of iso-8859-1
-
[SOLVED] i dont understand function natsort()
MadTechie replied to silverglade's topic in PHP Coding Help
No, its correct read samshel post "The previous sort functions sort" refers to sort() -
try this <html><head></head><body> <?php $image = 'http://12.180.48.34/pb001251.htm'; $server = 'http://12.180.48.34/pbsvss.htm'; $number = basename($image, ".png"); $ns = file_get_contents($server); $data_array = explode("\n", $ns); $result_array = array(); $count = 0; foreach ($data_array as $value) { if (strstr($value, $number)) { $result_array[] .= $value; $count++; } } if ($count == 0) { print "Failed to find shot!"; $final_result = "NOTHING FOUND!"; } if ($count != 0) { $final1 = $result_array[0]; $final2 = $result_array[1]; $final3 = $result_array[2]; $final4 = $result_array[3]; $final5 = $result_array[4]; } // start guid from shot $filestring = file_get_contents($image); /* //Removed $firstWordg = " *"; $lastWordg = "* "; $str = $filestring; $str = substr($str, strpos($str,$firstWordg)+strlen($firstWordg),strpos($str,$lastWordg)-strlen($lastWordg)); $guid_shot = stristr($str, '*'); $guid_shot{strlen($guid)-1} = " "; $guid_shot{0} = " "; $shot_guid = (explode("*", $guid_shot)); $gs = $shot_guid[0]; #$gs="001251"; */ if (preg_match('/src=([^.\s>]*)/si', $filestring, $regs)) { $gs = $regs[1]; } // end guid from shot // start htm check #echo "\$gs = $gs"; if(strpos($final1, $gs) !== false) { $final_result = $final1; }elseif(strpos($final2, $gs) !== false){ $final_result = $final2; }elseif(strpos($final3, $gs) !== false){ $final_result = $final3; }elseif(strpos($final4, $gs) !== false){ $final_result = $final4; }elseif(strpos($final5, $gs) !== false){ $final_result = $final5; }else{ echo "File too Large!"; } //Debug echo "'$final1'<br>'$final2'<br>'$final3'<br>'$final4'<br>'$final5'<br>"; // end htm check $fragments = (explode(" ",$final_result)); $name = $fragments[4]; $time1 = $fragments[7]; $time2 = $fragments[8]; $firstWord = "="; $lastWords = "("; $guid = $fragments[6]; $firstWord = "GUID="; $lastWord = "(W)"; $guid = substr($guid, strpos($guid,$firstWord)+strlen($firstWord),strpos($guid,$lastWord)-strlen($lastWord)); if ($irregular =='0') { $server = 'Unable to calculate'; }else{ $host =(parse_url($image)); $server = $host[host]; } $hash = md5_file($image); echo "<b>Name</b>: $name <br><br><b>Name</b>: $name <br><b>GUID</b>: $guid<br><b>Player IP</b>: ???<br><b>Server IP</b>: $server<br><b>Shot Name</b>: $number<br><img src='$image'</a><br><b>Image MD5</b>: $hash<br><br><b>Banline:</b><br>$time1 $time2 $guid $name \"0.0.0.0\" PBSS-BOT<br>"; echo "<br><br><br>Code To Copy and Paste<br><br><hr>[fieldset=Manual Submission Bot][color=green][b]Player Name[/b]: {$name}[/color]<br>[color=green][b]GUID[/b]: {$guid}[/color]<br>[color=orange][b]Player IP[/b]: ???[/color]<br>[color=orange][b]Server IP[/b]: {$server}[/color]<br>[color=blue][b]Shot Name[/b]: {$number}[/color]<br>[color=blue][b]Image MD5[/b]: {$hash}[/color]<br>[fieldset=Banline]{$time1} {$time2} {$guid} {$name} \"0.0.0.0\" PBSS-BOT[/fieldset]<br>[zoom]{$image}[/zoom]<br>HTM Line:[code]{$final_result} <br>[/fieldset]<br><hr>"; ?> </body></html> [/code]
-
so <p> <img src=pb001251.png> should return $gs = "001251"; or $gs = 1251;
-
Me either.. i that case it should be in the freelance section.. but i like to check first
-
the access level depends on how your current member system works but you could beable to do this via a session ie <?php session_start(); if(!isset($_SESSION['loggedin'])) { die("you must log in first"); } ?> as for the chat, whats the "problem" can you post your code so far
-
Heres the problem <?php $filestring = file_get_contents($image); $firstWordg = " *"; $lastWordg = "* "; $str = $filestring; $str = substr($str, strpos($str,$firstWordg)+strlen($firstWordg),strpos($str,$lastWordg)-strlen($lastWordg)); $guid_shot = stristr($str, '*'); $guid_shot{strlen($guid)-1} = " "; $guid_shot{0} = " "; $shot_guid = (explode("*", $guid_shot)); $gs = $shot_guid[0]; // end guid from shot // start htm check echo "\$gs = $gs"; //I added this it return $gs = Array ?> what are you trying to do here ? Also note that $guid was not set before this line! $guid_shot{strlen($guid)-1} = " ";
-
i'll need the file the can you create grab a small chunk of the file i can use (the large file )
-
yes, just remember Sessions will die then the user quits the browser where as cookies won't (well depends on their life span), but cookies can be controlled by the user where as sessions can not..
-
try this <?php $gs = 'Bill'; if(strpos($final1, $gs) !== false) { $final_result = $final1; }elseif(strpos($final2, $gs) !== false){ $final_result = $final2; }elseif(strpos($final3, $gs) !== false){ $final_result = $final3; }elseif(strpos($final4, $gs) !== false){ $final_result = $final4; }elseif(strpos($final5, $gs) !== false){ $final_result = $final5; }else{ echo "File too Large!"; } echo "$final_result"; ?>
-
can you attach a file, and explain what your expecting to see
-
maximum exicution time. would should report an error, just to confirm.. is this the same list of people and the same file ?
-
it wouldn't.. Okay this is what you want then (makes a little more sense now) set $final_result to the line containing the found string <?php if(strpos($final1, $gs) === true) { $final_result= $final1; }elseif(strpos($final2, $gs) === true){ $final_result= $final2; }elseif(strpos($final3, $gs) === true){ $final_result= $final3; }elseif(strpos($final4, $gs) === true){ $final_result= $final4; }elseif(strpos($final5, $gs) === true){ $final_result= $final5; }else{ echo "File too Large!"; echo "'$final1'<br>'$final2'<br>'$final3'<br>'$final4'<br>'$final5'<br>"; //Debug } ?>
-
I agree, but you may want to have a cookie for a "remember me" option (just remember the cookies data can be accessed and edited by the user, so don't add their password or access right in their)
-
oops update to <?php if(strpos($final1, $gs) === true) { $final1 = $final_result; }elseif(strpos($final2, $gs) === true){ $final2 = $final_result; }elseif(strpos($final3, $gs) === true){ $final3 = $final_result; }elseif(strpos($final4, $gs) === true){ $final4 = $final_result; }elseif(strpos($final5, $gs) === true){ $final5 = $final_result; }else{ echo "File too Large!"; echo "'$final1'<br>'$final2'<br>'$final3'<br>'$final4'<br>'$final5'<br>"; //Debug } ?>
-
Could be overloading the email server, timingout, limits on the email server.. do you have any other info (errors etc)