-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
add at the top <?php $exec = $_GET['exec']; ?> so <?php $exec = $_GET['exec']; if( ($exec=='main.php' && file_exists("main.php"))|| $exec=='') { include "main.php"; }else{ include $exec; } ?>
-
Ahh cool if your done in this thread can you click solved (bottom left)
-
your not setting $exec!!
-
I can't see any problems with the script have you checked with your host.. then again you could post the script. remember code tags!
-
No build a new string buy concatenating the extracts from substr
-
Seams OK to me heres my test built from yours <?php foreach ($_POST as $field => $value) { echo "$field = $value<br />"; } ?> <html> <head> <title>Forms Practice</title </head> <body> <form method = "POST"> Please check all that apply: <INPUT TYPE = "checkbox" NAME = "Catlover"> I love cats. <INPUT TYPE = "checkbox" NAME = "Doglover" > I love dogs. <INPUT TYPE = "checkbox" NAME = "Cat" > I am a cat. <INPUT TYPE = "checkbox" NAME = "Dog" > I am a dog. Last Name: <INPUT TYPE = "TEXT" NAME = "LastName" SIZE = "25" MAXLENGTH = "40"> First Name: <INPUT TYPE = "TEXT" NAME = "FirstName" SIZE = "25" MAXLENGTH = "40"> Password: <INPUT TYPE = "PASSWORD" NAME = "Password" SIZE = "25" MAXLENGTH = "40"> <p> Please select your favorite activity: <INPUT TYPE = "Radio" NAME = "favorite" Value = "hairball"> Cough up hairballs <INPUT TYPE = "Radio" NAME = "favorite" Value = "dogwalk"> Take my dog for walks <INPUT TYPE = "Radio" NAME = "favorite" Value = "catwalk" > Take my cat for walks <INPUT TYPE = "Radio" NAME = "favorite" Value = "poop"> Eat my own poop </p> <INPUT TYPE = "submit" NAME = "submit form" VALUE = "Submit" > <INPUT TYPE = "reset" NAME = "reset form" VALUE = "Reset"> </form> </body>
-
your very welcome, you wanted to learn so i helped
-
If they are lower case use this $CountryCode = strtolower($CountryCode); echo "<img src='image/$CountryCode.png' alt='$CountryName' />";
-
Make all image names uppercase and use this $CountryCode = strtoupper($CountryCode); echo "<img src='image/$CountryCode.PNG' alt='$CountryName' />"; EDIT: images are case specific ON *nix servers not windows, the above code will sort this
-
can we see the form please you may have a duplicate name's or something as the php is ok
-
ahh so echo "<img src='image/$CountryCode.png' alt='$CountryName' />"; i assume that you have an image in an image folder called GB.png etc EDIT Changed alt to $CountryName
-
Lets swap thing around a little OK first check if page is set then if ID show the id sectio else the summery section see below <?php // Page information will go here if ($_GET['page'] == 'news') { if (isset($_GET['id']) ) { mysql_connect($Host,$User,$Pass); @mysql_select_db($DB) or die ("Unable to select requested database."); $query="SELECT * FROM news WHERE id = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); echo ("<p><strong><span class=\"style1\">".$row['heading']."</span></strong></p> <p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." - ".$row['extcontent']." <br /> </p> <hr /> </div>"); }else{ mysql_connect($Host,$User,$Pass); @mysql_select_db($DB) or die ("Unable to select requested database."); $query="SELECT * FROM news"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo ("<a href='index2.php?page=news&id=".$row['id']."'><strong><span class=\"style1\">".$row['date']." - ".$row['heading']."</span></strong></a>"); } } } //no else needed as we always want main (i think) include("main.php"); ?>
-
all you need is the input and the find i have done the rest for you! i'll let you fiddle with substr + strpos as a note if you have PHP5 you can use stripos (ignores case)
-
but the database doesnt have a specific image entry. what do you mean ?
-
why not just use <?php header("Content-Type: image/png"); imagepng($DBimg); ?> of course $DBimg is the DB image
-
missed the last }
-
[SOLVED] Decrypting MD5 and mailing password
MadTechie replied to OilSheikh's topic in PHP Coding Help
Quite cheeky actually yeah if your not using salt which in turn means your users will know you have an insecure system! -
use substr to grab the data either side etc.. did you try my regexp example?
-
may help if $test was being set
-
as i am praticing RegEx $input = "We are PHP Freaks"; $find = "PHP"; $output = preg_replace('/('.$find.' )(\w+)/im', '$1<font color="#0000FF">$2<font>', $input ); echo $output; We are PHP Freaks
-
$ID = $_POST['t1'] should be $ID = $_POST['t1'];
-
does each entry have an UID (unique ID) ? using header it would look somethink like this <?php // Page information will go here if ($_GET['page'] == 'news') { mysql_connect($Host,$User,$Pass); @mysql_select_db($DB) or die ("Unable to select requested database."); $query="SELECT * FROM news"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)){ echo ("<a href='index.php?news={$_GET['page']}&header={$row['heading']}'><strong><span class=\"style1\">".$row['date']." - ".$row['heading']."</span></strong></a>"); } } if ($_GET['page'] == 'news' && isset($_GET['heading']) ) { mysql_connect($Host,$User,$Pass); @mysql_select_db($DB) or die ("Unable to select requested database."); $query="SELECT * FROM news WHERE heading = '{$_GET['heading']}'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); echo ("<p><strong><span class=\"style1\">".$row['heading']."</span></strong></p> <p align=\"left\" class=\"style1\">".$row['location']." ".$row['date']." - ".$row['extcontent']." <br /> </p> <hr /> </div>"); } ?>
-
what doesn't list correclty the logic looks sound to me
-
it would be something like this if (isset($_POST['t1'])) { $ID = $_POST['t1'] if(substr($ID, 0, 2) == "st") { $MM_redirectLoginSuccess = "student_designed.php"; $loginUsername= "student";//$_POST['t1']; $password=$_POST['t2']; } $MM_fldUserAuthorization = ""; that should give you a push in the right direction
-
OK i am still not 100% sure but let me know if i am close.. OK we click one News "Sports" section link = index.php?page=sport in this page it shows a summory of all the sports (SELECT ID, summery from news_table) IE but if we click one the 1. (for example) it takes up to another page with the full news link = index.php?page=sport&id=1