-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
[SOLVED] passing $_FILES array into function
MadTechie replied to trekerboy's topic in PHP Coding Help
with this funtion uploadFile($uploadfile, $maxsize, $allowedext) you should use move_uploaded_file($uploadfile['tmp_name'], $uploadfile['name']) i think thats what you asked! -
[SOLVED] Retrieving Data from Multiple Tables???
MadTechie replied to kemper's topic in PHP Coding Help
NO DUPLICATE POSTS! you have the same post here -
PHP drop down to redirect URL on the same page
MadTechie replied to t_k_eoh's topic in PHP Coding Help
I refer to myself as the JavaTwat.. as i always get in a mess but if it has to be done, it should be done correctly **thinks about some old code.... oh my what a mess they where** -
All i can suggect is read the info that came with the class or create your own.. i'll admit i have seen better! add item syntax additem($id, $name, $count, $prix) update quantity(q=) & price(p=) <?php include "basket.inc"; //The object need to be here, first of any output to the browser // Refer to cookie reasons $b=new basket(); $action = $_GET['action']; //ADD THIS LINE $id= $_GET['id']; //ADD THIS LINE $q= $_GET['q']; //ADD THIS LINE $p= $_GET['p']; //ADD THIS LINE switch($action){ case "A": $b->additem($id,1, $q, $p); //EDIT break; case "R": $b->removeitem($id); break; }
-
ok you currently have some code with an SQL statement now instead of using a loop, to add it up if you change the SQL statement to SELECT SUM(pageviews) as TotalPageViews FROM tablename; (your need to update the tablename) then $rowpageviews = mysql_fetch_array($pageviews) echo $rowpageviews['TotalPageViews']; //<--echos the total make sense ? option2 change $additup = ++$rowpageviews['pageviews']; to $additup = $additup+$rowpageviews['pageviews'];
-
$country = $row['country']; $email = $row['email']; $signature = $row['about_me']; $acc_pms = $row['accept_pms']; $avatar = $row['avatar']; $user_class = $row['user_class']; are outside the function.. try this get_logged_in_users_details($member); to $row = get_logged_in_users_details($member); #################################################################################### function get_logged_in_users_details($member) { $query_user = "SELECT * FROM `membership` WHERE `username`='$member'"; $result_user = mysql_query($query_user); $row = mysql_fetch_array($result_user); $user_id = $row['id']; $user_name = $row['username']; echo "<br /><span class=\"release\"><align=\"center\"> Hi, <a href=\"userdetails.php?id=$user_id\">$user_name</a>!</span><br /><br />"; return; } #################################################################################### to #################################################################################### function get_logged_in_users_details($member) { $query_user = "SELECT * FROM `membership` WHERE `username`='$member'"; $result_user = mysql_query($query_user); $row = mysql_fetch_array($result_user); $user_id = $row['id']; $user_name = $row['username']; echo "<br /><span class=\"release\"><align=\"center\"> Hi, <a href=\"userdetails.php?id=$user_id\">$user_name</a>!</span><br /><br />"; return $row; } ####################################################################################
-
What to replace "$_REQUEST" with, so that it pulls from current page?
MadTechie replied to ghurty's topic in PHP Coding Help
What ?!! maybe $location[0] = "X"; $location[1] = "Y"; $location[2] = "Z"; but you lost me!! -
use this SQL statement SELECT SUM(pageviews) as TotalPageViews FROM table; and pull this $rowpageviews['TotalPageViews']; it should be quicker
-
<?php include "basket.inc"; //The object need to be here, first of any output to the browser // Refer to cookie reasons $b=new basket(); $action = $_GET['action']; //ADD THIS LINE $id= $_GET['id']; //ADD THIS LINE switch($action){ case "A": $b->additem($id,1); break; case "R": $b->removeitem($id); break; }
-
PHP drop down to redirect URL on the same page
MadTechie replied to t_k_eoh's topic in PHP Coding Help
Well i think <option value="1">One</option> is the better way, as for PHP vs. JS the way i look at it is, if its not sensitive data and then why not have the clients PC do the work for you, save the server handerling the requests.. 90% of the forms i create have JavaScripts to check the data (ie email) but i also check them when submitted on PHP end, the reason is a general user will enter incorrect data (handled by the JS) no stress on the server a cracker will remove the javascript and attempt to submit invalid data.. the PHP side deals with this and logs the attempts.. -
sorry for the many attempts (i deal with many posts at once) can you please click topic solved (bottom left)
-
can you post myconnect.php remove the user/pass for the post or post lines 28 to 35 should do it i assume its updated
-
OK last one.. well should be! <?php if(isset($_POST['submitBtn'])) { if ($error == '') { echo "Welcome $username! <br/>You are logged in!<br/><br/>"; echo '<a href="main.php">Click here to enter!</a>'; }else { echo $error; } } ?>
-
[SOLVED] how to download file from hyperlink?
MadTechie replied to sayedsohail's topic in PHP Coding Help
should be simple hyperlink echo "<a href='<?php echo $filelocation'>Click to open</a>"; if its a PDF they will need the reader (IE Adobe Acrobat Reader) installed -
try this updated $link = mysql_connect('localhost', 'USERNAME', 'PASSWORD'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('YOUR_DATABASE_NAME', $link); $SQL = "select * from sbjbs_online where sb_ip='$ip'"; $result = mysql_query($SQL)or die(mysql_error()); $online=mysql_fetch_array($result); please note the 'USERNAME', 'PASSWORD' & 'YOUR_DATABASE_NAME' these need to be your settings
-
[SOLVED] how to download file from hyperlink?
MadTechie replied to sayedsohail's topic in PHP Coding Help
create a download page download.php?file=pdf/xyz.pdf <?php forceDownload($_GET['file']); function forceDownload($archiveName) { $headerInfo = ''; if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } // Security checks if( $archiveName == "" ) { echo "<html><title>PDF - Download </title><body><BR><B>ERROR:</B> The download file was NOT SPECIFIED.</body></html>"; exit; } elseif ( ! file_exists( $archiveName ) ) { echo "<html><title>PDF - Download </title><body><BR><B>ERROR:</B> File not found.</body></html>"; exit; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); header("Content-Type: application/pdf"); header("Content-Disposition: attachment; filename=".basename($archiveName).";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($archiveName)); ini_set("memory_limit","32M"); readfile("$archiveName"); } ?> please note this is just an example -
PHP drop down to redirect URL on the same page
MadTechie replied to t_k_eoh's topic in PHP Coding Help
or a simple JS version! <script language=JavaScript> <!-- function Navigate() { var number = NavSelect.selectedIndex; location.href = NavSelect.options[number].value; } // --> </script> form code <select name="NavSelect" onChange="Navigate(this.form)"> <option value="" SELECTED>Click to Navigate <option value="YourPage.html">Your Page <option value="about:blank">Blank Page <option value="http://www.yoursite.com">Home </select> -
Missing ) change $online=mysql_fetch_array(mysql_query("select * from sbjbs_online where sb_ip='$ip'")OR die(mysql_error()); to $online=mysql_fetch_array(mysql_query("select * from sbjbs_online where sb_ip='$ip'")OR die(mysql_error())); or more readable $SQL = "select * from sbjbs_online where sb_ip='$ip'"; $result = mysql_query($SQL)or die(mysql_error()); $online=mysql_fetch_array($result);
-
OK here the problem, from the first post change <?php if ($error == '') { echo "Welcome $username! <br/>You are logged in!<br/><br/>"; echo '<a href="index.php">Click here to enter!</a>'; } else echo $error; ?> to <?php if ($error == '' && isset($_POST['submitBtn'])) { echo "Welcome $username! <br/>You are logged in!<br/><br/>"; echo '<a href="main.php">Click here to enter!</a>'; }else echo $error; ?>
-
my expression works in RegEx Editor but not in php!!
MadTechie replied to RedMaster's topic in Regex Help
for eregi use $regexp1 = '^(([a-zA-Z[:space:]]+([[:space:]]?[-]?[[:space:]]?)?)+([a-zA-Z]*))+$'; for Preg use $regexp1 ='/^(([a-zA-Z\s]+([\s]?[\-]?[\s]?)?)+([a-zA-Z]*))+$/i'; as a side note using eregi or adding i after the / delimitor on preg is case insensitive so you can remove the A-Z and just have the a-z example (this should work in replacment) function validateName($name) { return preg_match('/^(([a-z\s]+([\s]?[\-]?[\s]?)?)+([a-z]*))+$/si', $name); } -
can you post the file /home/findjobs/public_html/myconnect.php or lines 28 to 33 please use code # tags
-
its doing exactly what you coded it to do ? what do you want it to do ?
-
header("Location: http://msdsimaging.com/sidemo/request_3.php?INDEXB=$INDEXB"); will work to check it do this die("Location: http://msdsimaging.com/sidemo/request_3.php?INDEXB=$INDEXB"); that will echo and stop the script if it ends with INDEXB= then $INDEXB has no value