dreamwest
Members-
Posts
1,223 -
Joined
-
Last visited
Never
Everything posted by dreamwest
-
My mistake 13 errors... Change if ($done !="TRUE"){ To if ($done ="TRUE"){
-
Google main page has a dropdown - which it actually a select form, it been styles to look like a submenu. Anyway hide your submenus By making the div or form absolute (position:absolute; z-index:1;) and make the submenu relative (position:relative; z-index:2;) on mouseover, you can do this will images as well
-
It works, ive been using it for 6 months now Check over everthing again, make sure the files are in the root directory for testing http://site.com/index.php http://site.com/ajax.js http://site.com/submit.php Go to index.php > Click the link "Test me!" > It should Remove the link and replace it with the echo from submit.php page - "Im working"
-
External is remote domain http://remote.com //remote Local is still subdomain http:sub.site.com //local
-
Your trying to use "?" in the fake url RewriteRule ^resource http://www.site.com You cant have it both ways - sometimes going to redirect and sometimes going to index.php?action=resource by using the same fake url You can have #main index page RewriteRule ^$ index.php #recorce page RewriteRule ^resource index.php?action=resource
-
The code i posted is ready made - just cut n paste it and your away So your saying your trying to execute a page on a remote server? If its a subdomain you can by adding the absolute url /homes/user/site/page.php
-
RewriteRule ^([^/\.]+)?/?$ anything.php?action=register [L,QSA] So fake urls like: http://site.com/register http://site.com/hello http://site.com/something http://site.com/else Will all go to anything.php?action=register
-
If your setting a cookie on login redirect after successful login header("Location: success.php"); Sessions wont need redirection but only last as long as the browser is open You can set a session with any value $sessionid = $_SESSION['loggedin']=1;
-
Unless you somehow can ascertain the quality of that example, I would be extremely cautious with that approach. Worst case you end up picking up a lot of bad habits and bad practices. See the PHP Help forum for proof. I love php and mysql manuals now, but i couldn't understand them when i started.
-
There was about 12 errors in this script, ive rewritten it for you <title>Edit News</title> <?php //LAST UPDATE // 27-09-2007 include("config.php"); $newsid = $_GET['newsid']; if(isset($_POST['submit'])){ $title = $_POST['title']; $text1 = $_POST['text1']; $text2 = $_POST['text2']; //check if (title) field is empty then print error message. if(!$title){ //this means If the title is really empty. $error = "Error: News title is a required field. Please fill it."; }elseif ((bool) preg_match('/[0-9]/', $title)) { $error3 = "Error: News title must not contain numbers. Please refill it, with all numbers removed."; }elseif(!$text1){ //this means If the title is really empty. $error1= "Error: News text1 is a required field. Please fill it."; }elseif ((bool) preg_match('/[0-9]/', $text1)) { $error4 = "Error: News title must not contain numbers. Please refill it, with all numbers removed."; }elseif(!$text2){ //this means If the title is really empty. $error2= "Error: News text2 is a required field. Please fill it."; }elseif ((bool) preg_match('/[0-9]/', $text2)) { $error5 = "Error: News title must not contain numbers. Please refill it with all numbers removed."; } mysql_query("UPDATE news SET title='{$title}', text1='{$text1}', text2='{$text2}' ",$connect); }//end if submit echo "<b>Thank you! News UPDATED Successfully!<br>You'll be redirected to Home Page after (4) Seconds"; echo "<meta http-equiv=Refresh content=4;url=index.php>"; $done="TRUE"; if ($done !="TRUE"){ $result = mysql_query("SELECT * FROM news WHERE newsid='{$newsid}' ",$connect); while($myrow = mysql_fetch_assoc($result)){ $title = $myrow["title"]; $text1 = $myrow["text1"]; $text2= $myrow["text2"]; ?> <br> <h3>::Edit News</h3> <form method="post" action="<?php echo $PHP_SELF ?>"> <input type="hidden" name="newsid" value="<? echo $myrow['newsid']?>"> Title: <input name="title" size="40" maxlength="255" value="<? echo $title; ?>"><?php echo $error ?> <?php echo $error3 ?> <br> Text1: <textarea name="text1" rows="7" cols="30"><? echo $text1; ?></textarea><?php echo $error1 ?> <?php echo $error4 ?> <br> Text2: <textarea name="text2" rows="7" cols="30"><? echo $text2; ?></textarea> <?php echo $error2 ?> <?php echo $error5 ?> <br> <input type="submit" name="submit" value="Update News"> </form> <? }//end of while loop }//end else ?>
-
looking at your code you dont really need the database elseif Find: elseif{$result = mysql_query"UPDATE news SET title='{$title}', text1='{$text1}', text2='{$text2}' ",$connect");} } replace: mysql_query("UPDATE news SET title='{$title}', text1='{$text1}', text2='{$text2}' ",$connect");
-
Grab an example, play around with it and experiment I remember the first time i learnt how to update a database, i was jumping around. Databases used to scare me - until i found out how simple it really is. Finally : Program from the heart - its more fun
-
without looking at the code closely, redirect users after they login using header, redirect them to the index.php page, the cookie is set but the page wont recognize it without page reload
-
Make another elseif clause based on database input elseif(something){ mysql_query("UPDATE news SET title='{$title}', text1='{$text1}', text2='{$text2}' ,$connect"); echo "<b>Thank you! News UPDATED Successfully!<br>You'll be redirected to Home Page after (4) Seconds"; echo "<meta http-equiv=Refresh content=4;url=index.php>"; $done="TRUE"; }
-
Try this instead, remember to set your form id var object_busy= false; ShowLoading = 1 ; var MyTimer = null; Myvar = "<table align='center'><tr><td><img src='/templates/images/loading.gif' ></td></tr></table>"; function RequireAjaxData_post($Request, $Control) { if ($Control == "" || $Control == null) {alert ("No output specified !"); return;} var ai = new AJAXInteraction($Request, GetServerData, $Control ); ai.doPost("sendForm"); } function GetServerData ($TheData, $Control){ document.getElementById($Control).innerHTML = $TheData; } function AJAXInteraction(url, callback, $Control) { var req = init(); req.onreadystatechange = processRequest; function init() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else {alert ("Your browser seems to be out of date, Please update!"); return; } } function processRequest () { if (req.readyState == 4) { if (req.status == 200) callback(req.responseText, $Control); } else callback(Myvar , $Control); } this.processForm = function (formID) { var tmp = new Array(); var n, form; form = document.getElementById(formID); for (n=0;n<form.length;n++) tmp.push(encodeURI(form.elements[n].name) + "=" + encodeURI(form.elements[n].value)); return tmp.join("&"); } this.doGet = function(formID) { var vars = this.processForm(formID); req.open("GET", url+"?"+vars, true); req.send(null); } this.doPost = function(formID) { var body = this.processForm(formID); req.open("POST", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(body); } }
-
ajax.js - ive even thrown in a loading div for you var object_busy= false; ShowLoading = 1 ; var MyTimer = null; Myvar = "<table align='center'><tr><td><img src='/templates/images/loading.gif' ></td></tr></table>"; function RequireAjaxData($Request, $Control) { if ($Control == "" || $Control == null) {alert ("No output specified !"); return;} var ai = new AJAXInteraction($Request, GetServerData, $Control ); ai.doGet(); } function GetServerData ($TheData, $Control){ document.getElementById($Control).innerHTML = $TheData; } function AJAXInteraction(url, callback, $Control) { var req = init(); req.onreadystatechange = processRequest; function init() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else {alert ("Your browser seems to be out of date, Please update!"); return; } } function processRequest () { if (req.readyState == 4) { if (req.status == 200) callback(req.responseText, $Control); } else callback(Myvar , $Control); } this.doGet = function() { req.open("GET", url, true); req.send(null); } this.doPost = function(body) { req.open("POST", url, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(body); } } index.php <script src="/ajax.js"></script> <div id='MyDIV'> <a href='' onclick='RequireAjaxData("/submit.php?id=id_here", "MyDIV"); return false;'> Test me!</a></div> submit.php //database stuff //Always echo from this page, dont try to display templates from this page echo "Im working";
-
Your making it too complicated ErrorDocument 404 /error_pages/error404.htm ErrorDocument 403 /error_pages/error403.htm
-
Looks fine. Make sure $USERname has a value by echoing it out
-
elseif{$result = mysql_query"UPDATE news SET title='{$title}', text1='{$text1}', text2='{$text2}' ",$connect");} } Heres the error, its crying out for help
-
You can have ajax.js in a different directory http://site.com/ajax/ajax.js and execute from http://site.com/index.php which will go to something like http://site.com/execute.php just by adding a link Are you trying to POST or GET to the execute.php page? POST is a form your posting, GET will be a form of post but in a hyperlink
-
Thanks for the help. Ive figured it out, and successfully make new -smaller thumbs in the directory. But i have one final step, i need to set it to cron and run it once a day but limit the files it selects to something like 30 files, or a time range like select files modifided today only require_once('../include/SimpleImage.class.php'); $dir = '/home/user/public_html/thumb/'; foreach(scandir($dir) as $file){ if(!preg_match('/^\d+_/',$file)) continue; //Skip anything that doesn't start with a #_ $filesize = round(filesize($dir."".$file)/1024); if ($filesize > 6){ echo "<hr>".$file." Image has size of ".$filesize." - NOW RESIZING <hr>"; // resize $image = new SimpleImage(); $image->load($dir."".$file); $image->resize(140,110); $image->save($dir."".$file); }else{ echo "".$file." SKIPPING image has size of ".$filesize."<br>"; } }
-
OK ive manged to recreate 20,000 images but the script times out, i have over 100,000 images in this directory is there a way i can only select files that are over 8kb in size, i tried this but its only selecting images 3000.jpg instead of 1_3000.jpg $dir = '/home/user/public_html/thumb/'; foreach(scandir($dir) as $file){ $filesize = round(filesize($file)/1024); if(!preg_match('/^\d+_/',$file) && $filesize > continue; //Skip anything that doesn't start with a #_ echo "$file<br>";
-
OK all the examples work but im trying to integrate it with my script - im lost. Heres what ive got at the moment: // connect to source ftp server $source_conn = ftp_connect($source_ftp_server) or die("Could not connect to $source_ftp_server!"); ftp_login($source_conn, $source_ftp_user, $source_ftp_pass) or die("Could not login to $source_ftp_server!"); // get a list of all files and pick a random one $source_file_list = ftp_nlist($source_conn, "."); do { shuffle($source_file_list); $our_file = $source_file_list[0]; } while (strtolower(substr($our_file, -4)) != '.jpg'); // get that file ftp_get($source_conn, "tmp-" . $our_file, $our_file, FTP_BINARY) or die("Could not download $our_file from $source_ftp_server!");
-
I have differnt images in a directory like this: 3000.jpg 1_3000.jpg 2_3000.jpg 3_3000.jpg I want to recreate all images with the 1_ 2_ and 3_ extension but leave the main image 3000.jpg How can i select only these images and leave the 3000.jpg image?
-
Yeah strreplace $filename = "Credit Card Validation"; $filename=str_replace(' ',"-",$filename); //oututs Credit-Card-Validation