-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
welcome, can you click topic solved please (bottom right)
-
The RegEx matches everything until it hits a "[25]" and puts that into Var1, then matches everything until it hits a and puts that into Var2 so, the results would be as follows (so it may not be what you want.. $text = '[24]Test[25]Thank you for reading!'; var1 = "[24]Test[25]"' var2 = "Thank you for reading!" $text = 'testing [24]Test[25]Thank you for reading!'; var1 = "testing [24]Test[25]"' var2 = "Thank you for reading!" $text = '[24]Test[25]Thank you for reading! can't find me'; var1 = "[24]Test[25]"' var2 = "Thank you for reading!" of course i could mod it to remove the [24] & [25] or only include the text inside them or almost anything but from what he said i assume this is correct
-
try this <?php $cxn = mysqli_connect($host, $user, $password, $dbname) or die ("Connection failed."); $fusername= $mysqli_real_escape_string($_POST['fusername']); //stop SQL injection $sql3 = "SELECT status FROM members WHERE username = '$fusername' "; $result3 = mysqli_query($cxn, $sql3)or die ("Couldn't execute query 3."); $staff = mysqli_fetch_assoc($result3); if ($staff['status'] == "Super Administrator") { $message = "Super Admin.<br />"; }else { $message = "You do not have permission to post comments.<br />"; } ?>
-
lol, your welcome can you click topic solved please
-
You mean like this ? <?php $text = '[24]Test[25]Thank you for reading![/quote]'; if (preg_match('%(.*?\])([^]]*?\[\/QUOTE\])%si', $text, $regs)) { $Var1 = $regs[1]; // [24]Test[25] $Var2 = $regs[2]; // Thank you for reading![/quote] } ?> EDIT: to be more exact, i guess you should have if (preg_match('%(.*?\[25\])([^]]*?\[\/QUOTE\])%si', $text, $regs)) {
-
try this.. <?php foreach ($xml->xpath('//item') as $K => $item) { $title = $item->title; $description = $item->description; $guid = $item->xpath('//article:uid'); echo "<a href='$link'>".$guid[$K]." - ".$title."</a><br />".$description."<br />"; } ?>
-
do a var_dump($guid); and post the results but as a guess try echo "<a href='$link'>".$guid[0]." - ".$title."</a><br />".$description."<br />";
-
XSS on a GET, humm.. well i guess someone could send a link via email that uses it, redirect to another site or deface the site or maybe even get their login details.. depends on the site and whats not filtered.. if PHPSESSID is not sanitized then i don't think thats a problem .. unless your displaying it..
-
This is used with sessions.. a cookie is created, or it can be passed via the URL Basically its contains a random code something like this 'uj2oqg5agtejger46qq0jicpr6', now on the server theirs a file with the same code when your browser passes info to the server, the server can read the cookie and match it up to the correct file and from that it can get your session infomation.. to sum up.. its used to link your web browser to the sessions stored on the server.. any more questions or anything you don't understand?
-
try this <a href="?var=foo"><img src="images/img.jpg" border="0"></a> of course the href could also be used to call a JS
-
your either using it wrong or missing something download the full thing and test the examples.. http://sourceforge.net/project/showfiles.php?group_id=55859&package_id=50965 any questions should be posted their or in third party section
-
the function getmp3data doesn't exist or is private in the getid3.php file (which we can't access)
-
this is mysql problem in anycase.. try SELECT count(`u_id`) as total, `u_id` FROM `videos` ORDER BY total ASC LIMIT 10;
-
I'm the in same boat.. you can try a standard image inside a hyperlink with border set to 0.. (could use a javascript to set a field and then submit) or standard a html form button. it was a real pain anyway i thats all i have and i hope that helps
-
try these http://www.w3schools.com/PHP/php_cookies.asp http://www.w3schools.com/PHP/php_sessions.asp
-
[SOLVED] How to add links to dynamic categories
MadTechie replied to Potatis's topic in PHP Coding Help
Thats a very good point rhodesa, reminds me of my a ajax hell project lol -
okay when user does something, system inserts a records into UserActivity table.. for example, (ignore , curtime() if your not using a datestamp.. personally i would) user 10: logs in, system: adds a record (10, "logs in", curtime()) user 10: logs out, system: adds a record (10, "logs out", curtime()) user 11: logs in, system: adds a record (11, "logs in", curtime()) user 10: logs in, system: adds a record (10, "logs in, curtime()") user 10: logs out, system: adds a record (10, "logs out", curtime()) user 11: logs out, system: adds a record (11, "logs out", curtime()) SELECT count(*) as UA FROM UserActivity $ROW['UA'] = 6 Okay thats 6 records in UserActivity SELECT count(*) as UA FROM UserActivity WHERE user_id = 11 $ROW['UA'] = 2 2 for User 11 and SELECT count(*) as UA FROM UserActivity WHERE user_id = 10 $ROW['UA'] = 4 4 for user 10 so ($UserActivity / $TotalActivity)* 100; User 10 Activity: (4 / 6)* 100; = 66.666 User 11 Activity: (2 / 6)* 100; = 33.333 okay a little tweak round(($UserActivity / $TotalActivity)* 100); which is User 10 Activity: 66% User 11 Activity: 33% Last part would be adding a date range and would be an idea to add a clean up routine to remove out dated records.. but you should get the idea now
-
[SOLVED] How to add links to dynamic categories
MadTechie replied to Potatis's topic in PHP Coding Help
yes the list.php is build from rhodesa php code you could also create HTML form, you could pass it when its submitted.. <form method="POST"> <input type="text" name="search"> <select name="cat"> <option value="cat1">category1</option> <option value="cat2">category2</option> <option value="cat3">category3</option> </select> <input type="submit" name="go"> </form> <?php if(isset($_POST['go'])) { echo "SELECT category: ".$_POST['cat']; } ?> an extra step would be building the drop down <input type="text" name="search"> <select name="cat"> <?php //select * from cat while($ROW = mysql_fetchrows($result)) { echo "<option value=\"{$ROW['id']}\">{$ROW['name']}</option>"; } ?> </select> *untested hope that helps -
What you have tried makes no logical sense! You are basically working out how long ago the last activity was. and using that to get a percentage of use! :S .. that can't work! you can't just used the existing data.. you need more.. hence building another table etc.. Please read my last post.. what part doesn't make sense ?
-
Unless i am missing something you or missunderstand (happends alot), could try this:~ <?php ob_start(); include "script.php"; $script1 = ob_get_contents(); include "script2.php"; $script2 = ob_get_contents(); ob_end_clean(); //...blar blar //no errors then output echo $script1; echo $script2; ?>
-
"undefined variable" means the variable hasn't been set it doesn't exist ie <?php echo $test; //<--undefined variable $test = "tester"; //Set variable echo $test; //<--working variable ?> the problem doesn't seam to be with the SQL, but with the page that has personally i don't use short tags try <?php echo $row['Link']; ?>
-
update multiple checkboxes? DELETE and INSERT INTO?
MadTechie replied to jarv's topic in PHP Coding Help
oops i didn't notice it was outside the loop try echo '<input name="keyword_id[]" type="checkbox" value="'. $row1['keyword'].'"/>'; -
How do I make a textbox not allow any HTML code
MadTechie replied to kpetsche20's topic in PHP Coding Help
when the form is submitted, use strip_tags() to remove html tags or even better use htmlentities() this will convert > to > etc thus making it view instead of parsa example <?php $str = "hello world, here is some <b>BOLD</b> text"; echo strip_tags($str); echo "<br>"; echo htmlentities($str); ?>